From 140962d657463098b22d80e59c936c4c7a074f9b Mon Sep 17 00:00:00 2001 From: Nick Peng Date: Thu, 30 Jan 2020 13:44:57 +0800 Subject: [PATCH] luci-app-smartdns: add new package Signed-off-by: Nick Peng --- applications/luci-app-smartdns/Makefile | 26 ++ .../luasrc/controller/smartdns.lua | 86 +++++ .../luasrc/model/cbi/smartdns/smartdns.lua | 331 ++++++++++++++++++ .../luasrc/model/cbi/smartdns/upstream.lua | 123 +++++++ .../luasrc/model/smartdns.lua | 26 ++ .../luasrc/view/smartdns/smartdns_status.htm | 41 +++ .../luci-app-smartdns/po/zh-cn/smartdns.po | 282 +++++++++++++++ .../root/etc/uci-defaults/50_luci-smartdns | 13 + 8 files changed, 928 insertions(+) create mode 100644 applications/luci-app-smartdns/Makefile create mode 100644 applications/luci-app-smartdns/luasrc/controller/smartdns.lua create mode 100644 applications/luci-app-smartdns/luasrc/model/cbi/smartdns/smartdns.lua create mode 100644 applications/luci-app-smartdns/luasrc/model/cbi/smartdns/upstream.lua create mode 100644 applications/luci-app-smartdns/luasrc/model/smartdns.lua create mode 100644 applications/luci-app-smartdns/luasrc/view/smartdns/smartdns_status.htm create mode 100644 applications/luci-app-smartdns/po/zh-cn/smartdns.po create mode 100644 applications/luci-app-smartdns/root/etc/uci-defaults/50_luci-smartdns diff --git a/applications/luci-app-smartdns/Makefile b/applications/luci-app-smartdns/Makefile new file mode 100644 index 000000000000..60924fdc03f9 --- /dev/null +++ b/applications/luci-app-smartdns/Makefile @@ -0,0 +1,26 @@ +# +# Copyright 2018-2020 Nick Peng +# Licensed to the public under the GPL V3 License. + +include $(TOPDIR)/rules.mk + +PKG_LICENSE:=GPL-3.0-or-later +PKG_MAINTAINER:=Nick Peng +PKG_VERSION:=1.2019.28 +PKG_RELEASE:=1 + +LUCI_TITLE:=LuCI for smartdns +LUCI_DESCRIPTION:=Provides Luci for smartdns +LUCI_DEPENDS:=+luci-compat +smartdns +LUCI_PKGARCH:=all + +define Package/$(PKG_NAME)/config +# shown in make menuconfig +help + $(LUCI_TITLE) + Version: $(PKG_VERSION)-$(PKG_RELEASE) +endef + +include ../../luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/applications/luci-app-smartdns/luasrc/controller/smartdns.lua b/applications/luci-app-smartdns/luasrc/controller/smartdns.lua new file mode 100644 index 000000000000..5ab48b4e2aa6 --- /dev/null +++ b/applications/luci-app-smartdns/luasrc/controller/smartdns.lua @@ -0,0 +1,86 @@ +-- +-- Copyright (C) 2018-2020 Ruilin Peng (Nick) . +-- +-- smartdns is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- smartdns is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +module("luci.controller.smartdns", package.seeall) + +local smartdns = require("luci.model.smartdns") +local http = require ("luci.http") +local sys = require ("luci.sys") + +function index() + if not nixio.fs.access("/etc/config/smartdns") then + return + end + + local page + page = entry({"admin", "services", "smartdns"}, cbi("smartdns/smartdns"), _("SmartDNS"), 60) + page.dependent = true + page = entry({"admin", "services", "smartdns", "status"}, call("act_status")) + page.leaf = true + page = entry({"admin", "services", "smartdns", "upstream"}, cbi("smartdns/upstream"), nil) + page.leaf = true +end + +local function is_running() + return sys.call("pidof smartdns >/dev/null") == 0 +end + +function act_status() + local e={} + local ipv6_server; + local redirect_mode="none"; + + e.ipv6_works = 2; + e.ipv4_works = 2; + e.ipv6_server = 1; + e.dnsmasq_forward = 0; + redirect_mode = smartdns.get_config_option("smartdns", "smartdns", "redirect", nil); + if redirect_mode == "redirect" then + e.redirect = 1 + elseif redirect_mode == "dnsmasq-upstream" then + e.redirect = 2 + else + e.redirect = 0 + end + + e.local_port = smartdns.get_config_option("smartdns", "smartdns", "port", nil); + ipv6_server = smartdns.get_config_option("smartdns", "smartdns", "ipv6_server", nil); + if e.redirect == 1 then + if e.local_port ~= nil and e.local_port ~= "53" then + e.ipv4_works = sys.call("iptables -t nat -nL PREROUTING 2>/dev/null | grep REDIRECT | grep dpt:53 | grep %q >/dev/null 2>&1" % e.local_port) == 0 + if ipv6_server == "1" then + e.ipv6_works = sys.call("ip6tables -t nat -nL PREROUTING 2>/dev/null| grep REDIRECT | grep dpt:53 | grep %q >/dev/null 2>&1" % e.local_port) == 0 + else + e.ipv6_works = 2 + end + else + e.redirect = 0 + end + elseif e.redirect == 2 then + local str; + local dnsmasq_server = sys.exec("uci get dhcp.@dnsmasq[0].server") + if e.local_port ~= nil then + str = "127.0.0.1#" .. e.local_port + if string.sub(dnsmasq_server,1,string.len(str)) == str then + e.dnsmasq_forward = 1 + end + end + end + e.running = is_running() + + http.prepare_content("application/json") + http.write_json(e) +end diff --git a/applications/luci-app-smartdns/luasrc/model/cbi/smartdns/smartdns.lua b/applications/luci-app-smartdns/luasrc/model/cbi/smartdns/smartdns.lua new file mode 100644 index 000000000000..1565bc8d149f --- /dev/null +++ b/applications/luci-app-smartdns/luasrc/model/cbi/smartdns/smartdns.lua @@ -0,0 +1,331 @@ +-- +-- Copyright (C) 2018-2020 Ruilin Peng (Nick) . +-- +-- smartdns is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- smartdns is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +local m, s, o +local custom, addr + +local fs = require ("nixio.fs") +local http = require ("luci.http") +local dispatcher = require ("luci.dispatcher") + +m = Map("smartdns") +m.title = translate("SmartDNS Server") +m.description = translate("SmartDNS is a local high-performance DNS server, supports finding fastest IP, supports ad filtering, and supports avoiding DNS poisoning.") + +m:section(SimpleSection).template = "smartdns/smartdns_status" + +-- Basic +s = m:section(TypedSection, "smartdns", translate("Settings"), translate("General Settings")) +s.anonymous = true + +s:tab("settings", translate("General Settings")) +s:tab("seconddns", translate("Second Server Settings")) +s:tab("custom", translate("Custom Settings")) + +---- Eanble +o = s:taboption("settings", Flag, "enabled", translate("Enable"), translate("Enable or disable smartdns server")) +o.default = o.disabled +o.rempty = false + +---- server name +o = s:taboption("settings", Value, "server_name", translate("Server Name"), translate("Smartdns server name")) +o.placeholder = "smartdns" +o.datatype = "hostname" +o.rempty = true + +---- Port +o = s:taboption("settings", Value, "port", translate("Local Port"), translate("Smartdns local server port")) +o.placeholder = 6053 +o.default = 6053 +o.datatype = "port" +o.rempty = false + +---- Enable TCP server +o = s:taboption("settings", Flag, "tcp_server", translate("TCP Server"), translate("Enable TCP DNS Server")) +o.rmempty = false +o.default = o.enabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "1" +end + +---- Support IPV6 +o = s:taboption("settings", Flag, "ipv6_server", translate("IPV6 Server"), translate("Enable IPV6 DNS Server")) +o.rmempty = false +o.default = o.enabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "1" +end + +---- Support DualStack ip selection +o = s:taboption("settings", Flag, "dualstack_ip_selection", translate("Dual-stack IP Selection"), translate("Enable IP selection between IPV4 and IPV6")) +o.rmempty = false +o.default = o.disabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "0" +end + +---- Domain prefetch load +o = s:taboption("settings", Flag, "prefetch_domain", translate("Domain prefetch"), translate("Enable domain prefetch, accelerate domain response speed.")) +o.rmempty = false +o.default = o.disabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "0" +end + +---- Redirect +o = s:taboption("settings", ListValue, "redirect", translate("Redirect"), translate("SmartDNS redirect mode")) +o.placeholder = "none" +o:value("none", translate("none")) +o:value("dnsmasq-upstream", translate("Run as dnsmasq upstream server")) +o:value("redirect", translate("Redirect 53 port to SmartDNS")) +o.default = "none" +o.rempty = false + +---- cache-size +o = s:taboption("settings", Value, "cache_size", translate("Cache Size"), translate("DNS domain result cache size")) +o.rempty = true + +---- rr-ttl +o = s:taboption("settings", Value, "rr_ttl", translate("Domain TTL"), translate("TTL for all domain result.")) +o.rempty = true + +---- rr-ttl-min +o = s:taboption("settings", Value, "rr_ttl_min", translate("Domain TTL Min"), translate("Minimum TTL for all domain result.")) +o.rempty = true +o.placeholder = "300" +o.default = 300 +o.optional = true + +---- second dns server +---- rr-ttl-max +o = s:taboption("settings", Value, "rr_ttl_max", translate("Domain TTL Max"), translate("Maximum TTL for all domain result.")) +o.rempty = true + +---- Eanble +o = s:taboption("seconddns", Flag, "seconddns_enabled", translate("Enable"), translate("Enable or disable second DNS server.")) +o.default = o.disabled +o.rempty = false + +---- Port +o = s:taboption("seconddns", Value, "seconddns_port", translate("Local Port"), translate("Smartdns local server port")) +o.placeholder = 7053 +o.default = 7053 +o.datatype = "port" +o.rempty = false + +---- Enable TCP server +o = s:taboption("seconddns", Flag, "seconddns_tcp_server", translate("TCP Server"), translate("Enable TCP DNS Server")) +o.rmempty = false +o.default = o.enabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "1" +end + +o = s:taboption("seconddns", Flag, "seconddns_no_speed_check", translate("Skip Speed Check"), translate("Do not check speed.")) +o.rmempty = false +o.default = o.disabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "0" +end + +---- dns server group +o = s:taboption("seconddns", Value, "seconddns_server_group", translate("Server Group"), translate("Query DNS through specific dns server group, such as office, home.")) +o.rmempty = true +o.placeholder = "default" +o.datatype = "hostname" +o.rempty = true + +---- skip address rules +o = s:taboption("seconddns", Flag, "seconddns_no_rule_addr", translate("Skip Address Rules"), translate("Skip address rules.")) +o.rmempty = false +o.default = o.disabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "0" +end + +---- skip name server rules +o = s:taboption("seconddns", Flag, "seconddns_no_rule_nameserver", translate("Skip Nameserver Rule"), translate("Skip nameserver rules.")) +o.rmempty = false +o.default = o.disabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "0" +end + +---- skip ipset rules +o = s:taboption("seconddns", Flag, "seconddns_no_rule_ipset", translate("Skip Ipset Rule"), translate("Skip ipset rules.")) +o.rmempty = false +o.default = o.disabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "0" +end + +---- skip soa address rule +o = s:taboption("seconddns", Flag, "seconddns_no_rule_soa", translate("Skip SOA Address Rule"), translate("Skip SOA address rules.")) +o.rmempty = false +o.default = o.disabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "0" +end + +o = s:taboption("seconddns", Flag, "seconddns_no_dualstack_selection", translate("Skip Dualstack Selection"), translate("Skip Sualstack Selection.")) +o.rmempty = false +o.default = o.disabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "0" +end + +---- skip cache +o = s:taboption("seconddns", Flag, "seconddns_no_cache", translate("Skip Cache"), translate("Skip Cache.")) +o.rmempty = false +o.default = o.disabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "0" +end + +----- custom settings +custom = s:taboption("custom", Value, "Custom Settings", + translate(""), + translate("smartdns custom settings")) + +custom.template = "cbi/tvalue" +custom.rows = 20 + +function custom.cfgvalue(self, section) + return fs.readfile("/etc/smartdns/custom.conf") +end + +function custom.write(self, section, value) + value = value:gsub("\r\n?", "\n") + fs.writefile("/etc/smartdns/custom.conf", value) +end + +o = s:taboption("custom", Flag, "coredump", translate("Generate Coredump"), translate("Generate Coredump file when smartdns crash, coredump file is located at /tmp/smartdns.xxx.core.")) +o.rmempty = false +o.default = o.disabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "0" +end + +-- Upstream servers +s = m:section(TypedSection, "server", translate("Upstream Servers"), translate("Upstream Servers, support UDP, TCP protocol. " .. + "Please configure multiple DNS servers, including multiple foreign DNS servers.")) + +s.anonymous = true +s.addremove = true +s.template = "cbi/tblsection" +s.extedit = dispatcher.build_url("admin/services/smartdns/upstream/%s") + +---- enable flag +o = s:option(Flag, "enabled", translate("Enable"), translate("Enable")) +o.rmempty = false +o.default = o.enabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "1" +end + +---- name +s:option(Value, "name", translate("DNS Server Name"), translate("DNS Server Name")) + +---- IP address +o = s:option(Value, "ip", translate("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.placeholder = "default" +o.datatype = "port" +o.rempty = true +o:depends("type", "udp") +o:depends("type", "tcp") +o:depends("type", "tls") + +---- type +o = s:option(ListValue, "type", translate("type"), translate("DNS Server type")) +o.placeholder = "udp" +o:value("udp", translate("udp")) +o:value("tcp", translate("tcp")) +o:value("tls", translate("tls")) +o:value("https", translate("https")) +o.default = "udp" +o.rempty = false + +-- Domain Address +s = m:section(TypedSection, "smartdns", translate("Domain Address"), + translate("Set Specific domain ip address.")) +s.anonymous = true + +---- address +addr = s:option(Value, "address", + translate(""), + translate("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 IP address which may be IPv4 or IPv6.")) + +addr.template = "cbi/tvalue" +addr.rows = 20 + +function addr.cfgvalue(self, section) + return fs.readfile("/etc/smartdns/address.conf") +end + +function addr.write(self, section, value) + value = value:gsub("\r\n?", "\n") + fs.writefile("/etc/smartdns/address.conf", value) +end + +-- IP Blacklist +s = m:section(TypedSection, "smartdns", translate("IP Blacklist"), + translate("Set Specific ip blacklist.")) +s.anonymous = true + +---- blacklist +addr = s:option(Value, "blacklist_ip", + translate(""), + translate("Configure IP blacklists that will be filtered from the results of specific DNS server.")) + +addr.template = "cbi/tvalue" +addr.rows = 20 + +function addr.cfgvalue(self, section) + return fs.readfile("/etc/smartdns/blacklist-ip.conf") +end + +function addr.write(self, section, value) + value = value:gsub("\r\n?", "\n") + fs.writefile("/etc/smartdns/blacklist-ip.conf", value) +end + +-- Technical Support +s = m:section(TypedSection, "smartdns", translate("Technical Support"), + translate("If you like this software, please buy me a cup of coffee.")) +s.anonymous = true + +o = s:option(Button, "web") +o.title = translate("SmartDNS official website") +o.inputtitle = translate("open website") +o.inputstyle = "apply" +o.write = function() + http.redirect("https://pymumu.github.io/smartdns") +end + +o = s:option(Button, "Donate") +o.title = translate("Donate to smartdns") +o.inputtitle = translate("Donate") +o.inputstyle = "apply" +o.write = function() + http.redirect("https://pymumu.github.io/smartdns/#donate") +end + +return m + diff --git a/applications/luci-app-smartdns/luasrc/model/cbi/smartdns/upstream.lua b/applications/luci-app-smartdns/luasrc/model/cbi/smartdns/upstream.lua new file mode 100644 index 000000000000..40d83afbc6ef --- /dev/null +++ b/applications/luci-app-smartdns/luasrc/model/cbi/smartdns/upstream.lua @@ -0,0 +1,123 @@ +-- +-- Copyright (C) 2018-2020 Ruilin Peng (Nick) . +-- +-- smartdns is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- smartdns is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +local m, s, o + +local http = require ("luci.http") +local sid = arg[1] + +m = Map("smartdns", "%s - %s" %{translate("SmartDNS Server"), translate("Upstream DNS Server Configuration")}) +m.redirect = luci.dispatcher.build_url("admin/services/smartdns") + +if m.uci:get("smartdns", sid) ~= "server" then + http.redirect(m.redirect) + return +end + +-- [[ Edit Server ]]-- +s = m:section(NamedSection, sid, "server") +s.anonymous = true +s.addremove = false + +---- name +s:option(Value, "name", translate("DNS Server Name"), translate("DNS Server Name")) + +---- IP address +o = s:option(Value, "ip", translate("ip"), translate("DNS Server ip")) +o.datatype = "or(host, string)" +o.rmempty = false +---- port +o = s:option(Value, "port", translate("port"), translate("DNS Server port")) +o.placeholder = "default" +o.datatype = "port" +o.rempty = true +o:depends("type", "udp") +o:depends("type", "tcp") +o:depends("type", "tls") + +---- type +o = s:option(ListValue, "type", translate("type"), translate("DNS Server type")) +o.placeholder = "udp" +o:value("udp", translate("udp")) +o:value("tcp", translate("tcp")) +o:value("tls", translate("tls")) +o:value("https", translate("https")) +o.default = "udp" +o.rempty = false + +---- TLS host verify +o = s:option(Value, "tls_host_verify", translate("TLS Hostname Verify"), translate("Set TLS hostname to verify.")) +o.default = "" +o.datatype = "string" +o.rempty = true +o:depends("type", "tls") +o:depends("type", "https") + +---- SNI host name +o = s:option(Value, "host_name", translate("TLS SNI name"), translate("Sets the server name indication for query.")) +o.default = "" +o.datatype = "hostname" +o.rempty = true +o:depends("type", "tls") +o:depends("type", "https") + +---- http host +o = s:option(Value, "http_host", translate("HTTP Host"), translate("Set the HTTP host used for the query. Use this parameter when the host of the URL address is an IP address.")) +o.default = "" +o.datatype = "hostname" +o.rempty = true +o:depends("type", "https") + +---- server group +o = s:option(Value, "server_group", translate("Server Group"), translate("DNS Server group belongs to, used with nameserver, such as office, home.")) +o.rmempty = true +o.placeholder = "default" +o.datatype = "hostname" +o.rempty = true + +---- blacklist_ip +o = s:option(Flag, "blacklist_ip", translate("IP Blacklist Filtering"), translate("Filtering IP with blacklist")) +o.rmempty = false +o.default = o.disabled +o.cfgvalue = function(...) + return Flag.cfgvalue(...) or "0" +end + +---- anti-Answer-Forgery +-- o = s:option(Flag, "check_edns", translate("Anti Answer Forgery"), translate("Anti answer forgery, if DNS does not work properly after enabling, please turn off this feature")) +-- o.rmempty = false +-- o.default = o.disabled +-- o:depends("type", "udp") +-- o.cfgvalue = function(...) +-- return Flag.cfgvalue(...) or "0" +-- end + +---- SPKI pin +o = s:option(Value, "spki_pin", translate("TLS SPKI Pinning"), translate("Used to verify the validity of the TLS server, The value is Base64 encoded SPKI fingerprint, leaving blank to indicate that the validity of TLS is not verified.")) +o.default = "" +o.datatype = "string" +o.rempty = true +o:depends("type", "tls") +o:depends("type", "https") + + +---- other args +o = s:option(Value, "addition_arg", translate("Additional Server Args"), translate("Additional Args for upstream dns servers")) +o.default = "" +o.rempty = true +o.optional = true + +return m \ No newline at end of file diff --git a/applications/luci-app-smartdns/luasrc/model/smartdns.lua b/applications/luci-app-smartdns/luasrc/model/smartdns.lua new file mode 100644 index 000000000000..9f6da4ecaf00 --- /dev/null +++ b/applications/luci-app-smartdns/luasrc/model/smartdns.lua @@ -0,0 +1,26 @@ +-- +-- Copyright (C) 2018-2020 Ruilin Peng (Nick) . +-- +-- smartdns is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- smartdns is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +local uci = require "luci.model.uci".cursor() + +module("luci.model.smartdns", package.seeall) + +function get_config_option(module, section, option, default) + return uci:get_first(module, section, option) or default +end + +return m + diff --git a/applications/luci-app-smartdns/luasrc/view/smartdns/smartdns_status.htm b/applications/luci-app-smartdns/luasrc/view/smartdns/smartdns_status.htm new file mode 100644 index 000000000000..c56dc207706a --- /dev/null +++ b/applications/luci-app-smartdns/luasrc/view/smartdns/smartdns_status.htm @@ -0,0 +1,41 @@ + + +
+

