diff --git a/shadowsocks/common.py b/shadowsocks/common.py index 40e46cf..f40b5fa 100644 --- a/shadowsocks/common.py +++ b/shadowsocks/common.py @@ -297,6 +297,12 @@ class IPNetwork(object): def __cmp__(self, other): return cmp(self.addrs_str, other.addrs_str) + def __eq__(self, other): + return self.addrs_str == other.addrs_str + + def __ne__(self, other): + return self.addrs_str != other.addrs_str + class PortRange(object): def __init__(self, range_str): self.range_str = to_str(range_str) @@ -328,6 +334,12 @@ class PortRange(object): def __cmp__(self, other): return cmp(self.range_str, other.range_str) + def __eq__(self, other): + return self.range_str == other.range_str + + def __ne__(self, other): + return self.range_str != other.range_str + def test_inet_conv(): ipv4 = b'8.8.4.4' b = inet_pton(socket.AF_INET, ipv4)