Browse Source

support multiple server ip on client side

master
clowwindy 10 years ago
parent
commit
783a6ef7f2
  1. 1
      .jenkins.sh
  2. 3
      shadowsocks/tcprelay.py
  3. 3
      shadowsocks/udprelay.py
  4. 10
      tests/client-multi-server-ip.json

1
.jenkins.sh

@ -41,6 +41,7 @@ run_test python tests/test.py --with-coverage -c tests/salsa20.json
run_test python tests/test.py --with-coverage -c tests/chacha20.json run_test python tests/test.py --with-coverage -c tests/chacha20.json
run_test python tests/test.py --with-coverage -c tests/table.json run_test python tests/test.py --with-coverage -c tests/table.json
run_test python tests/test.py --with-coverage -c tests/server-multi-ports.json run_test python tests/test.py --with-coverage -c tests/server-multi-ports.json
run_test python tests/test.py --with-coverage -s tests/aes.json -c tests/client-multi-server-ip.json
run_test python tests/test.py --with-coverage -s tests/server-multi-passwd.json -c tests/server-multi-passwd-client-side.json run_test python tests/test.py --with-coverage -s tests/server-multi-passwd.json -c tests/server-multi-passwd-client-side.json
run_test python tests/test.py --with-coverage -c tests/workers.json run_test python tests/test.py --with-coverage -c tests/workers.json
run_test python tests/test.py --with-coverage -s tests/ipv6.json -c tests/ipv6-client-side.json run_test python tests/test.py --with-coverage -s tests/ipv6.json -c tests/ipv6-client-side.json

3
shadowsocks/tcprelay.py

@ -144,8 +144,9 @@ class TCPRelayHandler(object):
server_port = self._config['server_port'] server_port = self._config['server_port']
if type(server_port) == list: if type(server_port) == list:
server_port = random.choice(server_port) server_port = random.choice(server_port)
if type(server) == list:
server = random.choice(server)
logging.debug('chosen server: %s:%d', server, server_port) logging.debug('chosen server: %s:%d', server, server_port)
# TODO support multiple server IP
return server, server_port return server, server_port
def _update_activity(self): def _update_activity(self):

3
shadowsocks/udprelay.py

@ -127,8 +127,9 @@ class UDPRelay(object):
server_port = self._config['server_port'] server_port = self._config['server_port']
if type(server_port) == list: if type(server_port) == list:
server_port = random.choice(server_port) server_port = random.choice(server_port)
if type(server) == list:
server = random.choice(server)
logging.debug('chosen server: %s:%d', server, server_port) logging.debug('chosen server: %s:%d', server, server_port)
# TODO support multiple server IP
return server, server_port return server, server_port
def _close_client(self, client): def _close_client(self, client):

10
tests/client-multi-server-ip.json

@ -0,0 +1,10 @@
{
"server":["127.0.0.1", "127.0.0.1"],
"server_port":8388,
"local_port":1081,
"password":"aes_password",
"timeout":60,
"method":"aes-256-cfb",
"local_address":"127.0.0.1",
"fast_open":false
}
Loading…
Cancel
Save