up smartdns luci 41

This commit is contained in:
SirPdboy 2023-03-08 23:26:32 +08:00 committed by GitHub
parent 1e32c51ede
commit 731e67ae47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 207 additions and 19 deletions

View File

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Nick Peng <pymumu@gmail.com>
PKG_VERSION:=1.2022.40
PKG_VERSION:=1.2023.41
PKG_RELEASE:=1
LUCI_TITLE:=LuCI for smartdns

View File

@ -37,6 +37,20 @@ end
function act_status()
local e={}
local ipv6_server;
local dnsmasq_server = smartdns.get_config_option("dhcp", "dnsmasq", "server", {nil})[1]
local auto_set_dnsmasq = smartdns.get_config_option("smartdns", "smartdns", "auto_set_dnsmasq", nil);
e.auto_set_dnsmasq = auto_set_dnsmasq
e.dnsmasq_server = dnsmasq_server
e.local_port = smartdns.get_config_option("smartdns", "smartdns", "port", nil);
if e.local_port ~= nil and e.local_port ~= "53" and auto_set_dnsmasq ~= nil and auto_set_dnsmasq == "1" then
local str;
str = "127.0.0.1#" .. e.local_port
if dnsmasq_server ~= str then
e.dnsmasq_redirect_failure = 1
end
end
e.running = is_running()
luci.http.prepare_content("application/json")
luci.http.write_json(e)

View File

