[tor-commits] [snowflake/master] Remove unused Params.getAddress.

dcf at torproject.org dcf at torproject.org
Fri Jul 19 00:12:13 UTC 2019


commit c1f65486027463b7ded7ec22e1ab0dc892887c69
Author: David Fifield <david at bamsoftware.com>
Date:   Thu Jul 18 16:24:11 2019 -0600

    Remove unused Params.getAddress.
    
    It was formerly used for the "broker" and "relay" query string
    parameters, which were removed in
    debe9c3748835400e9152ce4683964884a131edb.
---
 proxy/spec/util.spec.js | 29 -----------------------------
 proxy/util.js           | 11 -----------
 2 files changed, 40 deletions(-)

diff --git a/proxy/spec/util.spec.js b/proxy/spec/util.spec.js
index 17968b1..d592517 100644
--- a/proxy/spec/util.spec.js
+++ b/proxy/spec/util.spec.js
@@ -244,33 +244,4 @@ describe('Params', function() {
 
   });
 
-  describe('address', function() {
-
-    var DEFAULT = {
-      host: '1.1.1.1',
-      port: 2222
-    };
-
-    var getAddress = function(query) {
-      return Params.getAddress(query, 'addr', DEFAULT);
-    };
-
-    it('parses correctly', function() {
-      expect(getAddress({})).toEqual(DEFAULT);
-      expect(getAddress({
-        addr: '3.3.3.3:4444'
-      })).toEqual({
-        host: '3.3.3.3',
-        port: 4444
-      });
-      expect(getAddress({
-        x: '3.3.3.3:4444'
-      })).toEqual(DEFAULT);
-      expect(getAddress({
-        addr: '---'
-      })).toBeNull();
-    });
-
-  });
-
 });
diff --git a/proxy/util.js b/proxy/util.js
index 073251e..c237734 100644
--- a/proxy/util.js
+++ b/proxy/util.js
@@ -238,17 +238,6 @@ class Params {
     return Parse.byteCount(spec);
   }
 
-  // Get an object value and parse it as an address spec. Returns |defaultValue|
-  // if param is not a key. Returns null on a parsing error.
-  static getAddress(query, param, defaultValue) {
-    var val;
-    val = query[param];
-    if (void 0 === val) {
-      return defaultValue;
-    }
-    return Parse.address(val);
-  }
-
   // Get an object value and return it as a string. Returns default_val if param
   // is not a key.
   static getString(query, param, defaultValue) {





More information about the tor-commits mailing list