support multiple server ip on client side
This commit is contained in:
parent
e71ce6c758
commit
783a6ef7f2
4 changed files with 15 additions and 2 deletions
|
@ -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
|
||||||
|
|
|
@ -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):
|
||||||
|
|
|
@ -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
Normal file
10
tests/client-multi-server-ip.json
Normal 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
|
||||||
|
}
|
Loading…
Reference in a new issue