@ -34,6 +34,8 @@ s.anonymous = true
s:tab("settings", translate("General Settings"))
s:tab("advanced", translate('Advanced Settings'))
s:tab("seconddns", translate("Second Server Settings"))
s:tab("dns64", translate("DNS64 Server Settings"))
s:tab("proxy", translate("Proxy Server Settings"))
s:tab("custom", translate("Custom Settings"))
---- Eanble
@ -55,6 +57,14 @@ o.default = 53
o.datatype = "port"
o.rempty = false
-- Automatically Set Dnsmasq
o = s:taboption("settings", Flag, "auto_set_dnsmasq", translate("Automatically Set Dnsmasq"), translate("Automatically set as upstream of dnsmasq when port changes."))
o.rmempty = false
o.default = o.enabled
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "0"
end
---- Speed check mode;
o = s:taboption("advanced", Value, "speed_check_mode", translate("Speed Check Mode"), translate("Smartdns speed check mode."));
o.rmempty = true;
@ -101,6 +111,16 @@ function o.validate (section_id, value)
return value
end
---- response mode;
o = s:taboption("advanced", ListValue, "response_mode", translate("Response Mode"),
translate("Smartdns response mode, First Ping: return the first ping IP, Fastest IP: return the fastest IP, Fastest Response: return the fastest DNS response."))
o.rmempty = true
o.placeholder = "default"
o:value("", translate("default"))
o:value("first-ping", translate("First Ping"))
o:value("fastest-ip", translate("Fastest IP"))
o:value("fastest-response", translate("Fastest Response"))
---- Enable TCP server
o = s:taboption("advanced", Flag, "tcp_server", translate("TCP Server"), translate("Enable TCP DNS Server"))
o.rmempty = false
@ -117,6 +137,20 @@ o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end
---- bind to device;
o = s:taboption("advanced", Flag, "bind_device", translate("Bind Device"), translate("Listen only on the specified interfaces."))
o.rmempty = false
o.default = o.enabled
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end
---- bind device name;
o = s:taboption("advanced", Value, "bind_device_name", translate("Bind Device Name"), translate("Name of device name listen on."))
o.placeholder = "default"
o.rempty = true
o.datatype = "string"
---- Support DualStack ip selection
o = s:taboption("advanced", Flag, "dualstack_ip_selection", translate("Dual-stack IP Selection"), translate("Enable IP selection between IPV4 and IPV6"))
o.rmempty = false
@ -146,6 +180,14 @@ end
o = s:taboption("advanced", Value, "cache_size", translate("Cache Size"), translate("DNS domain result cache size"))
o.rempty = true
---- cache-persist;
o = s:taboption("advanced", Flag, "cache_persist", translate("Cache Persist"), translate("Write cache to disk on exit and load on startup."))
o.rmempty = false;
o.default = o.enabled;
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end
-- cache-size
o = s:taboption("advanced", Flag, "resolve_local_hostnames", translate("Resolve Local Hostnames"), translate("Resolve local hostnames by reading Dnsmasq lease file."))
o.rmempty = false
@ -154,14 +196,6 @@ o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end
-- Automatically Set Dnsmasq
o = s:taboption("advanced", Flag, "auto_set_dnsmasq", translate("Automatically Set Dnsmasq"), translate("Automatically set as upstream of dnsmasq when port changes."))
o.rmempty = false
o.default = o.enabled
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "0"
end
-- Force AAAA SOA
o = s:taboption("advanced", Flag, "force_aaaa_soa", translate("Force AAAA SOA"), translate("Force AAAA SOA."))
o.rmempty = false
@ -178,6 +212,31 @@ o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "1"
end
---- Ipset no speed.
o = s:taboption("advanced", Value, "ipset_no_speed", translate("No Speed IPset Name"),
translate("Ipset name, Add domain result to ipset when speed check fails."));
o.rmempty = true;
o.datatype = "hostname";
o.rempty = true;
---- NFTset no speed.
o = s:taboption("advanced", Value, "nftset_no_speed", translate("No Speed NFTset Name"),
translate("Nftset name, Add domain result to nftset when speed check fails, format: [#[4|6]:[family#table#set]]"));
o.rmempty = true;
o.datatype = "string";
o.rempty = true;
function o.validate(self, value)
if (value == "") then
return value
end
if (value:match("#[4|6]:[a-zA-Z0-9%-_]+#[a-zA-Z0-9%-_]+#[a-zA-Z0-9%-_]+$")) then
return value
end
return nil, translate("NFTset name format error, format: [#[4|6]:[family#table#set]]")
end
---- rr-ttl
o = s:taboption("advanced", Value, "rr_ttl", translate("Domain TTL"), translate("TTL for all domain result."))
o.rempty = true
@ -298,6 +357,27 @@ o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "0"
end
----- Proxy server settings
o = s:taboption("proxy", Value, "proxy_server", translate("Proxy Server"), translate("Proxy Server URL, format: [socks5|http]://user:pass@ip:port."));
o.datatype = 'string';
function o.validate(self, value)
if (value == "") then
return true
end
if (not value:match("^http://") and not value:match("^socks5://")) then
return nil, translate("Proxy server URL format error, format: [socks5|http]://user:pass@ip:port.")
end
return value
end
----- dns64 server settings
o = s:taboption("dns64", Value, "dns64", translate("DNS64"));
o.placeholder = "64:ff9b::/96"
o.datatype = 'ip6addr'
o.rmempty = true
----- custom settings
custom = s:taboption("custom", Value, "Custom Settings",
translate(""),
@ -332,7 +412,7 @@ s.template = "cbi/tblsection"
s.extedit = luci.dispatcher.build_url("admin/services/smartdns/upstream/%s")
---- enable flag
o = s:option(Flag, "enabled", translate("Enable"), translate("Enable"))
o = s:option(Flag, "enabled", translate("Enable"))
o.rmempty = false
o.default = o.enabled
o.cfgvalue = function(...)
@ -340,14 +420,14 @@ o.cfgvalue = function(...)
end
---- name
s:option(Value, "name", translate("DNS Server Name"), translate("DNS Server Name"))
s:option(Value, "name", translate("DNS Server Name"))
---- IP address
o = s:option(Value, "ip", translate("ip"), translate("DNS Server ip"))
o = s:option(Value, "ip", translate("DNS Server ip"))
o.datatype = "or(ipaddr, string)"
o.rmempty = false
---- port
o = s:option(Value, "port", translate("port"), translate("DNS Server port"))
o = s:option(Value, "port", translate("DNS Server port"))
o.placeholder = "default"
o.datatype = "port"
o.rempty = true
@ -356,7 +436,7 @@ o:depends("type", "tcp")
o:depends("type", "tls")
---- type
o = s:option(ListValue, "type", translate("type"), translate("DNS Server type"))
o = s:option(ListValue, "type", translate("DNS Server type"))
o.placeholder = "udp"
o:value("udp", translate("udp"))
o:value("tcp", translate("tcp"))
@ -567,11 +647,11 @@ s.anonymous = true
s.addremove = true
s.template = "cbi/tblsection"
o = s:option(Value, 'name', translate('File Name'), translate('File Name'))
o = s:option(Value, 'name', translate('File Name'))
o.rmempty = false
o.datatype = 'string'
o = s:option(Value, 'url', translate('URL'), translate('URL'))
o = s:option(Value, 'url', translate('URL'))
o.rmempty = false
o.datatype = 'string'
function o.validate(self, value, section)
@ -594,13 +674,13 @@ function o.validate(self, value, section)
return nil, translate("URL format error, format: http:// or https://")
end
o = s:option(ListValue, "type", translate("type"), translate("File Type"))
o = s:option(ListValue, "type", translate("File Type"))
o:value("list", translate("domain list (/etc/smartdns/domain-set)"))
o:value("config", translate("smartdns config (/etc/smartdns/conf.d)"))
o.default = "list"
o.rempty = false
o = s:option(Value, 'desc', translate('Description'), translate('Description'))
o = s:option(Value, 'desc', translate('Description'))
o.rmempty = true
o.datatype = 'string'

View File

@ -133,6 +133,23 @@ o.default = ""
o.rempty = true
o.datatype = "uinteger"
---- use proxy
o = s:option(Flag, "use_proxy", translate("Use Proxy"), translate("Use proxy to connect to upstream DNS server."))
o.rmempty = true
o.default = o.disabled
o.cfgvalue = function(...)
return Flag.cfgvalue(...) or "0"
end
function o.validate(self, value, section)
if value == "1" then
local proxy = m.uci:get_first("smartdns", "smartdns", "proxy_server")
if proxy == nil or proxy == "" then
return nil, translate("Please set proxy server first.")
end
end
return value
end
---- other args
o = s:option(Value, "addition_arg", translate("Additional Server Args"), translate("Additional Args for upstream dns servers"))
o.default = ""

View File

@ -7,7 +7,7 @@ XHR.poll(3, '<%=luci.dispatcher.build_url("admin", "services", "smartdns", "stat
if (data.running) {
links = '<b><font color=green>SmartDNS - <%:RUNNING%></font></b></em>';
if (data.dnsmasq_redirect_failure == 1) {
links += "<br></br><b><font color=red><%:Dnsmasq Forwared To Smartdns Failure%></font></b>"
links += "<br></br><b><font color=red><%:Dnsmasq Forwarded To Smartdns Failure%></font></b>"
}
} else {
links = '<b><font color=red>SmartDNS - <%:NOT RUNNING%></font></b>';

View File

@ -25,6 +25,15 @@ msgstr "自动设置Dnsmasq"
msgid "Automatically set as upstream of dnsmasq when port changes."
msgstr "自动设置为Dnsmasq的上游服务器"
msgid "Bind Device"
msgstr "绑定到设备"
msgid "Bind Device Name"
msgstr "绑定的设备名称"
msgid "Cache Persist"
msgstr "持久化缓存"
msgid "Cache Size"
msgstr "缓存大小"
@ -73,6 +82,9 @@ msgstr "协议类型"
msgid "DNS domain result cache size"
msgstr "缓存DNS的结果缓存大小配置零则不缓存"
msgid "DNS64 Server Settings"
msgstr "DNS64服务器配置"
msgid "Description"
msgstr "描述"
@ -171,6 +183,15 @@ msgstr "文件类型"
msgid "Filtering IP with blacklist"
msgstr "使用IP黑名单过滤"
msgid "First Ping"
msgstr "最快PING"
msgid "Fastest IP"
msgstr "最快IP"
msgid "Fastest Response"
msgstr "最快响应"
msgid "Force AAAA SOA"
msgstr "停用IPV6地址解析"
@ -213,6 +234,12 @@ msgstr "IPSet名称"
msgid "IPset name."
msgstr "IPSet名称。"
msgid "Ipset name, Add domain result to ipset when speed check fails."
msgstr "IPset名称当测速失败时将查询到的结果添加到对应的IPSet集合中。"
msgid "ipset name format error, format: [#[4|6]:]ipsetname"
msgstr "IPset名称格式错误格式[#[4|6]:]ipsetname"
msgid "If you like this software, please buy me a cup of coffee."
msgstr "如果本软件对你有帮助,请给作者加个蛋。"
@ -227,6 +254,9 @@ msgstr "包含配置文件,路径为/etc/smartdns/conf.d或自定义配置
msgid "List of files to download."
msgstr "下载的文件列表。"
msgid "Listen only on the specified interfaces."
msgstr "监听在指定的设备上避免非本地网络的DNS查询请求。"
msgid "Local Port"
msgstr "本地端口"
@ -242,6 +272,9 @@ msgstr "所有域名的最大 TTL 值。"
msgid "Minimum TTL for all domain result."
msgstr "所有域名的最小 TTL 值。"
msgid "Name of device name listen on."
msgstr "绑定的设备名称。"
msgid "NFTset Name"
msgstr "NFTSet名称"
@ -251,12 +284,36 @@ msgstr "NFTSet名称格式错误格式[#[4|6]:[family#table#set]]"
msgid "NFTset name, format: [#[4|6]:[family#table#set]]"
msgstr "NFTSet名称格式[#[4|6]:[family#table#set]]"
msgid "Nftset name, Add domain result to nftset when speed check fails, format: [#[4|6]:[family#table#set]]"
msgstr "NFTset名称当测速失败时将查询到的结果添加到对应的NFTSet集合中。"
msgid "No Speed IPset Name"
msgstr "无速度时IPSet名称"
msgid "No Speed NFTset Name"
msgstr "无速度时NFTSet名称"
msgid "NOT RUNNING"
msgstr "未运行"
msgid "No check certificate"
msgstr "停用证书校验"
msgid "Please set proxy server first."
msgstr "请先设置代理服务器。"
msgid "Proxy Server"
msgstr "代理服务器"
msgid "Proxy Server URL, format: [socks5|http]://user:pass@ip:port."
msgstr "代理服务器地址,格式:[socks5|http]://user:pass@ip:port。"
msgid "Proxy server URL format error, format: [socks5|http]://user:pass@ip:port."
msgstr "代理服务器地址格式错误,格式:[socks5|http]://user:pass@ip:port。"
msgid "Proxy Server Settings"
msgstr "代理服务器设置"
msgid "Query DNS through specific dns server group, such as office, home."
msgstr "使用指定服务器组查询比如office, home。"
@ -281,6 +338,9 @@ msgstr "重启"
msgid "Restart smartdns"
msgstr "重启服务"
msgid "Response Mode"
msgstr "响应模式"
msgid "Second Server Settings"
msgstr "第二DNS服务器"
@ -390,6 +450,14 @@ msgstr "测速模式"
msgid "Smartdns speed check mode. "
msgstr "SmartDns测速模式设置。"
msgid ""
"Smartdns response mode, First Ping: return the first ping IP, "
"Fastest IP: return the fastest IP, Fastest Response: return the fastest "
"DNS response."
msgstr ""
"SmartDNS响应模式最快PING 返回最早有ping结果的IP速度适中最快IP "
"返回最快IP查询请求可能延长 最快响应:返回最快响应的结果。查询请求时间短。"
msgid ""
"Specify an IP address to return for any host in the given domains, Queries "
"in the domains are never forwarded and always replied to with the specified "
@ -419,6 +487,12 @@ msgstr "设置所有域名的 TTL 值。"
msgid "Technical Support"
msgstr "技术支持"
msgid "Use Proxy"
msgstr "使用代理"
msgid "Use proxy to connect to upstream DNS server."
msgstr "使用代理连接上游DNS服务器。"
msgid "URL"
msgstr "URL"
@ -469,6 +543,9 @@ msgstr ""
"用于校验 TLS 服务器的有效性,数值为 Base64 编码的 SPKI 指纹,留空表示不验证 "
"TLS 的合法性。"
msgid "Write cache to disk on exit and load on startup."
msgstr "退出时保存cache到磁盘启动时加载。"
msgid "domain list (/etc/smartdns/domain-set)"
msgstr "域名列表(/etc/smartdns/domain-set"