fix server

This commit is contained in:
clowwindy 2014-06-01 17:16:58 +08:00
parent f49d086d6a
commit fd35f1d067
3 changed files with 5 additions and 3 deletions

View file

@ -52,10 +52,10 @@ def main():
udp_servers = []
for port, password in config['port_password'].items():
a_config = config.copy()
a_config['server_port'] = port
a_config['server_port'] = int(port)
a_config['password'] = password
logging.info("starting server at %s:%d" %
(a_config['server'], port))
(a_config['server'], int(port)))
tcp_server = tcprelay.TCPRelay(config, False)
tcp_servers.append(tcp_server)
udp_server = udprelay.UDPRelay(config, False)

View file

@ -248,6 +248,8 @@ class TCPRelayHandler(object):
return
if self._is_local:
data = self._encryptor.decrypt(data)
else:
data = self._encryptor.encrypt(data)
try:
self.write_all_to_sock(data, self._local_sock)
except Exception:

View file

@ -77,7 +77,7 @@ def get_config(is_local):
shortopts = 's:b:p:k:l:m:c:t:v'
longopts = ['fast-open']
else:
shortopts = 's:p:k:m:c:t:'
shortopts = 's:p:k:m:c:t:v'
longopts = ['fast-open', 'workers:']
try:
config_path = find_config()