Skip to content

Commit

Permalink
Merge branch 'xiaorouji:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
naoki66 authored Dec 11, 2023
2 parents b9f427b + 446cf17 commit f5b83e6
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 6 deletions.
2 changes: 1 addition & 1 deletion luci-app-passwall/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-passwall
PKG_VERSION:=4.71-2
PKG_VERSION:=4.71-3
PKG_RELEASE:=

PKG_CONFIG_DEPENDS:= \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ o = s:option(ListValue, option_name("transport"), translate("Transport"))
o:value("tcp", "TCP")
o:value("http", "HTTP")
o:value("ws", "WebSocket")
o:value("httpupgrade", "HTTPUpgrade")
if singbox_tags:find("with_quic") then
o:value("quic", "QUIC")
end
Expand Down Expand Up @@ -509,6 +510,14 @@ o:depends({ [option_name("ws_enableEarlyData")] = true })
o = s:option(Value, option_name("ws_earlyDataHeaderName"), translate("Early data header name"), translate("Recommended value: Sec-WebSocket-Protocol"))
o:depends({ [option_name("ws_enableEarlyData")] = true })

-- [[ HTTPUpgrade部分 ]]--
o = s:option(Value, option_name("httpupgrade_host"), translate("HTTPUpgrade Host"))
o:depends({ [option_name("transport")] = "httpupgrade" })

o = s:option(Value, option_name("httpupgrade_path"), translate("HTTPUpgrade Path"))
o.placeholder = "/"
o:depends({ [option_name("transport")] = "httpupgrade" })

-- [[ gRPC部分 ]]--
o = s:option(Value, option_name("grpc_serviceName"), "ServiceName")
o:depends({ [option_name("transport")] = "grpc" })
Expand All @@ -533,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" })

Expand All @@ -545,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 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ o = s:option(ListValue, option_name("transport"), translate("Transport"))
o:value("tcp", "TCP")
o:value("http", "HTTP")
o:value("ws", "WebSocket")
o:value("httpupgrade", "HTTPUpgrade")
o:value("quic", "QUIC")
o:value("grpc", "gRPC")
o:depends({ [option_name("protocol")] = "shadowsocks" })
Expand All @@ -333,10 +334,39 @@ o:depends({ [option_name("transport")] = "ws" })
o = s:option(Value, option_name("ws_path"), translate("WebSocket Path"))
o:depends({ [option_name("transport")] = "ws" })

-- [[ HTTPUpgrade部分 ]]--

o = s:option(Value, option_name("httpupgrade_host"), translate("HTTPUpgrade Host"))
o:depends({ [option_name("transport")] = "httpupgrade" })

o = s:option(Value, option_name("httpupgrade_path"), translate("HTTPUpgrade Path"))
o:depends({ [option_name("transport")] = "httpupgrade" })

-- [[ gRPC部分 ]]--
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"

Expand Down
40 changes: 39 additions & 1 deletion luci-app-passwall/luasrc/passwall/util_sing-box.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -146,6 +151,14 @@ function gen_outbound(flag, node, tag, proxy_table)
}
end

if node.transport == "httpupgrade" then
v2ray_transport = {
type = "httpupgrade",
host = node.httpupgrade_host,
path = node.httpupgrade_path or "/",
}
end

if node.transport == "quic" then
v2ray_transport = {
type = "quic"
Expand Down Expand Up @@ -402,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
Expand All @@ -421,6 +447,14 @@ function gen_config_server(node)
}
end

if node.transport == "httpupgrade" then
v2ray_transport = {
type = "httpupgrade",
host = node.httpupgrade_host,
path = node.httpupgrade_path or "/",
}
end

if node.transport == "quic" then
v2ray_transport = {
type = "quic"
Expand Down Expand Up @@ -483,6 +517,7 @@ function gen_config_server(node)
protocol_table = {
method = node.method,
password = node.password,
multiplex = mux,
}
end

Expand All @@ -499,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
Expand All @@ -517,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
Expand All @@ -536,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ microsoft.com
dyndns.com
douyucdn.cn
douyucdn2.cn
location.services.mozilla.com

#steam
steamcontent.com
Expand Down

0 comments on commit f5b83e6

Please sign in to comment.