From c6cdf6cc3984e4b2f0542b6835609b90515676de Mon Sep 17 00:00:00 2001 From: Toperlock <861705708@qq.com> Date: Fri, 12 Jan 2024 16:18:05 +0800 Subject: [PATCH] fix mux --- parsers/ss.py | 10 +++++----- parsers/trojan.py | 14 +++++++------- parsers/vless.py | 14 +++++++------- parsers/vmess.py | 10 +++++----- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/parsers/ss.py b/parsers/ss.py index c826286fe..5448fe96b 100644 --- a/parsers/ss.py +++ b/parsers/ss.py @@ -72,12 +72,12 @@ def parse(data): smux_dict = {k: v[0] for k, v in smux_dict.items() if v[0]} node['multiplex'] = { 'enabled': True, - 'protocol': smux_dict['protocol'], - 'max_streams': int(smux_dict.get('max-streams', '0')) + 'protocol': smux_dict['protocol'] } - if smux_dict.get('max-connections'): + if smux_dict.get('max-streams'): + node['multiplex']['max_streams'] = int(smux_dict['max-streams']) + else: node['multiplex']['max_connections'] = int(smux_dict['max-connections']) - if smux_dict.get('min-streams'): node['multiplex']['min_streams'] = int(smux_dict['min-streams']) if smux_dict.get('padding') == 'True': node['multiplex']['padding'] = True @@ -149,4 +149,4 @@ def parse(data): if flag: return node,node_tls else: - return node + return node \ No newline at end of file diff --git a/parsers/trojan.py b/parsers/trojan.py index d2ad85949..e5a882ff6 100644 --- a/parsers/trojan.py +++ b/parsers/trojan.py @@ -59,13 +59,13 @@ def parse(data): if netquery.get('protocol'): node['multiplex'] = { 'enabled': True, - 'protocol': netquery['protocol'], - 'max_streams': int(netquery.get('max_streams', '0')) + 'protocol': netquery['protocol'] } - if netquery.get('max_connections'): - node['multiplex']['max_connections'] = int(netquery['max_connections']) - if netquery.get('min_streams'): - node['multiplex']['min_streams'] = int(netquery['min_streams']) + if netquery.get('max-streams'): + node['multiplex']['max_streams'] = int(netquery['max-streams']) + else: + node['multiplex']['max_connections'] = int(netquery['max-connections']) + node['multiplex']['min_streams'] = int(netquery['min-streams']) if netquery.get('padding') == 'True': node['multiplex']['padding'] = True - return node + return node \ No newline at end of file diff --git a/parsers/vless.py b/parsers/vless.py index 5fbb1862c..33e7ba98a 100644 --- a/parsers/vless.py +++ b/parsers/vless.py @@ -77,13 +77,13 @@ def parse(data): if netquery.get('protocol'): node['multiplex'] = { 'enabled': True, - 'protocol': netquery['protocol'], - 'max_streams': int(netquery.get('max_streams', '0')) + 'protocol': netquery['protocol'] } - if netquery.get('max_connections'): - node['multiplex']['max_connections'] = int(netquery['max_connections']) - if netquery.get('min_streams'): - node['multiplex']['min_streams'] = int(netquery['min_streams']) + if netquery.get('max-streams'): + node['multiplex']['max_streams'] = int(netquery['max-streams']) + else: + node['multiplex']['max_connections'] = int(netquery['max-connections']) + node['multiplex']['min_streams'] = int(netquery['min-streams']) if netquery.get('padding') == 'True': node['multiplex']['padding'] = True - return node + return node \ No newline at end of file diff --git a/parsers/vmess.py b/parsers/vmess.py index 1ee5c76ab..8181d2c69 100644 --- a/parsers/vmess.py +++ b/parsers/vmess.py @@ -130,13 +130,13 @@ def parse(data): if item.get('protocol'): node['multiplex'] = { 'enabled': True, - 'protocol': item['protocol'], - 'max_streams': int(item.get('max_streams', '0')) + 'protocol': item['protocol'] } - if item.get('max_connections'): + if item.get('max_streams'): + node['multiplex']['max_streams'] = int(item['max_streams']) + else: node['multiplex']['max_connections'] = int(item['max_connections']) - if item.get('min_streams'): node['multiplex']['min_streams'] = int(item['min_streams']) if item.get('padding') == True: node['multiplex']['padding'] = True - return node + return node \ No newline at end of file