mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-31 10:25:13 +08:00
update 2026-09-22 01:42:13
This commit is contained in:
1 parent
4ecfeaea15
commit
f1fdcb16b0
56 files changed
+20688
-262
No files matched your search
@@ -1004,6 +1004,7 @@ local current_node = map:get(section)
|
||||
opt.set(dom_prefix + 'method', method || "");
|
||||
opt.set(dom_prefix + 'ss_method', method || "");
|
||||
opt.set(dom_prefix + 'tcp_fast_open', queryParam.tfo);
|
||||
|
||||
if (plugin && plugin != "none") {
|
||||
plugin = (plugin === "simple-obfs") ? "obfs-local" : plugin;
|
||||
opt.set(dom_prefix + 'plugin_enabled', true);
|
||||
@@ -1026,9 +1027,29 @@ local current_node = map:get(section)
|
||||
opt.set(dom_prefix + 'tls_allowInsecure', true);
|
||||
}
|
||||
}
|
||||
//部分订阅 ShadowTLS 采用 SIP003
|
||||
if (plugin === "shadow-tls") {
|
||||
pluginOpts = pluginOpts.replace(/(^|;)password=/, '$1passwd=');
|
||||
pluginOpts = pluginOpts.replace(/(^|;)version=([123])(?=;|$)/, '$1v$2=1');
|
||||
if (dom_prefix === "ssrust_") {
|
||||
opt.set(dom_prefix + 'plugin_opts', pluginOpts || "");
|
||||
} else if (dom_prefix === "singbox_") {
|
||||
const opts = Object.fromEntries(pluginOpts.split(';').map(item => item.split('=', 2)));
|
||||
const host = opts.host;
|
||||
const password = opts.passwd;
|
||||
const versionKey = Object.keys(opts).find(key => /^v[123]$/.test(key));
|
||||
const version = versionKey ? versionKey.slice(1) : "1";
|
||||
opt.set(dom_prefix + 'shadowtls', true);
|
||||
opt.set(dom_prefix + 'shadowtls_version', version);
|
||||
opt.set(dom_prefix + 'shadowtls_password', password || "");
|
||||
opt.set(dom_prefix + 'shadowtls_serverName', host || "");
|
||||
opt.set(dom_prefix + 'plugin_enabled', false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
opt.set(dom_prefix + 'plugin', "none");
|
||||
}
|
||||
|
||||
if (param !== undefined) {
|
||||
opt.set('remarks', decodeURIComponent(param));
|
||||
}
|
||||
@@ -1129,7 +1150,7 @@ local current_node = map:get(section)
|
||||
opt.set(dom_prefix + 'finalmask', queryParam.fm || "");
|
||||
|
||||
if (queryParam["shadow-tls"]) {
|
||||
//解析SS Shadow-TLS 插件参数
|
||||
//解析SS Shadow-TLS 专用参数
|
||||
const parseShadowTLSParams = function(base64Str, outObj) {
|
||||
try {
|
||||
let obj = JSON.parse(b64decsafe(base64Str));
|
||||
|
||||
@@ -749,6 +749,11 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
if idx_pn then
|
||||
result.plugin = plugin_info:sub(1, idx_pn - 1)
|
||||
result.plugin_opts = plugin_info:sub(idx_pn + 1, #plugin_info)
|
||||
-- 部分订阅 ShadowTLS 采用 SIP003
|
||||
result.plugin_opts = result.plugin_opts:gsub("^password=", "passwd=")
|
||||
result.plugin_opts = result.plugin_opts:gsub(";password=", ";passwd=")
|
||||
result.plugin_opts = result.plugin_opts:gsub("^version=([123])", "v%1=1")
|
||||
result.plugin_opts = result.plugin_opts:gsub(";version=([123])", ";v%1=1")
|
||||
else
|
||||
result.plugin = plugin_info
|
||||
end
|
||||
@@ -855,10 +860,22 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
result.plugin_opts = nil
|
||||
end
|
||||
elseif result.type == 'sing-box' then
|
||||
if result.plugin ~= "obfs-local" and result.plugin ~= "v2ray-plugin" then
|
||||
if result.plugin ~= "obfs-local" and result.plugin ~= "v2ray-plugin" and result.plugin ~= "shadow-tls" then
|
||||
result.error_msg = "Sing-Box 不支持 SS " .. result.plugin .. " 插件。"
|
||||
else
|
||||
result.plugin_enabled = "1"
|
||||
-- 部分订阅 ShadowTLS 采用 SIP003
|
||||
if result.plugin == "shadow-tls" then
|
||||
for item in result.plugin_opts:gmatch("[^;]+") do
|
||||
local key, value = item:match("^([^=]+)=(.*)$")
|
||||
if key == "host" then result.shadowtls_serverName = value end
|
||||
if key == "passwd" then result.shadowtls_password = value end
|
||||
if key:match("^v[123]$") then result.shadowtls_version = key:sub(2) end
|
||||
end
|
||||
result.shadowtls = "1"
|
||||
result.plugin_opts = nil
|
||||
result.plugin_enabled = nil
|
||||
end
|
||||
end
|
||||
else
|
||||
result.plugin_enabled = "1"
|
||||
@@ -967,7 +984,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
if result.type ~= "sing-box" and result.type ~= "SS-Rust" then
|
||||
result.error_msg = sub_ss_type .. " 不支持 shadow-tls 插件。"
|
||||
else
|
||||
-- 解析SS Shadow-TLS 插件参数
|
||||
-- 解析SS Shadow-TLS 专用参数
|
||||
local function parseShadowTLSParams(b64str, out)
|
||||
local ok, data = pcall(jsonParse, base64Decode(b64str))
|
||||
if not ok or type(data) ~= "table" then return "" end
|
||||
|
||||
Reference in new issue
Block a user