diff --git a/server_pool.py b/server_pool.py index 566154c..cdeba36 100644 --- a/server_pool.py +++ b/server_pool.py @@ -134,17 +134,17 @@ class ServerPool(object): try: logging.info("starting server at %s:%d" % (a_config['server'], port)) - if not ipv6_ok: - tcp_server = tcprelay.TCPRelay(a_config, self.dns_resolver, False) - tcp_server.add_to_loop(self.loop) - self.tcp_servers_pool.update({port: tcp_server}) + tcp_server = tcprelay.TCPRelay(a_config, self.dns_resolver, False) + tcp_server.add_to_loop(self.loop) + self.tcp_servers_pool.update({port: tcp_server}) - udp_server = udprelay.UDPRelay(a_config, self.dns_resolver, False) - udp_server.add_to_loop(self.loop) - self.udp_servers_pool.update({port: udp_server}) + udp_server = udprelay.UDPRelay(a_config, self.dns_resolver, False) + udp_server.add_to_loop(self.loop) + self.udp_servers_pool.update({port: udp_server}) except Exception, e: - logging.warn("IPV4 %s " % (e,)) + if not ipv6_ok: + logging.warn("IPV4 %s " % (e,)) return True diff --git a/shadowsocks/encrypt_test.py b/shadowsocks/encrypt_test.py new file mode 100644 index 0000000..68228e1 --- /dev/null +++ b/shadowsocks/encrypt_test.py @@ -0,0 +1,33 @@ +from __future__ import absolute_import, division, print_function, \ + with_statement + +import sys +import os + +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../')) + + +from crypto import rc4_md5 +from crypto import openssl +from crypto import sodium +from crypto import table + +def main(): + print("\n""rc4_md5") + rc4_md5.test() + print("\n""aes-256-cfb") + openssl.test_aes_256_cfb() + print("\n""aes-128-cfb") + openssl.test_aes_128_cfb() + print("\n""rc4") + openssl.test_rc4() + print("\n""salsa20") + sodium.test_salsa20() + print("\n""chacha20") + sodium.test_chacha20() + print("\n""table") + table.test_encryption() + +if __name__ == '__main__': + main() + diff --git a/shadowsocks/server.py b/shadowsocks/server.py index bcccdb5..d919092 100755 --- a/shadowsocks/server.py +++ b/shadowsocks/server.py @@ -54,6 +54,7 @@ def main(): for port, password in config['port_password'].items(): a_config = config.copy() ipv6_ok = False + logging.info("server start with password [%s] method [%s]" % (password, a_config['method'])) if 'server_ipv6' in a_config: try: if len(a_config['server_ipv6']) > 2 and a_config['server_ipv6'][0] == "[" and a_config['server_ipv6'][-1] == "]": @@ -70,16 +71,16 @@ def main(): except Exception as e: shell.print_exception(e) - if not ipv6_ok: - try: - a_config = config.copy() - a_config['server_port'] = int(port) - a_config['password'] = password - logging.info("starting server at %s:%d" % - (a_config['server'], int(port))) - tcp_servers.append(tcprelay.TCPRelay(a_config, dns_resolver, False)) - udp_servers.append(udprelay.UDPRelay(a_config, dns_resolver, False)) - except Exception as e: + try: + a_config = config.copy() + a_config['server_port'] = int(port) + a_config['password'] = password + logging.info("starting server at %s:%d" % + (a_config['server'], int(port))) + tcp_servers.append(tcprelay.TCPRelay(a_config, dns_resolver, False)) + udp_servers.append(udprelay.UDPRelay(a_config, dns_resolver, False)) + except Exception as e: + if not ipv6_ok: shell.print_exception(e) def run_server():