|
@ -68,23 +68,32 @@ def main(): |
|
|
port_password = config['port_password'] |
|
|
port_password = config['port_password'] |
|
|
del config['port_password'] |
|
|
del config['port_password'] |
|
|
for port, password_obfs in port_password.items(): |
|
|
for port, password_obfs in port_password.items(): |
|
|
|
|
|
protocol = 'origin' |
|
|
|
|
|
obfs_param = '' |
|
|
if type(password_obfs) == list: |
|
|
if type(password_obfs) == list: |
|
|
password = password_obfs[0] |
|
|
password = password_obfs[0] |
|
|
obfs = password_obfs[1] |
|
|
obfs = password_obfs[1] |
|
|
|
|
|
elif type(password_obfs) == dict: |
|
|
|
|
|
password = password_obfs.get('password', 'm') |
|
|
|
|
|
protocol = password_obfs.get('protocol', 'origin') |
|
|
|
|
|
obfs = password_obfs.get('obfs', 'plain') |
|
|
|
|
|
obfs_param = password_obfs.get('obfs_param', '') |
|
|
else: |
|
|
else: |
|
|
password = password_obfs |
|
|
password = password_obfs |
|
|
obfs = config["obfs"] |
|
|
obfs = config["obfs"] |
|
|
a_config = config.copy() |
|
|
a_config = config.copy() |
|
|
ipv6_ok = False |
|
|
ipv6_ok = False |
|
|
logging.info("server start with password [%s] method [%s] obfs [%s] obfs_param [%s]" % |
|
|
logging.info("server start with protocol[%s] password [%s] method [%s] obfs [%s] obfs_param [%s]" % |
|
|
(password, a_config['method'], obfs, a_config['obfs_param'])) |
|
|
(protocol, password, a_config['method'], obfs, obfs_param)) |
|
|
if 'server_ipv6' in a_config: |
|
|
if 'server_ipv6' in a_config: |
|
|
try: |
|
|
try: |
|
|
if len(a_config['server_ipv6']) > 2 and a_config['server_ipv6'][0] == "[" and a_config['server_ipv6'][-1] == "]": |
|
|
if len(a_config['server_ipv6']) > 2 and a_config['server_ipv6'][0] == "[" and a_config['server_ipv6'][-1] == "]": |
|
|
a_config['server_ipv6'] = a_config['server_ipv6'][1:-1] |
|
|
a_config['server_ipv6'] = a_config['server_ipv6'][1:-1] |
|
|
a_config['server_port'] = int(port) |
|
|
a_config['server_port'] = int(port) |
|
|
a_config['password'] = password |
|
|
a_config['password'] = password |
|
|
|
|
|
a_config['protocol'] = protocol |
|
|
a_config['obfs'] = obfs |
|
|
a_config['obfs'] = obfs |
|
|
|
|
|
a_config['obfs_param'] = obfs_param |
|
|
a_config['server'] = a_config['server_ipv6'] |
|
|
a_config['server'] = a_config['server_ipv6'] |
|
|
logging.info("starting server at [%s]:%d" % |
|
|
logging.info("starting server at [%s]:%d" % |
|
|
(a_config['server'], int(port))) |
|
|
(a_config['server'], int(port))) |
|
@ -99,7 +108,9 @@ def main(): |
|
|
a_config = config.copy() |
|
|
a_config = config.copy() |
|
|
a_config['server_port'] = int(port) |
|
|
a_config['server_port'] = int(port) |
|
|
a_config['password'] = password |
|
|
a_config['password'] = password |
|
|
|
|
|
a_config['protocol'] = protocol |
|
|
a_config['obfs'] = obfs |
|
|
a_config['obfs'] = obfs |
|
|
|
|
|
a_config['obfs_param'] = obfs_param |
|
|
logging.info("starting server at %s:%d" % |
|
|
logging.info("starting server at %s:%d" % |
|
|
(a_config['server'], int(port))) |
|
|
(a_config['server'], int(port))) |
|
|
tcp_servers.append(tcprelay.TCPRelay(a_config, dns_resolver, False)) |
|
|
tcp_servers.append(tcprelay.TCPRelay(a_config, dns_resolver, False)) |
|
|