mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-04 05:53:56 +08:00
🏅 Sync 2026-10-06 17:10:26
This commit is contained in:
1 parent
c3b5349800
commit
4d2ba50e17
35 files changed
+1231
-76
No files matched your search
@@ -1186,6 +1186,12 @@ normalize_xray_protocol_nodes() {
|
||||
changed=1
|
||||
fi
|
||||
fi
|
||||
if [ "$type" = "anytls" ]; then
|
||||
uci -q set "$NAME.$section.type=v2ray"
|
||||
uci -q set "$NAME.$section.v2ray_protocol=anytls"
|
||||
[ -n "$(uci_get_by_name "$section" tls)" ] || uci -q set "$NAME.$section.tls=1"
|
||||
changed=1
|
||||
fi
|
||||
if [ "$type" = "hysteria2" ]; then
|
||||
echolog "提示:检测到原生 Hysteria2 节点,自动迁移为 Xray(Hysteria2)。"
|
||||
uci -q set "$NAME.$section.type=v2ray"
|
||||
|
||||
@@ -849,6 +849,13 @@ local function build_v2ray_mihomo_proxy(sid)
|
||||
proxy.cipher = get_server_field(sid, "encrypt_method_ss", "none")
|
||||
proxy.password = get_server_field(sid, "password", "")
|
||||
build_shadowsocks_plugin(proxy, sid)
|
||||
elseif protocol == "anytls" then
|
||||
proxy.type = "anytls"
|
||||
proxy.password = get_server_field(sid, "password", "")
|
||||
apply_trojan_tls_options(proxy, sid)
|
||||
proxy["idle-session-check-interval"] = number_or_nil(get_server_field(sid, "anytls_idle_session_check_interval", ""))
|
||||
proxy["idle-session-timeout"] = number_or_nil(get_server_field(sid, "anytls_idle_session_timeout", ""))
|
||||
proxy["min-idle-session"] = number_or_nil(get_server_field(sid, "anytls_min_idle_session", ""))
|
||||
elseif protocol == "hysteria2" then
|
||||
proxy.type = "hysteria2"
|
||||
proxy.password = get_server_field(sid, "hy2_auth", "")
|
||||
|
||||
@@ -47,6 +47,14 @@ end
|
||||
local chain_local_port = split(chain, "/")[2] or "0"
|
||||
|
||||
local server = ucursor:get_all("shadowsocksr", server_section)
|
||||
-- AnyTLS subscriptions previously used a standalone type with no launcher.
|
||||
if server.type == "anytls" then
|
||||
server.type = "v2ray"
|
||||
server.v2ray_protocol = "anytls"
|
||||
end
|
||||
if server.v2ray_protocol == "anytls" and server.tls == nil then
|
||||
server.tls = "1"
|
||||
end
|
||||
local socks_server = ucursor:get_all("shadowsocksr", "@socks5_proxy[0]") or {}
|
||||
local xray_fragment = ucursor:get_all("shadowsocksr", "@global_xray_fragment[0]") or {}
|
||||
local xray_noise = ucursor:get_all("shadowsocksr", "@xray_noise_packets[0]") or {}
|
||||
@@ -363,6 +371,16 @@ function outbound:handleIndex(index)
|
||||
wireguard = function()
|
||||
wireguard()
|
||||
end,
|
||||
anytls = function()
|
||||
outbound_settings = {
|
||||
address = server.server,
|
||||
port = tonumber(server.server_port),
|
||||
password = server.password,
|
||||
idleSessionCheckInterval = tonumber(server.anytls_idle_session_check_interval),
|
||||
idleSessionTimeout = tonumber(server.anytls_idle_session_timeout),
|
||||
minIdleSession = tonumber(server.anytls_min_idle_session)
|
||||
}
|
||||
end,
|
||||
hysteria2 = function()
|
||||
xray_hysteria2()
|
||||
end
|
||||
@@ -510,10 +528,7 @@ Xray.outbounds = {
|
||||
fingerprint = server.fingerprint,
|
||||
allowInsecure = (function()
|
||||
if server.tls_CertSha and server.tls_CertSha ~= "" then return nil end
|
||||
if os.date("%Y.%m.%d") < "2026.06.01" then
|
||||
return server.insecure == "1"
|
||||
end
|
||||
return nil
|
||||
return server.insecure == "1"
|
||||
end)(),
|
||||
serverName = server.tls_host,
|
||||
certificates = server.certificate and {
|
||||
@@ -849,7 +864,7 @@ Xray.outbounds = {
|
||||
((remarks and remarks ~= "") and (node_id .. "." .. remarks) or ("direct" .. "." .. node_id)) or nil
|
||||
}
|
||||
} or nil,
|
||||
mux = (server.v2ray_protocol ~= "hysteria2" and server.v2ray_protocol ~= "wireguard") and {
|
||||
mux = (server.v2ray_protocol ~= "hysteria2" and server.v2ray_protocol ~= "wireguard" and server.v2ray_protocol ~= "anytls") and {
|
||||
-- mux
|
||||
enabled = (server.mux == "1"), -- Mux
|
||||
concurrency = (server.mux == "1" and (tonumber(server.concurrency) or -1)) or nil, -- TCP 最大并发连接数
|
||||
|
||||
@@ -472,8 +472,11 @@ local function parseAnytlsShare(content)
|
||||
end
|
||||
return sni
|
||||
end)(),
|
||||
allow_insecure = (params.insecure == "1" or params.allow_insecure == "1" or params.allowinsecure == "1"),
|
||||
client_fingerprint = params.fp or params.fingerprint or ""
|
||||
allow_insecure = (params.insecure == "1" or params.insecure == "true" or params.allow_insecure == "1" or params.allow_insecure == "true" or params.allowinsecure == "1" or params.allowinsecure == "true"),
|
||||
client_fingerprint = params.fp or params.fingerprint or "",
|
||||
alpn = params.alpn,
|
||||
pinned_cert = params.pcs,
|
||||
cert_name = params.vcn
|
||||
}
|
||||
end
|
||||
|
||||
@@ -514,13 +517,16 @@ local function buildAnytlsClashYaml(entries, group_name)
|
||||
return table.concat(lines, "\n") .. "\n"
|
||||
end
|
||||
|
||||
local function anytls_to_mihomo_node(entry)
|
||||
local function anytls_to_node(entry)
|
||||
if not entry then
|
||||
return nil
|
||||
end
|
||||
|
||||
local result = {
|
||||
type = "anytls",
|
||||
type = "v2ray",
|
||||
v2ray_protocol = "anytls",
|
||||
tls = "1",
|
||||
transport = "raw",
|
||||
alias = entry.name,
|
||||
raw_alias = entry.name,
|
||||
server = entry.server,
|
||||
@@ -528,7 +534,10 @@ local function anytls_to_mihomo_node(entry)
|
||||
password = entry.password,
|
||||
tls_host = entry.sni,
|
||||
insecure = entry.allow_insecure and "1" or "0",
|
||||
fingerprint = entry.client_fingerprint
|
||||
fingerprint = entry.client_fingerprint,
|
||||
tls_alpn = entry.alpn,
|
||||
tls_CertSha = entry.pinned_cert,
|
||||
tls_CertByName = entry.cert_name
|
||||
}
|
||||
|
||||
local saved_alias = result.alias
|
||||
@@ -806,7 +815,7 @@ local function to_mihomo_proxy(node)
|
||||
proxy.obfs = string_from_value(node.obfs_type)
|
||||
proxy["obfs-password"] = string_from_value(node.salamander)
|
||||
end
|
||||
elseif node.type == "anytls" then
|
||||
elseif node.type == "anytls" or (node.type == "v2ray" and node.v2ray_protocol == "anytls") then
|
||||
proxy.type = "anytls"
|
||||
proxy.password = node.password
|
||||
proxy.sni = string_from_value(node.tls_host)
|
||||
@@ -854,6 +863,7 @@ local function can_group_into_mihomo(node)
|
||||
or node.v2ray_protocol == "hysteria2"
|
||||
or node.v2ray_protocol == "hy2"
|
||||
or node.v2ray_protocol == "snell"
|
||||
or node.v2ray_protocol == "anytls"
|
||||
) then
|
||||
return true
|
||||
end
|
||||
@@ -2712,7 +2722,7 @@ local execute = function()
|
||||
if line:match("^anytls://") then
|
||||
local parsed = parseAnytlsShare(line:gsub("^anytls://", ""))
|
||||
if parsed then
|
||||
table.insert(anytls_nodes, anytls_to_mihomo_node(parsed))
|
||||
table.insert(anytls_nodes, anytls_to_node(parsed))
|
||||
end
|
||||
elseif line ~= "" then
|
||||
table.insert(normal_nodes, node)
|
||||
|
||||
Reference in new issue
Block a user