force additional ports only with ss-panel (#218)
This commit is contained in:
parent
f5f4bd0339
commit
3c308ca876
3 changed files with 5 additions and 2 deletions
|
@ -15,6 +15,7 @@
|
|||
"speed_limit_per_user": 0,
|
||||
|
||||
"additional_ports" : {}, // only works under multi-user mode
|
||||
"additional_ports_only" : false, // only works under multi-user mode
|
||||
"timeout": 120,
|
||||
"udp_timeout": 60,
|
||||
"dns_ipv6": false,
|
||||
|
|
|
@ -152,8 +152,9 @@ class TransferBase(object):
|
|||
else:
|
||||
self.new_server(port, passwd, cfg)
|
||||
else:
|
||||
config = shell.get_config(False)
|
||||
if ServerPool.get_instance().server_is_run(port) > 0:
|
||||
if not allow:
|
||||
if config['additional_ports_only'] or not allow:
|
||||
logging.info('db stop server at port [%s]' % (port,))
|
||||
ServerPool.get_instance().cb_del_server(port)
|
||||
self.force_update_transfer.add(port)
|
||||
|
@ -164,7 +165,7 @@ class TransferBase(object):
|
|||
self.force_update_transfer.add(port)
|
||||
new_servers[port] = (passwd, cfg)
|
||||
|
||||
elif allow and port > 0 and port < 65536 and ServerPool.get_instance().server_run_status(port) is False:
|
||||
elif not config['additional_ports_only'] and allow and port > 0 and port < 65536 and ServerPool.get_instance().server_run_status(port) is False:
|
||||
self.new_server(port, passwd, cfg)
|
||||
|
||||
for row in last_rows:
|
||||
|
|
|
@ -245,6 +245,7 @@ def get_config(is_local):
|
|||
config['obfs_param'] = to_str(config.get('obfs_param', ''))
|
||||
config['port_password'] = config.get('port_password', None)
|
||||
config['additional_ports'] = config.get('additional_ports', {})
|
||||
config['additional_ports_only'] = config.get('additional_ports_only', False)
|
||||
config['timeout'] = int(config.get('timeout', 300))
|
||||
config['udp_timeout'] = int(config.get('udp_timeout', 120))
|
||||
config['udp_cache'] = int(config.get('udp_cache', 64))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue