update config to _config for tunnel

and fix pep8
This commit is contained in:
Falseen 2017-02-17 17:43:35 +08:00
parent ac1883eb7f
commit bfb5e93843
2 changed files with 10 additions and 8 deletions

View file

@ -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

View file

@ -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)