diff --git a/db_transfer.py b/db_transfer.py index 2e0864a..91cb563 100644 --- a/db_transfer.py +++ b/db_transfer.py @@ -120,7 +120,7 @@ class DbTransfer(object): passwd = common.to_bytes(row['passwd']) cfg = {'password': passwd} - read_config_keys = ['method', 'obfs', 'protocol', 'forbidden_port'] + read_config_keys = ['method', 'obfs', 'protocol', 'forbidden_ip', 'forbidden_port'] for name in read_config_keys: if name in row and row[name]: cfg[name] = row[name] diff --git a/shadowsocks/common.py b/shadowsocks/common.py index ee6e6f2..afb7bbe 100644 --- a/shadowsocks/common.py +++ b/shadowsocks/common.py @@ -233,6 +233,7 @@ class IPNetwork(object): ADDRLENGTH = {socket.AF_INET: 32, socket.AF_INET6: 128, False: 0} def __init__(self, addrs): + self.addrs_str = addrs self._network_list_v4 = [] self._network_list_v6 = [] if type(addrs) == str: @@ -283,8 +284,12 @@ class IPNetwork(object): else: return False + def __cmp__(self, other): + return cmp(self.addrs_str, other.addrs_str) + class PortRange(object): def __init__(self, range_str): + self.range_str = range_str self.range = set() if type(range_str) == str: range_str = range_str.split(',') @@ -310,8 +315,8 @@ class PortRange(object): def __contains__(self, val): return val in self.range - def __eq__(self, other): - return self.range == other.range + def __cmp__(self, other): + return cmp(self.range_str, other.range_str) def test_inet_conv(): ipv4 = b'8.8.4.4' diff --git a/shadowsocks/shell.py b/shadowsocks/shell.py index 0d6d338..64fbef2 100644 --- a/shadowsocks/shell.py +++ b/shadowsocks/shell.py @@ -199,7 +199,7 @@ def get_config(is_local): elif key == '--user': config['user'] = to_str(value) elif key == '--forbidden-ip': - config['forbidden_ip'] = to_str(value).split(',') + config['forbidden_ip'] = to_str(value) elif key in ('-h', '--help'): if is_local: print_local_help()