Browse Source

using '#' to split multi-user setting

dev
破娃酱 8 years ago
parent
commit
b367ad0560
  1. 2
      shadowsocks/obfsplugin/auth.py
  2. 18
      shadowsocks/tcprelay.py
  3. 18
      shadowsocks/udprelay.py

2
shadowsocks/obfsplugin/auth.py

@ -1131,7 +1131,7 @@ class auth_aes128_sha1(auth_base):
def set_server_info(self, server_info):
self.server_info = server_info
try:
max_client = int(server_info.protocol_param)
max_client = int(server_info.protocol_param.split('#')[0])
except:
max_client = 64
self.server_info.data.set_max_client(max_client)

18
shadowsocks/tcprelay.py

@ -1020,14 +1020,16 @@ class TCPRelay(object):
self._listen_port = listen_port
if config['protocol'] in ["auth_aes128_md5", "auth_aes128_sha1"]:
user_list = config['protocol_param'].split(',')
if user_list:
for user in user_list:
items = user.split(':')
if len(items) == 2:
uid = struct.pack('<I', int(items[0]))
passwd = items[1]
self.add_user(uid, passwd)
param = config['protocol_param'].split('#')
if len(param) == 2:
user_list = param[1].split(',')
if user_list:
for user in user_list:
items = user.split(':')
if len(items) == 2:
uid = struct.pack('<I', int(items[0]))
passwd = items[1]
self.add_user(uid, passwd)
addrs = socket.getaddrinfo(listen_addr, listen_port, 0,
socket.SOCK_STREAM, socket.SOL_TCP)

18
shadowsocks/udprelay.py

@ -902,14 +902,16 @@ class UDPRelay(object):
self.server_user_transfer_dl = {}
if config['protocol'] in ["auth_aes128_md5", "auth_aes128_sha1"]:
user_list = config['protocol_param'].split(',')
if user_list:
for user in user_list:
items = user.split(':')
if len(items) == 2:
uid = struct.pack('<I', int(items[0]))
passwd = items[1]
self.add_user(uid, passwd)
param = config['protocol_param'].split('#')
if len(param) == 2:
user_list = param[1].split(',')
if user_list:
for user in user_list:
items = user.split(':')
if len(items) == 2:
uid = struct.pack('<I', int(items[0]))
passwd = items[1]
self.add_user(uid, passwd)
self.protocol_data = obfs.obfs(config['protocol']).init_data()
self._protocol = obfs.obfs(config['protocol'])

Loading…
Cancel
Save