From 6fedf2264feac415a05adc43e510b81ad79a8f9a Mon Sep 17 00:00:00 2001 From: xiaorouji <60100640+xiaorouji@users.noreply.github.com> Date: Sat, 20 Mar 2021 20:03:26 +0800 Subject: [PATCH] luci-app-passwall: sync with upstream source Co-authored-by: lededev <30518126+lededev@users.noreply.github.com> Signed-off-by: Tianling Shen --- .../luasrc/controller/passwall.lua | 33 +-- .../luasrc/model/cbi/passwall/client/acl.lua | 4 +- .../model/cbi/passwall/client/global.lua | 22 +- .../model/cbi/passwall/client/node_config.lua | 2 +- .../model/cbi/passwall/client/node_list.lua | 4 +- .../luasrc/model/cbi/passwall/client/rule.lua | 2 +- .../model/cbi/passwall/server/index.lua | 2 +- .../luasrc/model/cbi/passwall/server/user.lua | 7 +- .../view/passwall/node_list/link_add_node.htm | 37 --- .../passwall/node_list/link_share_man.htm | 261 +++++++++++++++--- .../luci-app-passwall/po/zh_Hans/passwall.po | 35 ++- .../root/usr/share/passwall/app.sh | 3 +- .../root/usr/share/passwall/iptables.sh | 22 +- .../root/usr/share/passwall/subscribe.lua | 13 +- 14 files changed, 282 insertions(+), 165 deletions(-) diff --git a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua index 1ace8936c3..776407f930 100644 --- a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua +++ b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua @@ -49,9 +49,6 @@ function index() entry({"admin", "services", appname, "server_user_log"}, call("server_user_log")).leaf = true entry({"admin", "services", appname, "server_get_log"}, call("server_get_log")).leaf = true entry({"admin", "services", appname, "server_clear_log"}, call("server_clear_log")).leaf = true - entry({"admin", "services", appname, "link_append_temp"}, call("link_append_temp")).leaf = true - entry({"admin", "services", appname, "link_load_temp"}, call("link_load_temp")).leaf = true - entry({"admin", "services", appname, "link_clear_temp"}, call("link_clear_temp")).leaf = true entry({"admin", "services", appname, "link_add_node"}, call("link_add_node")).leaf = true entry({"admin", "services", appname, "get_now_use_node"}, call("get_now_use_node")).leaf = true entry({"admin", "services", appname, "get_redir_log"}, call("get_redir_log")).leaf = true @@ -97,38 +94,10 @@ function hide_menu() luci.http.redirect(luci.dispatcher.build_url("admin", "status", "overview")) end -function link_append_temp() - local link = luci.http.formvalue("link") - local lfile = "/tmp/links.conf" - local ret, ldata="empty", {} - luci.sys.call('touch ' .. lfile .. ' && echo \'' .. link .. '\' >> ' .. lfile) - ret = luci.sys.exec([[awk -F'://' 'BEGIN{ all=0 } /.{2,9}:\/\/.{4,}$/ {gsub(/:\/\/.*$/,""); arr[$0]++; all++ } END { for(typ in arr) { printf("%s: %d, ", typ, arr[typ]) }; printf("\ntotal: %d", all) }' ]] .. lfile) - luci.http.prepare_content("application/json") - luci.http.write_json({counter = ret}) -end - -function link_load_temp() - local lfile = "/tmp/links.conf" - local ret, ldata="empty", {} - ldata[#ldata+1] = nixio.fs.readfile(lfile) or "_nofile_" - if ldata[1] == "" then - ldata[1] = "_nodata_" - else - ret = luci.sys.exec([[awk -F'://' 'BEGIN{ all=0 } /.{2,9}:\/\/.{4,}$/ {gsub(/:\/\/.*$/,""); arr[$0]++; all++ } END { for(typ in arr) { printf("%s: %d, ", typ, arr[typ]) }; printf("\ntotal: %d", all) }' ]] .. lfile) - end - luci.http.prepare_content("application/json") - luci.http.write_json({counter = ret, data = ldata}) -end - -function link_clear_temp() - local lfile = "/tmp/links.conf" - luci.sys.call('cat /dev/null > ' .. lfile) -end - function link_add_node() local lfile = "/tmp/links.conf" local link = luci.http.formvalue("link") - luci.sys.call('echo \'' .. link .. '\' >> ' .. lfile) + luci.sys.call('echo \'' .. link .. '\' > ' .. lfile) luci.sys.call("lua /usr/share/passwall/subscribe.lua add log") end diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua index 36ccce3868..1f38d21f5f 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/acl.lua @@ -43,7 +43,7 @@ o.rmempty = true sys.net.mac_hints(function(e, t) o:value(e, "%s (%s)" % {e, t}) end) ---- TCP Proxy Mode -tcp_proxy_mode = s:option(ListValue, "tcp_proxy_mode", "TCP" .. translate("Proxy Mode")) +tcp_proxy_mode = s:option(ListValue, "tcp_proxy_mode", translatef("%s Proxy Mode", "TCP")) tcp_proxy_mode.default = "default" tcp_proxy_mode.rmempty = false tcp_proxy_mode:value("default", translate("Default")) @@ -57,7 +57,7 @@ else end ---- UDP Proxy Mode -udp_proxy_mode = s:option(ListValue, "udp_proxy_mode", "UDP" .. translate("Proxy Mode")) +udp_proxy_mode = s:option(ListValue, "udp_proxy_mode", translatef("%s Proxy Mode", "UDP")) udp_proxy_mode.default = "default" udp_proxy_mode.rmempty = false udp_proxy_mode:value("default", translate("Default")) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua index b2f9f72c97..f2613b0481 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua @@ -151,7 +151,7 @@ if has_xray and #nodes_table > 0 then end local id = "main_node" - o = s:taboption("Main", ListValue, v.id .. "." .. id, "* " .. translate("Default") .. translate("Preproxy")) + o = s:taboption("Main", ListValue, v.id .. "." .. id, "* " .. translate("Default") .. " " .. translate("Preproxy")) o:depends("tcp_node", v.id) o:value("nil", translate("Close")) for k1, v1 in pairs(normal_list) do @@ -263,7 +263,7 @@ end s:tab("Proxy", translate("Mode")) ---- TCP Default Proxy Mode -tcp_proxy_mode = s:taboption("Proxy", ListValue, "tcp_proxy_mode", "TCP" .. translate("Default") .. translate("Proxy Mode")) +tcp_proxy_mode = s:taboption("Proxy", ListValue, "tcp_proxy_mode", "TCP " .. translate("Default") .. translate("Proxy Mode")) -- o.description = translate("If not available, try clearing the cache.") tcp_proxy_mode:value("disable", translate("No Proxy")) tcp_proxy_mode:value("global", translate("Global Proxy")) @@ -274,7 +274,7 @@ tcp_proxy_mode.default = "chnroute" --tcp_proxy_mode.validate = redir_mode_validate ---- UDP Default Proxy Mode -udp_proxy_mode = s:taboption("Proxy", ListValue, "udp_proxy_mode", "UDP" .. translate("Default") .. translate("Proxy Mode")) +udp_proxy_mode = s:taboption("Proxy", ListValue, "udp_proxy_mode", "UDP " .. translate("Default") .. translate("Proxy Mode")) udp_proxy_mode:value("disable", translate("No Proxy")) udp_proxy_mode:value("global", translate("Global Proxy")) udp_proxy_mode:value("gfwlist", translate("GFW List")) @@ -284,7 +284,7 @@ udp_proxy_mode.default = "chnroute" --udp_proxy_mode.validate = redir_mode_validate ---- Localhost TCP Proxy Mode -localhost_tcp_proxy_mode = s:taboption("Proxy", ListValue, "localhost_tcp_proxy_mode", translate("Router Localhost") .. "TCP" .. translate("Proxy Mode")) +localhost_tcp_proxy_mode = s:taboption("Proxy", ListValue, "localhost_tcp_proxy_mode", translate("Router Localhost") .. " TCP " .. translate("Proxy Mode")) -- o.description = translate("The server client can also use this rule to scientifically surf the Internet.") localhost_tcp_proxy_mode:value("default", translate("Default")) localhost_tcp_proxy_mode:value("global", translate("Global Proxy")) @@ -295,7 +295,7 @@ localhost_tcp_proxy_mode.default = "default" --localhost_tcp_proxy_mode.validate = redir_mode_validate ---- Localhost UDP Proxy Mode -localhost_udp_proxy_mode = s:taboption("Proxy", ListValue, "localhost_udp_proxy_mode", translate("Router Localhost") .. "UDP" .. translate("Proxy Mode")) +localhost_udp_proxy_mode = s:taboption("Proxy", ListValue, "localhost_udp_proxy_mode", translate("Router Localhost") .. " UDP " .. translate("Proxy Mode")) localhost_udp_proxy_mode:value("default", translate("Default")) localhost_udp_proxy_mode:value("global", translate("Global Proxy")) localhost_udp_proxy_mode:value("gfwlist", translate("GFW List")) @@ -306,13 +306,13 @@ localhost_udp_proxy_mode.default = "default" localhost_udp_proxy_mode.validate = redir_mode_validate s:tab("log", translate("Log")) -o = s:taboption("log", Flag, "close_log_tcp", translate("Close") .. translate("Log") .. " " .. translate("TCP Node")) +o = s:taboption("log", Flag, "close_log_tcp", translatef("%s Node Log Close", "TCP")) o.rmempty = false -o = s:taboption("log", Flag, "close_log_udp", translate("Close") .. translate("Log") .. " " .. translate("UDP Node")) +o = s:taboption("log", Flag, "close_log_udp", translatef("%s Node Log Close", "UDP")) o.rmempty = false -loglevel = s:taboption("log", ListValue, "loglevel", "X/V2ray" .. translate("Log Level")) +loglevel = s:taboption("log", ListValue, "loglevel", "Xray" .. translate("Log Level")) loglevel.default = "warning" loglevel:value("debug") loglevel:value("info") @@ -333,7 +333,7 @@ o = s:taboption("tips", DummyValue, "") o.template = appname .. "/global/tips" -- [[ Socks Server ]]-- -o = s:taboption("Main", Flag, "socks_enabled", "Socks" .. translate("Main switch")) +o = s:taboption("Main", Flag, "socks_enabled", "Socks " .. translate("Main switch")) o.rmempty = false s = m:section(TypedSection, "socks", translate("Socks Config")) @@ -358,13 +358,13 @@ o.rmempty = false socks_node = s:option(ListValue, "node", translate("Socks Node")) socks_node:value("tcp", translate("Same as the tcp node")) -o = s:option(Value, "port", "Socks" .. translate("Listen Port")) +o = s:option(Value, "port", "Socks " .. translate("Listen Port")) o.default = 9050 o.datatype = "port" o.rmempty = false if has_xray then - o = s:option(Value, "http_port", "HTTP" .. translate("Listen Port") .. " " .. translate("0 is not use")) + o = s:option(Value, "http_port", "HTTP " .. translate("Listen Port") .. " " .. translate("0 is not use")) o.default = 0 o.datatype = "port" end diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua index 9ab09ff8bd..76b9ace7a9 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua @@ -59,7 +59,7 @@ s = m:section(NamedSection, arg[1], "nodes", "") s.addremove = false s.dynamic = false -share = s:option(DummyValue, "passwall", translate("Share Current")) +share = s:option(DummyValue, "passwall", " ") share.rawhtml = true share.template = "passwall/node_list/link_share_man" share.value = arg[1] diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua index f316703b59..556f624ac8 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua @@ -63,9 +63,9 @@ o.cfgvalue = function(t, n) if type == "Xray" then local protocol = m:get(n, "protocol") if protocol == "_balancing" then - protocol = "负载均衡" + protocol = translate("Balancing") elseif protocol == "_shunt" then - protocol = "分流" + protocol = translate("Shunt") elseif protocol == "vmess" then protocol = "VMess" elseif protocol == "vless" then diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua index 7d8bec44c9..e9893b23cd 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua @@ -56,7 +56,7 @@ o = s:option(Value, "xray_location_asset", translate("Location of Xray asset"), o.default = "/usr/share/xray/" o.rmempty = false -s = m:section(TypedSection, "shunt_rules", "Xray" .. translate("Shunt") .. translate("Rule"), "" .. translate("Please note attention to the priority, the higher the order, the higher the priority.") .. "") +s = m:section(TypedSection, "shunt_rules", "Xray " .. translate("Shunt Rule"), "" .. translate("Please note attention to the priority, the higher the order, the higher the priority.") .. "") s.template = "cbi/tblsection" s.anonymous = false s.addremove = true diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/index.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/index.lua index 7693fa2dd7..706a7d6419 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/index.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/index.lua @@ -63,7 +63,7 @@ end e = t:option(DummyValue, "port", translate("Port")) -e = t:option(Flag, "log", translate("Enable") .. translate("Log")) +e = t:option(Flag, "log", translate("Log")) e.default = "1" e.rmempty = false diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua index 0390ac1814..baa4bdf56e 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua @@ -54,11 +54,6 @@ s = m:section(NamedSection, arg[1], "user", "") s.addremove = false s.dynamic = false -share = s:option(DummyValue, "passwall_server", translate("Share Current")) -share.rawhtml = true -share.template = "passwall/node_list/link_share_man" -share.value = arg[1] - enable = s:option(Flag, "enable", translate("Enable")) enable.default = "1" enable.rmempty = false @@ -582,7 +577,7 @@ transit_node_password.password = true transit_node_password:depends("transit_node", "_socks") transit_node_password:depends("transit_node", "_http") -log = s:option(Flag, "log", translate("Enable") .. translate("Log")) +log = s:option(Flag, "log", translate("Log")) log.default = "1" log.rmempty = false diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm index 69f9688df0..4728ceea4d 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/node_list/link_add_node.htm @@ -20,41 +20,6 @@ local api = require "luci.model.cbi.passwall.api.api" - + diff --git a/package/lienol/luci-app-passwall/po/zh_Hans/passwall.po b/package/lienol/luci-app-passwall/po/zh_Hans/passwall.po index 35007043b0..9fa953c6da 100644 --- a/package/lienol/luci-app-passwall/po/zh_Hans/passwall.po +++ b/package/lienol/luci-app-passwall/po/zh_Hans/passwall.po @@ -292,6 +292,9 @@ msgstr "单进程" msgid "Proxy Mode" msgstr "代理模式" +msgid "%s Proxy Mode" +msgstr "%s 代理模式" + msgid "If not available, try clearing the cache." msgstr "如果无法使用,请尝试清除缓存。" @@ -337,12 +340,6 @@ msgstr "SS/SSR/Vmess/VLESS/Trojan链接" msgid "Please enter the correct link, ss:// ssr:// vmess:// vless:// trojan://" msgstr "请输入正确的链接,ss:// ssr:// vmess:// vless:// trojan://" -msgid "Load Cached" -msgstr "加载缓存" - -msgid "Clear Cached" -msgstr "清除缓存" - msgid "Clear all nodes" msgstr "清空所有节点" @@ -451,14 +448,11 @@ msgstr "负载均衡节点列表" msgid "Load balancing node list, document" msgstr "负载均衡节点列表,文档原理" -msgid "Share Current" -msgstr "所见即所得" - msgid "From Share URL" -msgstr "导入配置信息" +msgstr "导入分享URL" msgid "Build Share URL" -msgstr "导出配置信息" +msgstr "导出分享URL" msgid "Import Finished" msgstr "导入完成:" @@ -467,19 +461,16 @@ msgid "Not a supported scheme:" msgstr "不支持这种样式的:" msgid "Invalid Share URL Format" -msgstr "无效的分享信息" - -msgid "User cancelled" -msgstr "用户已取消" +msgstr "无效的分享URL信息" msgid "Paste Share URL Here" msgstr "在此处粘贴分享信息" -msgid "Unable share to clipboard, copy to batch mode still:" -msgstr "无法分享网址到剪贴板,复制到批量导入临时输入:" +msgid "Share url to clipboard unable." +msgstr "无法分享URL到剪贴板。" -msgid "Share to clipboard successfully, copy to batch mode still:" -msgstr "成功复制分享网址到剪贴板和批量导入临时输入:" +msgid "Share url to clipboard successfully." +msgstr "成功复制分享URL到剪贴板。" msgid "Faltal on get option, please help in debug:" msgstr "代码错误,请协助捉虫:" @@ -766,6 +757,9 @@ msgstr "Xray 资源文件目录" msgid "This variable specifies a directory where geoip.dat and geosite.dat files are." msgstr "此变量指定geoip.dat和geosite.dat文件所在的目录。" +msgid "Shunt Rule" +msgstr "分流规则" + msgid "Please note attention to the priority, the higher the order, the higher the priority." msgstr "请注意优先级问题,排序越上面优先级越高。" @@ -1183,6 +1177,9 @@ msgstr "日志" msgid "Log" msgstr "日志" +msgid "%s Node Log Close" +msgstr "%s 节点日志关闭" + msgid "Log Level" msgstr "日志等级" diff --git a/package/lienol/luci-app-passwall/root/usr/share/passwall/app.sh b/package/lienol/luci-app-passwall/root/usr/share/passwall/app.sh index 3a61cc8123..d792289087 100755 --- a/package/lienol/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/package/lienol/luci-app-passwall/root/usr/share/passwall/app.sh @@ -801,7 +801,8 @@ start_dns() { nonuse) echolog " - 不过滤DNS..." TUN_DNS="" - return + use_chinadns_ng=$(config_t_get global always_use_chinadns_ng 0) + [ "$use_chinadns_ng" == "0" ] && return ;; dns2socks) local dns2socks_socks_server=$(echo $(config_t_get global socks_server 127.0.0.1:9050) | sed "s/#/:/g") diff --git a/package/lienol/luci-app-passwall/root/usr/share/passwall/iptables.sh b/package/lienol/luci-app-passwall/root/usr/share/passwall/iptables.sh index c17ef69dda..5ae53147d9 100755 --- a/package/lienol/luci-app-passwall/root/usr/share/passwall/iptables.sh +++ b/package/lienol/luci-app-passwall/root/usr/share/passwall/iptables.sh @@ -62,7 +62,7 @@ RULE_LAST_INDEX() { local chain=${1}; shift local list=${1}; shift local default=${1:-0}; shift - local _index=$($ipt_tmp -n -L $chain --line-numbers 2>/dev/null | grep "$list" | sed -n '$p' | awk '{print $1}') + local _index=$($ipt_tmp -n -L $chain --line-numbers 2>/dev/null | grep "$list" | head -n 1 | awk '{print $1}') echo "${_index:-${default}}" } @@ -550,27 +550,29 @@ add_firewall_rule() { # 过滤所有节点IP filter_vpsip > /dev/null 2>&1 & filter_haproxy > /dev/null 2>&1 & - - # 据说能提升性能? - $ipt_m -N PSW_DIVERT - $ipt_m -A PSW_DIVERT -j MARK --set-mark 1 - $ipt_m -A PSW_DIVERT -j ACCEPT - $ipt_m -A PREROUTING -p tcp -m socket -j PSW_DIVERT $ipt_n -N PSW $ipt_n -A PSW $(dst $IPSET_LANIPLIST) -j RETURN $ipt_n -A PSW $(dst $IPSET_VPSIPLIST) -j RETURN $ipt_n -A PSW $(dst $IPSET_WHITELIST) -j RETURN $ipt_n -A PSW -m mark --mark 0xff -j RETURN - local PR_INDEX=$(RULE_LAST_INDEX "$ipt_n" PREROUTING prerouting_rule) + PR_INDEX=$(RULE_LAST_INDEX "$ipt_n" PREROUTING prerouting_rule) PR_INDEX=$((PR_INDEX + 1)) $ipt_n -I PREROUTING $PR_INDEX -p tcp -j PSW + unset PR_INDEX $ipt_n -N PSW_OUTPUT $ipt_n -A PSW_OUTPUT $(dst $IPSET_LANIPLIST) -j RETURN $ipt_n -A PSW_OUTPUT $(dst $IPSET_VPSIPLIST) -j RETURN $ipt_n -A PSW_OUTPUT $(dst $IPSET_WHITELIST) -j RETURN $ipt_n -A PSW_OUTPUT -m mark --mark 0xff -j RETURN + + # 据说能提升性能? + PR_INDEX=$(RULE_LAST_INDEX "$ipt_m" PREROUTING mwan3 1) + $ipt_m -N PSW_DIVERT + $ipt_m -A PSW_DIVERT -j MARK --set-mark 1 + $ipt_m -A PSW_DIVERT -j ACCEPT + $ipt_m -I PREROUTING $PR_INDEX -p tcp -m socket -j PSW_DIVERT $ipt_m -N PSW $ipt_m -A PSW $(dst $IPSET_LANIPLIST) -j RETURN @@ -578,7 +580,9 @@ add_firewall_rule() { $ipt_m -A PSW $(dst $IPSET_WHITELIST) -j RETURN $ipt_m -A PSW -m mark --mark 0xff -j RETURN $ipt_m -A PSW $(dst $IPSET_BLOCKLIST) -j DROP - $ipt_m -A PREROUTING -j PSW + PR_INDEX=$((PR_INDEX + 1)) + $ipt_m -I PREROUTING $PR_INDEX -j PSW + unset PR_INDEX $ipt_m -N PSW_OUTPUT $ipt_m -A PSW_OUTPUT $(dst $IPSET_LANIPLIST) -j RETURN diff --git a/package/lienol/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/package/lienol/luci-app-passwall/root/usr/share/passwall/subscribe.lua index 51a1641bc1..e298622960 100755 --- a/package/lienol/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/package/lienol/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -328,7 +328,6 @@ local function processData(szType, content, add_mode) result.address = info.add result.port = info.port result.protocol = 'vmess' - result.transport = info.net result.alter_id = info.aid result.uuid = info.id result.remarks = info.ps @@ -350,7 +349,8 @@ local function processData(szType, content, add_mode) result.tcp_guise_http_host = info.host result.tcp_guise_http_path = info.path end - if info.net == 'kcp' then + if info.net == 'kcp' or info.net == 'mkcp' then + info.net = "mkcp" result.mkcp_guise = info.type result.mkcp_mtu = 1350 result.mkcp_tti = 50 @@ -364,10 +364,11 @@ local function processData(szType, content, add_mode) result.quic_key = info.key result.quic_security = info.securty end + result.transport = info.net if not info.security then result.security = "auto" end if info.tls == "tls" or info.tls == "1" then result.tls = "1" - result.tls_serverName = info.host + result.tls_serverName = info.sni result.tls_allowInsecure = allowInsecure_default and "1" or "0" else result.tls = "0" @@ -598,7 +599,7 @@ local function processData(szType, content, add_mode) local params = {} for _, v in pairs(split(query[2], '&')) do local t = split(v, '=') - params[string.lower(t[1])] = UrlDecode(t[2]) + params[t[1]] = UrlDecode(t[2]) end if params.type == 'ws' then @@ -614,7 +615,8 @@ local function processData(szType, content, add_mode) result.tcp_guise_http_host = params.host result.tcp_guise_http_path = params.path end - if params.type == 'kcp' then + if params.type == 'kcp' or params.type == 'mkcp' then + params.type = "mkcp" result.mkcp_guise = params.headerType or "none" result.mkcp_mtu = 1350 result.mkcp_tti = 50 @@ -628,6 +630,7 @@ local function processData(szType, content, add_mode) result.quic_key = params.key result.quic_security = params.quicSecurity or "none" end + result.transport = params.type result.encryption = params.encryption or "none"