parent
f4a775a7e2
commit
1c9aa617ce
@ -82,66 +82,34 @@ local doh_validate = function(self, value, t)
|
|||||||
return value
|
return value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil, translate("DoH request address") .. " " .. translate("Format must be:") .. " URL,IP"
|
return nil, translatef("%s request address","DoH") .. " " .. translate("Format must be:") .. " URL,IP"
|
||||||
end
|
end
|
||||||
|
|
||||||
local chinadns_dot_validate = function(self, value, t)
|
local chinadns_dot_validate = function(self, value, t)
|
||||||
local function isValidDoTString(s)
|
local function isValidDoTString(s)
|
||||||
local prefix = "tls://"
|
if s:sub(1, 6) ~= "tls://" then return false end
|
||||||
if s:sub(1, #prefix) ~= prefix then
|
local address = s:sub(7)
|
||||||
return false
|
|
||||||
end
|
|
||||||
local address = s:sub(#prefix + 1)
|
|
||||||
local at_index = address:find("@")
|
local at_index = address:find("@")
|
||||||
local hash_index = address:find("#")
|
local hash_index = address:find("#")
|
||||||
local domain, ip, port
|
local ip, port
|
||||||
if at_index then
|
local domain = at_index and address:sub(1, at_index - 1) or nil
|
||||||
if hash_index then
|
ip = at_index and address:sub(at_index + 1, (hash_index or 0) - 1) or address:sub(1, (hash_index or 0) - 1)
|
||||||
domain = address:sub(1, at_index - 1)
|
port = hash_index and address:sub(hash_index + 1) or nil
|
||||||
ip = address:sub(at_index + 1, hash_index - 1)
|
local num_port = tonumber(port)
|
||||||
port = address:sub(hash_index + 1)
|
if (port and (not num_port or num_port <= 0 or num_port >= 65536)) or
|
||||||
else
|
(domain and domain == "") or
|
||||||
domain = address:sub(1, at_index - 1)
|
(not datatypes.ipaddr(ip) and not datatypes.ip6addr(ip)) then
|
||||||
ip = address:sub(at_index + 1)
|
|
||||||
port = nil
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if hash_index then
|
|
||||||
ip = address:sub(1, hash_index - 1)
|
|
||||||
port = address:sub(hash_index + 1)
|
|
||||||
else
|
|
||||||
ip = address
|
|
||||||
port = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local function isValidPort(port)
|
|
||||||
if not port then return true end
|
|
||||||
local num = tonumber(port)
|
|
||||||
return num and num > 0 and num < 65536
|
|
||||||
end
|
|
||||||
local function isValidDomain(domain)
|
|
||||||
if not domain then return true end
|
|
||||||
return #domain > 0
|
|
||||||
end
|
|
||||||
local function isValidIP(ip)
|
|
||||||
return datatypes.ipaddr(ip) or datatypes.ip6addr(ip)
|
|
||||||
end
|
|
||||||
if not isValidIP(ip) or not isValidPort(port) then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
if not isValidDomain(domain) then
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if value ~= "" then
|
if value ~= "" then
|
||||||
value = api.trim(value)
|
value = api.trim(value)
|
||||||
if isValidDoTString(value) then
|
if isValidDoTString(value) then
|
||||||
return value
|
return value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil, translate("Direct DNS") .. " DoT " .. translate("Format must be:") .. " tls://Domain@IP(#Port) or tls://IP(#Port)"
|
return nil, translatef("%s request address","DoT") .. " " .. translate("Format must be:") .. " tls://" .. translate("Domain") .. "@IP[#Port] | tls://IP[#Port]"
|
||||||
end
|
end
|
||||||
|
|
||||||
m:append(Template(appname .. "/global/status"))
|
m:append(Template(appname .. "/global/status"))
|
||||||
|
@ -142,6 +142,9 @@ msgstr "配置不当"
|
|||||||
msgid "Make sure socks service is available on this address."
|
msgid "Make sure socks service is available on this address."
|
||||||
msgstr "请确保此 Socks 服务可用。"
|
msgstr "请确保此 Socks 服务可用。"
|
||||||
|
|
||||||
|
msgid "%s request address"
|
||||||
|
msgstr "%s 请求地址"
|
||||||
|
|
||||||
msgid "Format must be:"
|
msgid "Format must be:"
|
||||||
msgstr "格式必须为:"
|
msgstr "格式必须为:"
|
||||||
|
|
||||||
|
@ -24,10 +24,10 @@ index 03006a6..f384bbc 100644
|
|||||||
if code ~= 0 then
|
if code ~= 0 then
|
||||||
local use_time = luci.sys.exec("echo -n '" .. result .. "' | awk -F ':' '{print $2}'")
|
local use_time = luci.sys.exec("echo -n '" .. result .. "' | awk -F ':' '{print $2}'")
|
||||||
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
||||||
index 6df0021..1411a56 100644
|
index 806095f..fe5fa30 100644
|
||||||
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
||||||
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
||||||
@@ -435,6 +435,12 @@ o:value("9.9.9.9", "9.9.9.9 (Quad9-Recommended)")
|
@@ -403,6 +403,12 @@ o:value("9.9.9.9", "9.9.9.9 (Quad9-Recommended)")
|
||||||
o:value("149.112.112.112", "149.112.112.112 (Quad9-Recommended)")
|
o:value("149.112.112.112", "149.112.112.112 (Quad9-Recommended)")
|
||||||
o:value("208.67.220.220", "208.67.220.220 (OpenDNS)")
|
o:value("208.67.220.220", "208.67.220.220 (OpenDNS)")
|
||||||
o:value("208.67.222.222", "208.67.222.222 (OpenDNS)")
|
o:value("208.67.222.222", "208.67.222.222 (OpenDNS)")
|
||||||
|
Loading…
Reference in New Issue
Block a user