Browse Source

fix server check

master
clowwindy 10 years ago
parent
commit
e71ce6c758
  1. 6
      shadowsocks/utils.py

6
shadowsocks/utils.py

@ -87,7 +87,7 @@ def check_config(config, is_local):
if config.get('local_address', '') in [b'0.0.0.0']: if config.get('local_address', '') in [b'0.0.0.0']:
logging.warn('warning: local set to listen on 0.0.0.0, it\'s not safe') logging.warn('warning: local set to listen on 0.0.0.0, it\'s not safe')
if config.get('server', '') in [b'127.0.0.1', b'localhost']: if config.get('server', '') in ['127.0.0.1', 'localhost']:
logging.warn('warning: server set to listen on %s:%s, are you sure?' % logging.warn('warning: server set to listen on %s:%s, are you sure?' %
(to_str(config['server']), config['server_port'])) (to_str(config['server']), config['server_port']))
if (config.get('method', '') or '').lower() == 'table': if (config.get('method', '') or '').lower() == 'table':
@ -215,8 +215,10 @@ def get_config(is_local):
logging.error('server addr not specified') logging.error('server addr not specified')
print_local_help() print_local_help()
sys.exit(2) sys.exit(2)
else:
config['server'] = to_str(config['server'])
else: else:
config['server'] = config.get('server', '0.0.0.0') config['server'] = to_str(config.get('server', '0.0.0.0'))
try: try:
config['forbidden_ip'] = \ config['forbidden_ip'] = \
IPNetwork(config.get('forbidden_ip', '127.0.0.0/8,::1/128')) IPNetwork(config.get('forbidden_ip', '127.0.0.0/8,::1/128'))

Loading…
Cancel
Save