Skip to content

Commit

Permalink
update 2024-08-10 00:22:30
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzok8 committed Aug 9, 2024
1 parent 24c33f5 commit c6561ee
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 19 deletions.
4 changes: 2 additions & 2 deletions ddns-go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=ddns-go
PKG_VERSION:=6.6.7
PKG_VERSION:=6.6.8
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/jeessy2/ddns-go/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=a2b8625ec499cfa822924bf4109b74b362438c92a7c632b7574817de8deee744
PKG_HASH:=800271b838f62fa0b59a1e05ae8aaced5c92de8872c1c59c73840aebf73b8f8a

PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,37 @@
var params = "";
if (opt.get(dom_prefix + "tls").checked) {
params += opt.query("sni", dom_prefix + "tls_serverName");
params += "&tls=1"
params += "&security=tls"
params += opt.query("allowinsecure", dom_prefix + "tls_allowInsecure");
}
// 获取transport参数并设置type
var transport = opt.get(dom_prefix + "transport").value || "";
switch (transport.toLowerCase()) {
case 'tcp':
params += "&type=tcp";
break;
case 'ws':
params += "&type=ws";
break;
case 'kcp':
params += "&type=kcp";
break;
case 'mkcp':
params += "&type=kcp";
break;
case 'http':
params += "&type=http";
break;
case 'h2':
params += "&type=h2";
break;
case 'grpc':
params += "&type=grpc";
break;
default:
// 默认不添加type参数
break;
}
params += "#" + encodeURI(v_alias.value);
if (params[0] == "&") {
params = params.substring(1);
Expand Down Expand Up @@ -679,17 +707,44 @@
var queryParams = query[1];
var queryArray = queryParams.split('&');
var params;
for (i = 0; i < queryArray.length; i++) {
for (var i = 0; i < queryArray.length; i++) {
params = queryArray[i].split('=');
queryParam[decodeURIComponent(params[0]).toLowerCase()] = decodeURIComponent(params[1] || '');
}
}
opt.set(dom_prefix + 'address', m.hostname);
opt.set(dom_prefix + 'port', m.port || "443");
opt.set(dom_prefix + 'password', decodeURIComponent(password));
opt.set(dom_prefix + 'tls', queryParam.tls === "1");
opt.set(dom_prefix + 'tls', queryParam.security === "tls" ? "1" : "0");
opt.set(dom_prefix + 'tls_serverName', queryParam.peer || queryParam.sni || '');
opt.set(dom_prefix + 'tls_allowInsecure', queryParam.allowinsecure === '1');
// 根据type参数设置transport
var transportType = queryParam.type || "";
switch (transportType.toLowerCase()) {
case 'tcp':
opt.set(dom_prefix + 'transport', 'tcp');
break;
case 'ws':
opt.set(dom_prefix + 'transport', 'ws');
break;
case 'kcp':
opt.set(dom_prefix + 'transport', 'mkcp');
break;
case 'mkcp':
opt.set(dom_prefix + 'transport', 'mkcp');
break;
case 'http':
opt.set(dom_prefix + 'transport', 'http');
break;
case 'h2':
opt.set(dom_prefix + 'transport', 'h2');
break;
case 'grpc':
opt.set(dom_prefix + 'transport', 'grpc');
break;
default:
opt.set(dom_prefix + 'transport', ''); // 默认清空transport
}
if (m.hash) {
opt.set('remarks', decodeURI(m.hash.substr(1)));
}
Expand Down
102 changes: 88 additions & 14 deletions luci-app-passwall/root/usr/share/passwall/subscribe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,21 @@ local function processData(szType, content, add_mode, add_from)
end
end
elseif szType == "trojan" then
if trojan_type_default == "trojan-plus" and has_trojan_plus then
result.type = "Trojan-Plus"
elseif trojan_type_default == "sing-box" and has_singbox then
result.type = 'sing-box'
elseif trojan_type_default == "xray" and has_xray then
result.type = 'Xray'
end
result.protocol = 'trojan'
local alias = ""
if content:find("#") then
local idx_sp = content:find("#")
alias = content:sub(idx_sp + 1, -1)
content = content:sub(0, idx_sp - 1)
end
result.remarks = UrlDecode(alias)
result.type = "Trojan-Plus"
if content:find("@") then
local Info = split(content, "@")
result.password = UrlDecode(Info[1])
Expand Down Expand Up @@ -658,8 +665,10 @@ local function processData(szType, content, add_mode, add_from)
if params.peer then peer = params.peer end
sni = params.sni and params.sni or ""
result.port = port

result.tls = '1'
result.tls_serverName = peer and peer or sni

if params.allowinsecure then
if params.allowinsecure == "1" or params.allowinsecure == "0" then
result.tls_allowInsecure = params.allowinsecure
Expand All @@ -670,16 +679,75 @@ local function processData(szType, content, add_mode, add_from)
else
result.tls_allowInsecure = allowInsecure_default and "1" or "0"
end

if not params.type then
params.type = "tcp"
end
params.type = string.lower(params.type)
result.transport = params.type
if params.type == 'ws' then
result.ws_host = params.host
result.ws_path = params.path
if result.type == "sing-box" and params.path then
local ws_path_dat = split(params.path, "?")
local ws_path = ws_path_dat[1]
local ws_path_params = {}
for _, v in pairs(split(ws_path_dat[2], '&')) do
local t = split(v, '=')
ws_path_params[t[1]] = t[2]
end
if ws_path_params.ed and tonumber(ws_path_params.ed) then
result.ws_path = ws_path
result.ws_enableEarlyData = "1"
result.ws_maxEarlyData = tonumber(ws_path_params.ed)
result.ws_earlyDataHeaderName = "Sec-WebSocket-Protocol"
end
end
end
if params.type == 'h2' or params.type == 'http' then
if result.type == "sing-box" then
result.transport = "http"
result.http_host = params.host
result.http_path = params.path
elseif result.type == "xray" then
result.transport = "h2"
result.h2_host = params.host
result.h2_path = params.path
end
end
if params.type == 'tcp' then
result.tcp_guise = params.headerType or "none"
result.tcp_guise_http_host = params.host
result.tcp_guise_http_path = params.path
end
if params.type == 'kcp' or params.type == 'mkcp' then
result.transport = "mkcp"
result.mkcp_guise = params.headerType or "none"
result.mkcp_mtu = 1350
result.mkcp_tti = 50
result.mkcp_uplinkCapacity = 5
result.mkcp_downlinkCapacity = 20
result.mkcp_readBufferSize = 2
result.mkcp_writeBufferSize = 2
result.mkcp_seed = params.seed
end
if params.type == 'quic' then
result.quic_guise = params.headerType or "none"
result.quic_key = params.key
result.quic_security = params.quicSecurity or "none"
end
if params.type == 'grpc' then
if params.path then result.grpc_serviceName = params.path end
if params.serviceName then result.grpc_serviceName = params.serviceName end
result.grpc_mode = params.mode
end

result.encryption = params.encryption or "none"

result.flow = params.flow or nil

end
if trojan_type_default == "trojan-plus" and has_trojan_plus then
result.type = "Trojan-Plus"
elseif trojan_type_default == "sing-box" and has_singbox then
result.type = 'sing-box'
result.protocol = 'trojan'
elseif trojan_type_default == "xray" and has_xray then
result.type = 'Xray'
result.protocol = 'trojan'
end

elseif szType == "ssd" then
result.type = "SS"
result.address = content.server
Expand Down Expand Up @@ -762,17 +830,23 @@ local function processData(szType, content, add_mode, add_from)
end
end
if params.type == 'h2' or params.type == 'http' then
params.type = "h2"
result.h2_host = params.host
result.h2_path = params.path
if result.type == "sing-box" then
result.transport = "http"
result.http_host = params.host
result.http_path = params.path
elseif result.type == "xray" then
result.transport = "h2"
result.h2_host = params.host
result.h2_path = params.path
end
end
if params.type == 'tcp' then
result.tcp_guise = params.headerType or "none"
result.tcp_guise_http_host = params.host
result.tcp_guise_http_path = params.path
end
if params.type == 'kcp' or params.type == 'mkcp' then
params.type = "mkcp"
result.transport = "mkcp"
result.mkcp_guise = params.headerType or "none"
result.mkcp_mtu = 1350
result.mkcp_tti = 50
Expand Down

0 comments on commit c6561ee

Please sign in to comment.