support multiple server ip on client side

This commit is contained in:
clowwindy 2015-02-09 13:50:46 +08:00
parent e71ce6c758
commit 783a6ef7f2
4 changed files with 15 additions and 2 deletions

View file

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

View file

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

View file

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

View file

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