mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-11 01:37:51 +08:00
This commit is contained in:
1 parent
208c8bf5a2
commit
7eb1d53ed5
12 files changed
+817
-1009
No files matched your search
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=26.11.3
|
||||
PKG_RELEASE:=368
|
||||
PKG_RELEASE:=369
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -98,7 +98,8 @@ local current_node = map:get(section)
|
||||
|
||||
function parseNodeUrl(url) {
|
||||
let protocol = url.substring(0, url.indexOf("://")) + ":"
|
||||
let str = "http" + url.substring(url.indexOf("://"))
|
||||
// 使用 HTTPS 的默认端口 443,避免显式 :80 被 URL 归一化为空。
|
||||
let str = "https" + url.substring(url.indexOf("://"))
|
||||
const parsedUrl = new URL(str);
|
||||
var r = {
|
||||
hash: parsedUrl.hash, // #asd
|
||||
@@ -1336,7 +1337,7 @@ local current_node = map:get(section)
|
||||
let url0 = sstr.substr(0, ploc);
|
||||
let paramStr = sstr.substr(ploc + 2);
|
||||
|
||||
const m = new URL("http://" + b64decsafe(url0));
|
||||
const m = new URL("https://" + b64decsafe(url0));
|
||||
if (m.username !== "") {
|
||||
ssm.security = m.username;
|
||||
ssm.id = m.password || m.username;
|
||||
@@ -1655,7 +1656,7 @@ local current_node = map:get(section)
|
||||
opt.set('type', "sing-box");
|
||||
}
|
||||
opt.set(dom_prefix + 'protocol', "tuic");
|
||||
var _parsedUrl = new URL("http://" + link_split[1]);
|
||||
var _parsedUrl = new URL("https://" + link_split[1]);
|
||||
var username = _parsedUrl.username;
|
||||
var password = _parsedUrl.password;
|
||||
var hostname = _parsedUrl.hostname;
|
||||
@@ -1755,7 +1756,7 @@ local current_node = map:get(section)
|
||||
opt.set('type', "sing-box");
|
||||
}
|
||||
opt.set(dom_prefix + 'protocol', "naive");
|
||||
var _parsedUrl = new URL("http://" + link_split[1]);
|
||||
var _parsedUrl = new URL("https://" + link_split[1]);
|
||||
var username = _parsedUrl.username;
|
||||
var password = _parsedUrl.password;
|
||||
var hostname = _parsedUrl.hostname;
|
||||
|
||||
@@ -547,6 +547,19 @@ local function set_ss_implementation(ss_type, result)
|
||||
return result
|
||||
end
|
||||
|
||||
-- 拆分 URI 地址和端口,支持省略端口的 IPv6 地址,并去除路径。
|
||||
local function parse_host_port(host_port, default_port)
|
||||
local authority = (host_port or ""):gsub("/.*$", "")
|
||||
local address, port = authority:match("^%[([^%]]+)%]:(.*)$")
|
||||
if not address then
|
||||
address = authority:match("^%[([^%]]+)%]$")
|
||||
end
|
||||
if not address then
|
||||
address, port = authority:match("^([^:]+):(.*)$")
|
||||
end
|
||||
return address or authority, (port and port ~= "") and port or default_port
|
||||
end
|
||||
|
||||
-- 处理数据
|
||||
local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
--log(2, content, add_mode, group)
|
||||
@@ -642,17 +655,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
info.security = (#id_info > 1 and id_info[1] ~= "") and id_info[1] or "auto"
|
||||
info.id = id_info[#id_info]
|
||||
|
||||
local addr, port = sp[2], "443"
|
||||
if api.is_ipv6addrport(addr) then
|
||||
local a, p = addr:match("^%[(.+)%]:(%d+)$")
|
||||
if a then addr, port = a, p end
|
||||
addr = api.get_ipv6_only(addr)
|
||||
else
|
||||
local host_port = split(addr, ":")
|
||||
addr = host_port[1]
|
||||
if #host_port > 1 then port = host_port[#host_port] end
|
||||
end
|
||||
info.add, info.port = addr, port
|
||||
info.add, info.port = parse_host_port(sp[2], "443")
|
||||
|
||||
local params = {}
|
||||
for _, v in pairs(split(Info[2], '&')) do
|
||||
@@ -844,19 +847,8 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
local hostInfo = split(base64Decode(UrlDecode(info)), "@")
|
||||
if hostInfo and #hostInfo > 0 then
|
||||
local host_port = hostInfo[#hostInfo]
|
||||
-- [2001:4860:4860::8888]:443
|
||||
-- 8.8.8.8:443
|
||||
if host_port:find(":") then
|
||||
local sp = split(host_port, ":")
|
||||
result.port = sp[#sp]
|
||||
if api.is_ipv6addrport(host_port) then
|
||||
result.address = api.get_ipv6_only(host_port)
|
||||
else
|
||||
result.address = sp[1]
|
||||
end
|
||||
else
|
||||
result.address = host_port
|
||||
end
|
||||
-- SIP002 要求显式端口,不设置缺省值。
|
||||
result.address, result.port = parse_host_port(host_port)
|
||||
|
||||
local userinfo = nil
|
||||
if #hostInfo > 2 then
|
||||
@@ -1120,19 +1112,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
params[v:sub(1, s - 1)] = UrlDecode(v:sub(s + 1))
|
||||
end
|
||||
end
|
||||
-- [2001:4860:4860::8888]:443
|
||||
-- 8.8.8.8:443
|
||||
if host_port:find(":") then
|
||||
local sp = split(host_port, ":")
|
||||
port = sp[#sp]
|
||||
if api.is_ipv6addrport(host_port) then
|
||||
result.address = api.get_ipv6_only(host_port)
|
||||
else
|
||||
result.address = sp[1]
|
||||
end
|
||||
else
|
||||
result.address = host_port
|
||||
end
|
||||
result.address, port = parse_host_port(host_port, port)
|
||||
result.port = port
|
||||
|
||||
params.security = params.security or "tls"
|
||||
@@ -1269,19 +1249,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
params[v:sub(1, s - 1)] = UrlDecode(v:sub(s + 1))
|
||||
end
|
||||
end
|
||||
-- [2001:4860:4860::8888]:443
|
||||
-- 8.8.8.8:443
|
||||
if host_port:find(":") then
|
||||
local sp = split(host_port, ":")
|
||||
port = sp[#sp]
|
||||
if api.is_ipv6addrport(host_port) then
|
||||
result.address = api.get_ipv6_only(host_port)
|
||||
else
|
||||
result.address = sp[1]
|
||||
end
|
||||
else
|
||||
result.address = host_port
|
||||
end
|
||||
result.address, port = parse_host_port(host_port, port)
|
||||
|
||||
if not params.type then params.type = "tcp" end
|
||||
params.type = string.lower(params.type)
|
||||
@@ -1422,19 +1390,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
params[v:sub(1, s - 1)] = UrlDecode(v:sub(s + 1))
|
||||
end
|
||||
end
|
||||
-- [2001:4860:4860::8888]:443
|
||||
-- 8.8.8.8:443
|
||||
if host_port:find(":") then
|
||||
local sp = split(host_port, ":")
|
||||
result.port = sp[#sp]
|
||||
if api.is_ipv6addrport(host_port) then
|
||||
result.address = api.get_ipv6_only(host_port)
|
||||
else
|
||||
result.address = sp[1]
|
||||
end
|
||||
else
|
||||
result.address = host_port
|
||||
end
|
||||
result.address, result.port = parse_host_port(host_port, "443")
|
||||
result.hysteria_obfs = params.obfsParam
|
||||
result.hysteria_auth_type = "string"
|
||||
result.hysteria_auth_password = params.auth
|
||||
@@ -1471,19 +1427,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
params[v:sub(1, s - 1):lower()] = UrlDecode(v:sub(s + 1))
|
||||
end
|
||||
end
|
||||
-- [2001:4860:4860::8888]:443
|
||||
-- 8.8.8.8:443
|
||||
if host_port:find(":") then
|
||||
local sp = split(host_port, ":")
|
||||
result.port = sp[#sp]
|
||||
if api.is_ipv6addrport(host_port) then
|
||||
result.address = api.get_ipv6_only(host_port)
|
||||
else
|
||||
result.address = sp[1]
|
||||
end
|
||||
else
|
||||
result.address = host_port
|
||||
end
|
||||
result.address, result.port = parse_host_port(host_port, "443")
|
||||
result.tls_serverName = params.sni
|
||||
result.tls_pinSHA256 = params.pcs or params.pinsha256
|
||||
result.tls_CertByName = params.vcn
|
||||
@@ -1557,17 +1501,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
params[v:sub(1, s - 1):lower()] = UrlDecode(v:sub(s + 1))
|
||||
end
|
||||
end
|
||||
if host_port:find(":") then
|
||||
local sp = split(host_port, ":")
|
||||
result.port = sp[#sp]
|
||||
if api.is_ipv6addrport(host_port) then
|
||||
result.address = api.get_ipv6_only(host_port)
|
||||
else
|
||||
result.address = sp[1]
|
||||
end
|
||||
else
|
||||
result.address = host_port
|
||||
end
|
||||
result.address, result.port = parse_host_port(host_port, "443")
|
||||
result.tls_serverName = params.sni
|
||||
result.tls_disable_sni = params.disable_sni
|
||||
result.tls_CertByName = params.vcn
|
||||
@@ -1607,19 +1541,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
params[v:sub(1, s - 1):lower()] = UrlDecode(v:sub(s + 1))
|
||||
end
|
||||
end
|
||||
-- [2001:4860:4860::8888]:443
|
||||
-- 8.8.8.8:443
|
||||
if host_port:find(":") then
|
||||
local sp = split(host_port, ":")
|
||||
port = sp[#sp]
|
||||
if api.is_ipv6addrport(host_port) then
|
||||
result.address = api.get_ipv6_only(host_port)
|
||||
else
|
||||
result.address = sp[1]
|
||||
end
|
||||
else
|
||||
result.address = host_port
|
||||
end
|
||||
result.address, port = parse_host_port(host_port, port)
|
||||
result.tls = "0"
|
||||
if not params.security or params.security == "" then
|
||||
params.security = "tls"
|
||||
@@ -1687,17 +1609,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
params[v:sub(1, s - 1)] = UrlDecode(v:sub(s + 1))
|
||||
end
|
||||
end
|
||||
if host_port:find(":") then
|
||||
local sp = split(host_port, ":")
|
||||
result.port = sp[#sp]
|
||||
if api.is_ipv6addrport(host_port) then
|
||||
result.address = api.get_ipv6_only(host_port)
|
||||
else
|
||||
result.address = sp[1]
|
||||
end
|
||||
else
|
||||
result.address = host_port
|
||||
end
|
||||
result.address, result.port = parse_host_port(host_port, "443")
|
||||
result.tls_serverName = params.sni
|
||||
result.uot = params.uot
|
||||
result.naive_insecure_concurrency = params["insecure-concurrency"] or "0"
|
||||
@@ -1741,20 +1653,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
params[UrlDecode(v:sub(1, s - 1)):lower()] = UrlDecode(v:sub(s + 1))
|
||||
end
|
||||
end
|
||||
-- [2001:4860:4860::8888]:443
|
||||
-- 8.8.8.8:443
|
||||
result.port = "443"
|
||||
if host_port:find(":") then
|
||||
local sp = split(host_port, ":")
|
||||
result.port = sp[#sp]
|
||||
if api.is_ipv6addrport(host_port) then
|
||||
result.address = api.get_ipv6_only(host_port)
|
||||
else
|
||||
result.address = sp[1]
|
||||
end
|
||||
else
|
||||
result.address = host_port
|
||||
end
|
||||
result.address, result.port = parse_host_port(host_port, "443")
|
||||
result.snell_psk = params.psk or result.snell_psk
|
||||
result.password = params.userkey
|
||||
result.snell_version = params.version or "4"
|
||||
|
||||
Reference in new issue
Block a user