fix some error for parse dns_servre in config (#798)
and fix pep8 https://github.com/shadowsocks/shadowsocks/pull/739
This commit is contained in:
parent
4e21f83bd6
commit
9e25cc6bb4
2 changed files with 5 additions and 4 deletions
|
@ -7,6 +7,7 @@
|
|||
"method":"aes-256-cfb",
|
||||
"local_address":"127.0.0.1",
|
||||
"fast_open":false,
|
||||
"dns_server":["8.8.8.8", 8.8.4.4],
|
||||
"tunnel_remote":"8.8.8.8",
|
||||
"tunnel_remote_port":53,
|
||||
"tunnel_port":53
|
||||
|
|
|
@ -167,8 +167,7 @@ def check_config(config, is_local):
|
|||
config['server_port'] = int(config['server_port'])
|
||||
|
||||
if 'tunnel_remote_port' in config:
|
||||
config['tunnel_remote_port'] = \
|
||||
int(config['tunnel_remote_port'])
|
||||
config['tunnel_remote_port'] = int(config['tunnel_remote_port'])
|
||||
if 'tunnel_port' in config:
|
||||
config['tunnel_port'] = int(config['tunnel_port'])
|
||||
|
||||
|
@ -198,6 +197,8 @@ def check_config(config, is_local):
|
|||
logging.error('user can be used only on Unix')
|
||||
sys.exit(1)
|
||||
if config.get('dns_server', None) is not None:
|
||||
if type(config['dns_server']) != list:
|
||||
config['dns_server'] = to_str(config['dns_server'])
|
||||
logging.info('Specified DNS server: %s' % config['dns_server'])
|
||||
|
||||
cryptor.try_cipher(config['password'], config['method'])
|
||||
|
@ -313,8 +314,7 @@ def get_config(is_local):
|
|||
config['prefer_ipv6'] = config.get('prefer_ipv6', False)
|
||||
config['server_port'] = config.get('server_port', 8388)
|
||||
|
||||
config['tunnel_remote'] = \
|
||||
to_str(config.get('tunnel_remote', '8.8.8.8'))
|
||||
config['tunnel_remote'] = to_str(config.get('tunnel_remote', '8.8.8.8'))
|
||||
config['tunnel_remote_port'] = config.get('tunnel_remote_port', 53)
|
||||
config['tunnel_port'] = config.get('tunnel_port', 53)
|
||||
config['dns_server'] = config.get('dns_server', None)
|
||||
|
|
Loading…
Add table
Reference in a new issue