Browse Source

allow default settings

dev
BreakWa11 9 years ago
parent
commit
876bbbe5d8
  1. 16
      shadowsocks/server.py

16
shadowsocks/server.py

@ -40,10 +40,7 @@ def main():
daemon.daemon_exec(config) daemon.daemon_exec(config)
if config['port_password']: if config['port_password']:
if config['password']: pass
logging.warn('warning: port_password should not be used with '
'server_port and password. server_port and password '
'will be ignored')
else: else:
config['port_password'] = {} config['port_password'] = {}
server_port = config['server_port'] server_port = config['server_port']
@ -65,6 +62,7 @@ def main():
udp_servers = [] udp_servers = []
dns_resolver = asyncdns.DNSResolver() dns_resolver = asyncdns.DNSResolver()
port_password = config['port_password'] port_password = config['port_password']
config_password = config.get('password', 'm')
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 = config.get("protocol", 'origin') protocol = config.get("protocol", 'origin')
@ -77,11 +75,11 @@ def main():
if len(password_obfs) > 2: if len(password_obfs) > 2:
protocol = password_obfs[2] protocol = password_obfs[2]
elif type(password_obfs) == dict: elif type(password_obfs) == dict:
password = password_obfs.get('password', 'm') password = password_obfs.get('password', config_password)
protocol = password_obfs.get('protocol', 'origin') protocol = password_obfs.get('protocol', protocol)
protocol_param = password_obfs.get('protocol_param', '') protocol_param = password_obfs.get('protocol_param', protocol_param)
obfs = password_obfs.get('obfs', 'plain') obfs = password_obfs.get('obfs', obfs)
obfs_param = password_obfs.get('obfs_param', '') obfs_param = password_obfs.get('obfs_param', obfs_param)
else: else:
password = password_obfs password = password_obfs
a_config = config.copy() a_config = config.copy()

Loading…
Cancel
Save