diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua index 5546ee7f44..a9aaf2cedf 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua @@ -542,8 +542,6 @@ o = s:option(Flag, option_name("mux"), translate("Mux")) o.rmempty = false o:depends({ [option_name("protocol")] = "vmess" }) o:depends({ [option_name("protocol")] = "vless", [option_name("flow")] = "" }) -o:depends({ [option_name("protocol")] = "http" }) -o:depends({ [option_name("protocol")] = "socks" }) o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("uot")] = "" }) o:depends({ [option_name("protocol")] = "trojan" }) @@ -554,13 +552,26 @@ o:value("h2mux") o:depends({ [option_name("mux")] = true }) o = s:option(Value, option_name("mux_concurrency"), translate("Mux concurrency")) -o.default = 8 -o:depends({ [option_name("mux")] = true }) +o.default = 4 +o:depends({ [option_name("mux")] = true, [option_name("tcpbrutal")] = false }) o = s:option(Flag, option_name("mux_padding"), translate("Padding")) o.default = 0 o:depends({ [option_name("mux")] = true }) +-- [[ TCP Brutal ]]-- +o = s:option(Flag, option_name("tcpbrutal"), translate("TCP Brutal")) +o.default = 0 +o:depends({ [option_name("mux")] = true }) + +o = s:option(Value, option_name("tcpbrutal_up_mbps"), translate("Max upload Mbps")) +o.default = "10" +o:depends({ [option_name("tcpbrutal")] = true }) + +o = s:option(Value, option_name("tcpbrutal_down_mbps"), translate("Max download Mbps")) +o.default = "50" +o:depends({ [option_name("tcpbrutal")] = true }) + o = s:option(Flag, option_name("shadowtls"), "ShadowTLS") o.default = 0 o:depends({ [option_name("protocol")] = "vmess", [option_name("tls")] = false }) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua index 9b659b5994..50a084286a 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua @@ -346,6 +346,27 @@ o:depends({ [option_name("transport")] = "httpupgrade" }) o = s:option(Value, option_name("grpc_serviceName"), "ServiceName") o:depends({ [option_name("transport")] = "grpc" }) +-- [[ Mux ]]-- +o = s:option(Flag, option_name("mux"), translate("Mux")) +o.rmempty = false +o:depends({ [option_name("protocol")] = "vmess" }) +o:depends({ [option_name("protocol")] = "vless", [option_name("flow")] = "" }) +o:depends({ [option_name("protocol")] = "shadowsocks" }) +o:depends({ [option_name("protocol")] = "trojan" }) + +-- [[ TCP Brutal ]]-- +o = s:option(Flag, option_name("tcpbrutal"), translate("TCP Brutal")) +o.default = 0 +o:depends({ [option_name("mux")] = true }) + +o = s:option(Value, option_name("tcpbrutal_up_mbps"), translate("Max upload Mbps")) +o.default = "10" +o:depends({ [option_name("tcpbrutal")] = true }) + +o = s:option(Value, option_name("tcpbrutal_down_mbps"), translate("Max download Mbps")) +o.default = "50" +o:depends({ [option_name("tcpbrutal")] = true }) + o = s:option(Flag, option_name("bind_local"), translate("Bind Local"), translate("When selected, it can only be accessed locally, It is recommended to turn on when using reverse proxies or be fallback.")) o.default = "0" diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index 5c05ddb403..e49ec99465 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -116,10 +116,15 @@ function gen_outbound(flag, node, tag, proxy_table) mux = { enabled = true, protocol = node.mux_type or "h2mux", - max_connections = tonumber(node.mux_concurrency) or 4, + max_connections = ( (node.tcpbrutal == "1") and 1 ) or tonumber(node.mux_concurrency) or 4, padding = (node.mux_padding == "1") and true or false, --min_streams = 4, --max_streams = 0, + brutal = { + enabled = (node.tcpbrutal == "1") and true or false, + up_mbps = tonumber(node.tcpbrutal_up_mbps) or 10, + down_mbps = tonumber(node.tcpbrutal_down_mbps) or 50, + }, } end @@ -410,6 +415,19 @@ function gen_config_server(node) } end + local mux = nil + if node.mux == "1" then + mux = { + enabled = true, + padding = (node.mux_padding == "1") and true or false, + brutal = { + enabled = (node.tcpbrutal == "1") and true or false, + up_mbps = tonumber(node.tcpbrutal_up_mbps) or 10, + down_mbps = tonumber(node.tcpbrutal_down_mbps) or 50, + }, + } + end + local v2ray_transport = nil if node.transport == "http" then @@ -499,6 +517,7 @@ function gen_config_server(node) protocol_table = { method = node.method, password = node.password, + multiplex = mux, } end @@ -515,6 +534,7 @@ function gen_config_server(node) protocol_table = { users = users, tls = (node.tls == "1") and tls or nil, + multiplex = mux, transport = v2ray_transport, } end @@ -533,6 +553,7 @@ function gen_config_server(node) protocol_table = { users = users, tls = (node.tls == "1") and tls or nil, + multiplex = mux, transport = v2ray_transport, } end @@ -552,6 +573,7 @@ function gen_config_server(node) tls = (node.tls == "1") and tls or nil, fallback = nil, fallback_for_alpn = nil, + multiplex = mux, transport = v2ray_transport, } end