mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-29 19:05:13 +08:00
update 2026-05-31 15:41:19
This commit is contained in:
1 parent
a8a3ebd3f2
commit
a132233834
4 files changed
+692
-559
No files matched your search
@@ -427,13 +427,24 @@ o.rmempty = false
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "ss-rust")
|
||||
o:depends("type", "v2ray")
|
||||
o:depends("type", "trojan")
|
||||
o:depends("type", "naiveproxy")
|
||||
o:depends("type", "hysteria2")
|
||||
o:depends("type", "tuic")
|
||||
o:depends("type", "shadowtls")
|
||||
o:depends("type", "socks5")
|
||||
local protocols = s.fields["v2ray_protocol"].keylist
|
||||
if protocols and type(protocols) == "table" and #protocols > 0 then
|
||||
for _, proto in ipairs(protocols) do
|
||||
if not proto:find("^_") then
|
||||
if proto == "hysteria2" then
|
||||
o:depends({type = "v2ray", v2ray_protocol = "hysteria2", hysteria2_realms = false})
|
||||
else
|
||||
o:depends({type = "v2ray", v2ray_protocol = proto})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(Value, "server_port", translate("Server Port"))
|
||||
o.datatype = "port"
|
||||
@@ -441,13 +452,24 @@ o.rmempty = true
|
||||
o:depends("type", "ssr")
|
||||
o:depends("type", "ss")
|
||||
o:depends("type", "ss-rust")
|
||||
o:depends("type", "v2ray")
|
||||
o:depends("type", "trojan")
|
||||
o:depends("type", "naiveproxy")
|
||||
o:depends("type", "hysteria2")
|
||||
o:depends("type", "tuic")
|
||||
o:depends("type", "shadowtls")
|
||||
o:depends("type", "socks5")
|
||||
local protocols = s.fields["v2ray_protocol"].keylist
|
||||
if protocols and type(protocols) == "table" and #protocols > 0 then
|
||||
for _, proto in ipairs(protocols) do
|
||||
if not proto:find("^_") then
|
||||
if proto == "hysteria2" then
|
||||
o:depends({type = "v2ray", v2ray_protocol = "hysteria2", hysteria2_realms = false})
|
||||
else
|
||||
o:depends({type = "v2ray", v2ray_protocol = proto})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(Flag, "auth_enable", translate("Enable Authentication"))
|
||||
o.rmempty = false
|
||||
@@ -573,6 +595,21 @@ o:depends("type", "ssr")
|
||||
|
||||
|
||||
-- [[ Hysteria2 ]]--
|
||||
o = s:option(Flag, "hysteria2_realms", translate("Hysteria2 Realms"))
|
||||
o.default = "0"
|
||||
if xray_version_val > 260509 then
|
||||
o:depends({type = "v2ray", v2ray_protocol = "hysteria2"})
|
||||
else
|
||||
o:depends({type = "v2ray", v2ray_protocol = "__hide"})
|
||||
end
|
||||
|
||||
o = s:option(Value, "hysteria2_realm_url", translate("Realm URL"), translate("Example:") .. "realm://public@realm.hy2.io/your-realm-name")
|
||||
o:depends("hysteria2_realms", true)
|
||||
|
||||
o = s:option(DynamicList, "hysteria2_realm_stun", translate("Realm STUN"))
|
||||
o.default = { "stun.sip.us:3478", "stun.nextcloud.com:3478", "global.stun.twilio.com:3478" }
|
||||
o:depends("hysteria2_realms", true)
|
||||
|
||||
o = s:option(Value, "hy2_auth", translate("Users Authentication"))
|
||||
o:depends("type", "hysteria2")
|
||||
o:depends({type = "v2ray", v2ray_protocol = "hysteria2"})
|
||||
@@ -581,7 +618,7 @@ o.rmempty = false
|
||||
|
||||
o = s:option(Flag, "flag_port_hopping", translate("Enable Port Hopping"))
|
||||
o:depends("type", "hysteria2")
|
||||
o:depends({type = "v2ray", v2ray_protocol = "hysteria2"})
|
||||
o:depends({type = "v2ray", v2ray_protocol = "hysteria2", hysteria2_realms = false})
|
||||
o.rmempty = true
|
||||
o.default = "0"
|
||||
|
||||
@@ -1240,12 +1277,18 @@ o:depends("transport", "grpc")
|
||||
o = s:option(Flag, "enable_finalmask", translate("FinalMask"))
|
||||
o.rmempty = true
|
||||
o.default = "0"
|
||||
o:depends({type = "v2ray", v2ray_protocol = "vless"})
|
||||
o:depends({type = "v2ray", v2ray_protocol = "vmess"})
|
||||
o:depends({type = "v2ray", v2ray_protocol = "trojan"})
|
||||
o:depends({type = "v2ray", v2ray_protocol = "shadowsocks"})
|
||||
o:depends({type = "v2ray", v2ray_protocol = "wireguard"})
|
||||
o:depends({type = "v2ray", v2ray_protocol = "hysteria2"})
|
||||
local protocols = s.fields["v2ray_protocol"].keylist
|
||||
if protocols and type(protocols) == "table" and #protocols > 0 then
|
||||
for _, proto in ipairs(protocols) do
|
||||
if not proto:find("^_") then
|
||||
if proto == "hysteria2" then
|
||||
o:depends({type = "v2ray", v2ray_protocol = "hysteria2", hysteria2_realms = false})
|
||||
elseif proto ~= "socks" and proto ~= "http" then
|
||||
o:depends({type = "v2ray", v2ray_protocol = proto})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(TextValue, "finalmask", " ")
|
||||
o.description = translate("An FinalMaskObject in JSON format, used for sharing.") .. "<br>" ..
|
||||
@@ -1342,7 +1385,18 @@ if is_finded("xray") then
|
||||
o = s:option(Flag, "enable_ech", translate("Enable ECH(optional)"))
|
||||
o.rmempty = true
|
||||
o.default = "0"
|
||||
o:depends({type = "v2ray", tls = true})
|
||||
local protocols = s.fields["v2ray_protocol"].keylist
|
||||
if protocols and type(protocols) == "table" and #protocols > 0 then
|
||||
for _, proto in ipairs(protocols) do
|
||||
if not proto:find("^_") then
|
||||
if proto == "hysteria2" then
|
||||
o:depends({type = "v2ray", v2ray_protocol = "hysteria2", tls = true, hysteria2_realms = false})
|
||||
else
|
||||
o:depends({type = "v2ray", v2ray_protocol = proto, tls = true})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(TextValue, "ech_config", translate("ECH Config"))
|
||||
o.description = translate(
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -53,6 +53,32 @@ if server.type == "ss-rust" then
|
||||
server.type = "ss"
|
||||
end
|
||||
|
||||
local function parse_realm_uri(uri)
|
||||
if type(uri) ~= "string" then return nil end
|
||||
-- realm://token@server/realm_id?query
|
||||
local token, server_url, realm_id, query = trim(uri):match("^realm://([^@]+)@([^/]+)/([^?]*)%??(.*)$")
|
||||
if not token or not server_url or not realm_id then return nil end
|
||||
realm_id = realm_id:gsub("/+$", "")
|
||||
local realm = {
|
||||
token = token,
|
||||
server_url = server_url,
|
||||
realm_id = realm_id
|
||||
}
|
||||
-- 解析 query 中的 stun=
|
||||
if query and query ~= "" then
|
||||
local stun_servers = {}
|
||||
for key, value in query:gmatch("([^&=?]+)=([^&]+)") do
|
||||
if key == "stun" and value ~= "" then
|
||||
stun_servers[#stun_servers + 1] = value
|
||||
end
|
||||
end
|
||||
if #stun_servers > 0 then
|
||||
realm.stun_servers = stun_servers
|
||||
end
|
||||
end
|
||||
return realm
|
||||
end
|
||||
|
||||
-- base64 解码
|
||||
local function base64Decode(text)
|
||||
local raw = text
|
||||
@@ -569,7 +595,7 @@ Xray.outbounds = {
|
||||
local finalmask = {}
|
||||
local PT = server.v2ray_protocol
|
||||
local TP = server.transport
|
||||
if server.transport == "kcp" then
|
||||
if TP == "kcp" then
|
||||
local map = {none = "none", srtp = "header-srtp", utp = "header-utp", ["wechat-video"] = "header-wechat",
|
||||
dtls = "header-dtls", wireguard = "header-wireguard", dns = "header-dns"}
|
||||
local udp = {}
|
||||
@@ -587,14 +613,35 @@ Xray.outbounds = {
|
||||
udp[#udp+1] = c
|
||||
finalmask.udp = udp
|
||||
elseif PT == "hysteria2" then
|
||||
local udp = {}
|
||||
if (server.flag_obfs == "1" and (server.obfs_type and server.obfs_type ~= "")) then
|
||||
finalmask.udp = {{
|
||||
local o = {
|
||||
type = server.obfs_type,
|
||||
settings = server.salamander and {
|
||||
password = server.salamander
|
||||
} or nil
|
||||
}}
|
||||
}
|
||||
udp[#udp+1] = o
|
||||
end
|
||||
if server.hysteria2_realms then
|
||||
local realm = parse_realm_uri(server.hysteria2_realm_url)
|
||||
local url, stun
|
||||
if realm then
|
||||
if realm.token and realm.server_url and realm.realm_id then
|
||||
url = "realm://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id
|
||||
end
|
||||
stun = realm.stun_servers or server.hysteria2_realm_stun
|
||||
end
|
||||
local r = {
|
||||
type = "realm",
|
||||
settings = {
|
||||
url = url,
|
||||
stunServers = stun
|
||||
}
|
||||
}
|
||||
udp[#udp+1] = r
|
||||
end
|
||||
finalmask.udp = udp
|
||||
local up = tonumber(server.uplink_capacity) or 0
|
||||
local down = tonumber(server.downlink_capacity) or 0
|
||||
finalmask.quicParams = {
|
||||
|
||||
Reference in new issue
Block a user