Skip to content

Commit

Permalink
fix: mux settings
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintShit committed May 28, 2024
1 parent 09a837b commit 16ed7ec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
12 changes: 6 additions & 6 deletions app/subscription/clash.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def make_node(self,
udp: bool = True,
alpn: str = '',
ais: bool = '',
mux_enable : bool = False):
mux_enable: bool = False):

if type == 'shadowsocks':
type = 'ss'
Expand Down Expand Up @@ -128,9 +128,9 @@ def make_node(self,
mux_json = json.loads(self.mux_template)
mux_config = mux_json["clash"]

net_opts['smux'] = mux_config
if net_opts['smux']["enabled"]:
net_opts['smux']["enabled"] = mux_enable
if mux_enable:
net_opts['smux'] = mux_config
net_opts['smux']["enabled"] = True

return node

Expand Down Expand Up @@ -189,7 +189,7 @@ def make_node(self,
pbk: str = '',
sid: str = '',
ais: bool = '',
mux_enable : bool = False):
mux_enable: bool = False):
node = super().make_node(
name=name,
type=type,
Expand Down Expand Up @@ -263,4 +263,4 @@ def add(self, remark: str, address: str, inbound: dict, settings: dict):
node['password'] = settings['password']
node['cipher'] = settings['method']
self.data['proxies'].append(node)
self.proxy_remarks.append(remark)
self.proxy_remarks.append(remark)
16 changes: 6 additions & 10 deletions app/subscription/singbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def make_outbound(self,
"server_port": port,
}

if net in ('tcp', 'kcp') and headers != 'http' and tls != 'none':
if net in ('tcp', 'kcp') and headers != 'http' and (tls or tls != 'none'):
if flow:
config["flow"] = flow

Expand All @@ -159,7 +159,6 @@ def make_outbound(self,
elif net in ['tcp'] and headers == 'http':
net = 'http'


if net in ['http', 'ws', 'quic', 'grpc', 'httpupgrade']:
max_early_data = None
early_data_header_name = None
Expand All @@ -184,14 +183,11 @@ def make_outbound(self,
config['tls'] = self.tls_config(sni=sni, fp=fp, tls=tls,
pbk=pbk, sid=sid, alpn=alpn,
ais=ais)

# Singbox mux is not compatible with xray mux
# Since marzban doesnt support singbox core at server side at the moment - sinbox-mux should not be enabled at all
# if mux_enable:
# mux_json = json.loads(self.mux_template)
# mux_config = mux_json["sing-box"]
# config['multiplex'] = mux_config
# config['multiplex']["enabled"] = mux_enable
if mux_enable:
mux_json = json.loads(self.mux_template)
mux_config = mux_json["sing-box"]
config['multiplex'] = mux_config
config['multiplex']["enabled"] = mux_enable

This comment has been minimized.

Copy link
@plasticgholam

plasticgholam Jun 7, 2024

این خط باید پاک بشه تا ماکس در سینگ باکس غیرفعال بشه


return config

Expand Down
6 changes: 3 additions & 3 deletions app/subscription/v2ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,8 @@ def add(self, remark: str, address: str, inbound: dict, settings: dict):
mux_json = json.loads(self.mux_template)
mux_config = mux_json["v2ray"]

outbound["mux"] = mux_config
if outbound["mux"]["enabled"]:
outbound["mux"]["enabled"] = bool(inbound.get('mux_enable', False))
if inbound.get('mux_enable', False):
outbound["mux"] = mux_config
outbound["mux"]["enabled"] = True

self.add_config(remarks=remark, outbounds=outbounds)

0 comments on commit 16ed7ec

Please sign in to comment.