+ <%:Collecting data...%> +

+
diff --git a/applications/luci-app-smartdns/po/zh-cn/smartdns.po b/applications/luci-app-smartdns/po/zh-cn/smartdns.po new file mode 100644 index 000000000000..0d9579b1debd --- /dev/null +++ b/applications/luci-app-smartdns/po/zh-cn/smartdns.po @@ -0,0 +1,282 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8\n" + +msgid "SmartDNS" +msgstr "SmartDNS" + +msgid "SmartDNS is a local high-performance DNS server" +msgstr "SmartDNS是一个本地高性能DNS服务器" + +msgid "SmartDNS Server" +msgstr "SmartDNS 服务器" + +msgid "SmartDNS is a local high-performance DNS server, supports finding fastest IP, supports ad filtering, and supports avoiding DNS poisoning." +msgstr "SmartDNS是一个本地高性能DNS服务器,支持避免域名污染,支持返回最快IP,支持广告过滤。" + +msgid "Custom Settings" +msgstr "自定义设置" + +msgid "Generate Coredump" +msgstr "生成coredump" + +msgid "Generate Coredump file when smartdns crash, coredump file is located at /tmp/smartdns.xxx.core." +msgstr "当smartdns异常时生成coredump文件,coredump文件在/tmp/smartdns.xxx.core." + +msgid "Server Name" +msgstr "服务器名称" + +msgid "Smartdns server name" +msgstr "SmartDNS的服务器名称,默认为smartdns,留空为主机名" + +msgid "SmartDNS is a local dns server to find fastest ip." +msgstr "本地高性能服务器,优化网络访问性能。" + +msgid "Enable or disable smartdns server" +msgstr "启用或禁用SmartDNS服务" + +msgid "Local Port" +msgstr "本地端口" + +msgid "Smartdns local server port" +msgstr "SmartDNS本地服务端口" + +msgid "IPV4 53 Port Redirect Failure" +msgstr "IPV4 53端口重定向失败" + +msgid "IPV6 53 Port Redirect Failure" +msgstr "IPV6 53端口重定向失败" + +msgid "Dnsmasq Forwared To Smartdns Failure" +msgstr "重定向dnsmasq到smartdns失败" + +msgid "TCP Server" +msgstr "TCP服务器" + +msgid "Enable TCP DNS Server" +msgstr "启用TCP服务器" + +msgid "IPV6 Server" +msgstr "IPV6服务器" + +msgid "Enable IPV6 DNS Server" +msgstr "启用IPV6服务器" + +msgid "Dual-stack IP Selection" +msgstr "双栈IP优选" + +msgid "Enable IP selection between IPV4 and IPV6" +msgstr "启用或禁用IPV4,IPV6间的IP优选策略。" + +msgid "Domain prefetch" +msgstr "域名预加载" + +msgid "Enable domain prefetch, accelerate domain response speed." +msgstr "启用域名预加载,加速域名响应速度。" + +msgid "Redirect" +msgstr "重定向" + +msgid "SmartDNS redirect mode" +msgstr "SmartDNS 重定向模式" + +msgid "Run as dnsmasq upstream server" +msgstr "作为dnsmasq的上游服务器" + +msgid "Redirect 53 port to SmartDNS" +msgstr "重定向53端口到SmartDNS" + +msgid "Cache Size" +msgstr "缓存大小" + +msgid "DNS domain result cache size" +msgstr "缓存DNS的结果,缓存大小,配置零则不缓存" + +msgid "Domain TTL" +msgstr "域名TTL" + +msgid "TTL for all domain result." +msgstr "设置所有域名的TTL值" + +msgid "Domain TTL Min" +msgstr "域名TTL最小值" + +msgid "Minimum TTL for all domain result." +msgstr "设置所有域名的TTL最小值" + +msgid "Domain TTL Max" +msgstr "域名TTL最大值" + +msgid "Maximum TTL for all domain result." +msgstr "设置所有域名的TTL最大值" + +msgid "smartdns custom settings" +msgstr "smartdns 自定义设置,具体配置参数参考指导" + +msgid "Second Server Settings" +msgstr "第二DNS服务器" + +msgid "Enable or disable second DNS server." +msgstr "是否启用第二DNS服务器。" + +msgid "Skip Speed Check" +msgstr "跳过测速" + +msgid "Do not check speed." +msgstr "禁用测速。" + +msgid "Server Group" +msgstr "服务器组" + +msgid "Query DNS through specific dns server group, such as office, home." +msgstr "使用指定服务器组查询,比如office, home。" + +msgid "Skip Address Rules" +msgstr "跳过address规则" + +msgid "Skip address rules." +msgstr "跳过address规则。" + +msgid "Skip Nameserver Rule" +msgstr "跳过Nameserver规则" + +msgid "Skip nameserver rules." +msgstr "跳过Nameserver规则。" + +msgid "Skip Ipset Rule" +msgstr "跳过ipset规则" + +msgid "Skip ipset rules." +msgstr "跳过ipset规则。" + +msgid "Skip SOA Address Rule" +msgstr "跳过address SOA(#)规则" + +msgid "Skip SOA address rules." +msgstr "跳过address SOA(#)规则。" + +msgid "Skip Dualstack Selection" +msgstr "跳过双栈优选" + +msgid "Skip Sualstack Selection." +msgstr "跳过双栈优选。" + +msgid "Skip Cache" +msgstr "跳过cache" + +msgid "Skip Cache." +msgstr "跳过cache。" + +msgid "Upstream Servers" +msgstr "上游服务器" + +msgid "Upstream Servers, support UDP, TCP protocol. Please configure multiple DNS servers, including multiple foreign DNS servers." +msgstr "上游DNS服务器列表,支持UDP,TCP协议,请配置多个上游DNS服务器,包括多个国内外服务器" + +msgid "DNS Server Name" +msgstr "DNS服务器名称" + +msgid "port" +msgstr "端口" + +msgid "DNS Server port" +msgstr "DNS服务器端口" + +msgid "DNS Server ip" +msgstr "DNS服务器IP" + +msgid "type" +msgstr "类型" + +msgid "DNS Server type" +msgstr "协议类型" + +msgid "Domain Address" +msgstr "域名地址" + +msgid "TLS Hostname Verify" +msgstr "校验TLS主机名" + +msgid "Set TLS hostname to verify." +msgstr "设置校验TLS主机名。" + +msgid "TLS SNI name" +msgstr "TLS SNI名称" + +msgid "HTTP Host" +msgstr "HTTP主机" + +msgid "Sets the server name indication for query." +msgstr "设置查询时使用的服务器SNI名称。" + +msgid "Set the HTTP host used for the query. Use this parameter when the host of the URL address is an IP address." +msgstr "设置查询时使用的HTTP主机,当URL地址的host是IP地址时,使用此参数。" + +msgid "Server Group" +msgstr "服务器组" + +msgid "DNS Server group belongs to, used with nameserver, such as office, home." +msgstr "DNS服务器所属组, 配合nameserver使用,例如:office,home。" + +msgid "IP Blacklist Filtering" +msgstr "IP黑名单过滤" + +msgid "Anti Answer Forgery" +msgstr "反回答伪造" + +msgid "Anti answer forgery, if DNS does not work properly after enabling, please turn off this feature" +msgstr "反回答伪造,如果启用后DNS工作不正常,请关闭此功能。" + +msgid "Filtering IP with blacklist" +msgstr "使用IP黑名单过滤" + +msgid "TLS SPKI Pinning" +msgstr "TLS SPKI 指纹" + +msgid "Used to verify the validity of the TLS server, The value is Base64 encoded SPKI fingerprint, leaving blank to indicate that the validity of TLS is not verified." +msgstr "用于校验TLS服务器的有效性,数值为Base64编码的SPKI指纹, 留空表示不验证TLS的合法性" + +msgid "Additional Server Args" +msgstr "额外的服务器参数" + +msgid "Additional Args for upstream dns servers" +msgstr "额外的上游DNS服务器参数" + +msgid "Upstream DNS Server Configuration" +msgstr "上游DNS服务器配置" + +msgid "Set Specific domain ip address." +msgstr "指定特定域名的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 IP address which may be IPv4 or IPv6." +msgstr "配置特定域名返回特定的IP地址,域名查询将不到上游服务器请求,直接返回配置的IP地址,可用于广告屏蔽。" + +msgid "IP Blacklist" +msgstr "IP黑名单" + +msgid "Set Specific ip blacklist." +msgstr "设置IP黑名单列表" + +msgid "Configure IP blacklists that will be filtered from the results of specific DNS server." +msgstr "配置需要从指定域名服务器结果过滤的IP黑名单。" + +msgid "Technical Support" +msgstr "技术支持" + +msgid "If you like this software, please buy me a cup of coffee." +msgstr "如果本软件对你有帮助,请给作者加个蛋。" + +msgid "SmartDNS official website" +msgstr "SmartDNS官方网站" + +msgid "open website" +msgstr "打开网站" + +msgid "Donate to smartdns" +msgstr "捐助smartdns项目" + +msgid "Donate" +msgstr "捐助" + + + + diff --git a/applications/luci-app-smartdns/root/etc/uci-defaults/50_luci-smartdns b/applications/luci-app-smartdns/root/etc/uci-defaults/50_luci-smartdns new file mode 100644 index 000000000000..4e20c1dff851 --- /dev/null +++ b/applications/luci-app-smartdns/root/etc/uci-defaults/50_luci-smartdns @@ -0,0 +1,13 @@ +#!/bin/sh +# Copyright 2018-2020 Nick Peng +# Licensed to the public under the GPL V3 License. + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@smartdns[-1] + add ucitrack smartdns + set ucitrack.@smartdns[-1].init=smartdns + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0