close #183
This commit is contained in:
parent
f0b0f6edff
commit
ab74c010fd
2 changed files with 15 additions and 3 deletions
|
@ -41,7 +41,7 @@ def main():
|
||||||
utils.print_shadowsocks()
|
utils.print_shadowsocks()
|
||||||
|
|
||||||
if config['port_password']:
|
if config['port_password']:
|
||||||
if config['server_port'] or config['password']:
|
if config['password']:
|
||||||
logging.warn('warning: port_password should not be used with '
|
logging.warn('warning: port_password should not be used with '
|
||||||
'server_port and password. server_port and password '
|
'server_port and password. server_port and password '
|
||||||
'will be ignored')
|
'will be ignored')
|
||||||
|
|
|
@ -154,7 +154,7 @@ def get_config(is_local):
|
||||||
print_help(is_local)
|
print_help(is_local)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
config['password'] = config.get('password', None)
|
config['password'] = config.get('password', '')
|
||||||
config['method'] = config.get('method', 'aes-256-cfb')
|
config['method'] = config.get('method', 'aes-256-cfb')
|
||||||
config['port_password'] = config.get('port_password', None)
|
config['port_password'] = config.get('port_password', None)
|
||||||
config['timeout'] = int(config.get('timeout', 300))
|
config['timeout'] = int(config.get('timeout', 300))
|
||||||
|
@ -172,11 +172,23 @@ def get_config(is_local):
|
||||||
config['server'] = config.get('server', '0.0.0.0')
|
config['server'] = config.get('server', '0.0.0.0')
|
||||||
config['server_port'] = config.get('server_port', 8388)
|
config['server_port'] = config.get('server_port', 8388)
|
||||||
|
|
||||||
if not ('password' in config and config['password']):
|
if is_local and not config.get('password', None):
|
||||||
logging.error('password not specified')
|
logging.error('password not specified')
|
||||||
print_help(is_local)
|
print_help(is_local)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
|
if not is_local and not config.get('password', None) \
|
||||||
|
and not config.get('port_password', None):
|
||||||
|
logging.error('password or port_password not specified')
|
||||||
|
print_help(is_local)
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
if 'local_port' in config:
|
||||||
|
config['local_port'] = int(config['local_port'])
|
||||||
|
|
||||||
|
if 'server_port' in config:
|
||||||
|
config['server_port'] = int(config['server_port'])
|
||||||
|
|
||||||
logging.getLogger('').handlers = []
|
logging.getLogger('').handlers = []
|
||||||
logging.addLevelName(VERBOSE_LEVEL, 'VERBOSE')
|
logging.addLevelName(VERBOSE_LEVEL, 'VERBOSE')
|
||||||
if config['verbose'] >= 2:
|
if config['verbose'] >= 2:
|
||||||
|
|
Loading…
Reference in a new issue