From bfb5e9384393820e3bf42c28a31ea4bebefdf599 Mon Sep 17 00:00:00 2001 From: Falseen Date: Fri, 17 Feb 2017 17:43:35 +0800 Subject: [PATCH] update config to _config for tunnel and fix pep8 --- shadowsocks/local.py | 9 +++++---- shadowsocks/tunnel.py | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/shadowsocks/local.py b/shadowsocks/local.py index 95011d7..e74b161 100755 --- a/shadowsocks/local.py +++ b/shadowsocks/local.py @@ -53,11 +53,12 @@ def main(): has_tunnel = False # if both_tunnel_local is True then run tunnel_udp_server if config["both_tunnel_local"]: - config["local_port"] = config.copy()["tunnel_port"] + _config = config.copy() + _config["local_port"] = _config["tunnel_port"] logging.info("starting tunnel at %s:%d forward to %s:%d" % - (config['local_address'], config['local_port'], config['tunnel_remote'], - config['tunnel_remote_port'])) - tunnel_udp_server = udprelay.UDPRelay(config, dns_resolver, True) + (_config['local_address'], _config['local_port'], + _config['tunnel_remote'], _config['tunnel_remote_port'])) + tunnel_udp_server = udprelay.UDPRelay(_config, dns_resolver, True) tunnel_udp_server.is_tunnel = True tunnel_udp_server.add_to_loop(loop) has_tunnel = True diff --git a/shadowsocks/tunnel.py b/shadowsocks/tunnel.py index 46c3827..d710df2 100644 --- a/shadowsocks/tunnel.py +++ b/shadowsocks/tunnel.py @@ -43,11 +43,12 @@ def main(): loop = eventloop.EventLoop() dns_resolver.add_to_loop(loop) # tcp_server.add_to_loop(loop) - config["local_port"] = config.copy()["tunnel_port"] + _config = config.copy() + _config["local_port"] = _config["tunnel_port"] logging.info("starting tunnel at %s:%d forward to %s:%d" % - (config['local_address'], config['local_port'], config['tunnel_remote'], - config['tunnel_remote_port'])) - tunnel_udp_server = udprelay.UDPRelay(config, dns_resolver, True) + (_config['local_address'], _config['local_port'], + _config['tunnel_remote'], _config['tunnel_remote_port'])) + tunnel_udp_server = udprelay.UDPRelay(_config, dns_resolver, True) tunnel_udp_server.is_tunnel = True tunnel_udp_server.add_to_loop(loop)