Browse Source

fix server

auth
clowwindy 11 years ago
parent
commit
fd35f1d067
  1. 4
      shadowsocks/server.py
  2. 2
      shadowsocks/tcprelay.py
  3. 2
      shadowsocks/utils.py

4
shadowsocks/server.py

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

2
shadowsocks/tcprelay.py

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

2
shadowsocks/utils.py

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

Loading…
Cancel
Save