This commit is contained in:
clowwindy 2014-09-20 19:01:52 +08:00
parent f0b0f6edff
commit ab74c010fd
2 changed files with 15 additions and 3 deletions

View file

@ -41,7 +41,7 @@ def main():
utils.print_shadowsocks()
if config['port_password']:
if config['server_port'] or config['password']:
if config['password']:
logging.warn('warning: port_password should not be used with '
'server_port and password. server_port and password '
'will be ignored')

View file

@ -154,7 +154,7 @@ def get_config(is_local):
print_help(is_local)
sys.exit(2)
config['password'] = config.get('password', None)
config['password'] = config.get('password', '')
config['method'] = config.get('method', 'aes-256-cfb')
config['port_password'] = config.get('port_password', None)
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_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')
print_help(is_local)
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.addLevelName(VERBOSE_LEVEL, 'VERBOSE')
if config['verbose'] >= 2: