From fd35f1d0673caff8ef0c1c62173feff4aa9aaff5 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Sun, 1 Jun 2014 17:16:58 +0800 Subject: [PATCH] fix server --- shadowsocks/server.py | 4 ++-- shadowsocks/tcprelay.py | 2 ++ shadowsocks/utils.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/shadowsocks/server.py b/shadowsocks/server.py index bfb2f8b..d3e384f 100755 --- a/shadowsocks/server.py +++ b/shadowsocks/server.py @@ -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) diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py index 6184ee7..3f72ed2 100644 --- a/shadowsocks/tcprelay.py +++ b/shadowsocks/tcprelay.py @@ -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: diff --git a/shadowsocks/utils.py b/shadowsocks/utils.py index 595068a..bc9d92a 100644 --- a/shadowsocks/utils.py +++ b/shadowsocks/utils.py @@ -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()