From 96a9a25eaab10925a467be9d3b0a2df1c1c3bc95 Mon Sep 17 00:00:00 2001 From: falseen Date: Wed, 30 Sep 2015 01:01:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=AB=AF=E5=8F=A3=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E6=94=AF=E6=8C=81=E6=AF=8F=E4=B8=AA=E7=AB=AF=E5=8F=A3?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E4=B8=8D=E5=90=8C=E7=9A=84=E6=B7=B7=E6=B7=86?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加:多端口模式下支持每个端口定义不同的混淆协议 --- shadowsocks/server.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/shadowsocks/server.py b/shadowsocks/server.py index e61d6c2..006a372 100755 --- a/shadowsocks/server.py +++ b/shadowsocks/server.py @@ -59,16 +59,23 @@ def main(): dns_resolver = asyncdns.DNSResolver() port_password = config['port_password'] del config['port_password'] - for port, password in port_password.items(): + for port, password_obfs in port_password.items(): + if type(password_obfs) == list: + password = password_obfs[0] + obfs = password_obfs[1] + else: + password = password_obfs + obfs = config["obfs"] a_config = config.copy() ipv6_ok = False - logging.info("server start with password [%s] method [%s]" % (password, a_config['method'])) + logging.info("server start with password [%s] obfs [%s] method [%s]" % (password, obfs, 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] == "]": a_config['server_ipv6'] = a_config['server_ipv6'][1:-1] a_config['server_port'] = int(port) a_config['password'] = password + a_config['obfs'] = obfs a_config['server'] = a_config['server_ipv6'] logging.info("starting server at %s:%d" % (a_config['server'], int(port))) @@ -83,6 +90,7 @@ def main(): a_config = config.copy() a_config['server_port'] = int(port) a_config['password'] = password + a_config['obfs'] = obfs logging.info("starting server at %s:%d" % (a_config['server'], int(port))) tcp_servers.append(tcprelay.TCPRelay(a_config, dns_resolver, False))