├── Makefile ├── README.md ├── luasrc ├── controller │ └── smartdns.lua ├── model │ ├── cbi │ │ └── smartdns │ │ │ ├── smartdns.lua │ │ │ └── upstream.lua │ └── smartdns.lua └── view │ └── smartdns │ └── smartdns_status.htm ├── po └── zh-cn │ └── smartdns.zh-cn.po └── root └── etc └── uci-defaults └── 50_luci-smartdns /Makefile: -------------------------------------------------------------------------------- 1 | # This is free software, licensed under the Apache License, Version 2.0 . 2 | 3 | include $(TOPDIR)/rules.mk 4 | 5 | LUCI_TITLE:=Luci for smartdns server 6 | LUCI_DEPENDS:=+smartdns 7 | LUCI_PKGARCH:=all 8 | PKG_NAME:=luci-app-smartdns 9 | PKG_VERSION:=1 10 | PKG_RELEASE:=1 11 | 12 | include $(TOPDIR)/feeds/luci/luci.mk 13 | 14 | # call BuildPackage - OpenWrt buildroot signature 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # luci-app-smartdns 2 | From Lean 3 | -------------------------------------------------------------------------------- /luasrc/controller/smartdns.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright (C) 2018-2020 Ruilin Peng (Nick) . 3 | -- 4 | -- smartdns is free software: you can redistribute it and/or modify 5 | -- it under the terms of the GNU General Public License as published by 6 | -- the Free Software Foundation, either version 3 of the License, or 7 | -- (at your option) any later version. 8 | -- 9 | -- smartdns is distributed in the hope that it will be useful, 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | -- GNU General Public License for more details. 13 | -- 14 | -- You should have received a copy of the GNU General Public License 15 | -- along with this program. If not, see . 16 | 17 | module("luci.controller.smartdns", package.seeall) 18 | local smartdns = require "luci.model.smartdns" 19 | 20 | function index() 21 | if not nixio.fs.access("/etc/config/smartdns") then 22 | return 23 | end 24 | 25 | local page 26 | page = entry({"admin", "services", "smartdns"}, cbi("smartdns/smartdns"), _("SmartDNS"), 60) 27 | page.dependent = true 28 | page = entry({"admin", "services", "smartdns", "status"}, call("act_status")) 29 | page.leaf = true 30 | page = entry({"admin", "services", "smartdns", "upstream"}, cbi("smartdns/upstream"), nil) 31 | page.leaf = true 32 | end 33 | 34 | local function is_running() 35 | return luci.sys.call("pidof smartdns >/dev/null") == 0 36 | end 37 | 38 | function act_status() 39 | local e={} 40 | local ipv6_server; 41 | local redirect_mode="none"; 42 | 43 | e.ipv6_works = 2; 44 | e.ipv4_works = 2; 45 | e.ipv6_server = 1; 46 | e.dnsmasq_forward = 0; 47 | redirect_mode = smartdns.get_config_option("smartdns", "smartdns", "redirect", nil); 48 | if redirect_mode == "redirect" then 49 | e.redirect = 1 50 | elseif redirect_mode == "dnsmasq-upstream" then 51 | e.redirect = 2 52 | else 53 | e.redirect = 0 54 | end 55 | 56 | e.local_port = smartdns.get_config_option("smartdns", "smartdns", "port", nil); 57 | ipv6_server = smartdns.get_config_option("smartdns", "smartdns", "ipv6_server", nil); 58 | if e.redirect == 1 then 59 | if e.local_port ~= nil and e.local_port ~= "53" then 60 | e.ipv4_works = luci.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 61 | if ipv6_server == "1" then 62 | e.ipv6_works = luci.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 63 | else 64 | e.ipv6_works = 2 65 | end 66 | else 67 | e.redirect = 0 68 | end 69 | elseif e.redirect == 2 then 70 | local str; 71 | local dnsmasq_server = luci.sys.exec("uci get dhcp.@dnsmasq[0].server") 72 | if e.local_port ~= nil then 73 | str = "127.0.0.1#" .. e.local_port 74 | if string.sub(dnsmasq_server,1,string.len(str)) == str then 75 | e.dnsmasq_forward = 1 76 | end 77 | end 78 | end 79 | e.running = is_running() 80 | 81 | luci.http.prepare_content("application/json") 82 | luci.http.write_json(e) 83 | end 84 | -------------------------------------------------------------------------------- /luasrc/model/cbi/smartdns/smartdns.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright (C) 2018-2020 Ruilin Peng (Nick) . 3 | -- 4 | -- smartdns is free software: you can redistribute it and/or modify 5 | -- it under the terms of the GNU General Public License as published by 6 | -- the Free Software Foundation, either version 3 of the License, or 7 | -- (at your option) any later version. 8 | -- 9 | -- smartdns is distributed in the hope that it will be useful, 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | -- GNU General Public License for more details. 13 | -- 14 | -- You should have received a copy of the GNU General Public License 15 | -- along with this program. If not, see . 16 | 17 | require ("nixio.fs") 18 | require ("luci.http") 19 | require ("luci.dispatcher") 20 | require ("nixio.fs") 21 | 22 | m = Map("smartdns") 23 | m.title = translate("SmartDNS Server") 24 | m.description = translate("SmartDNS is a local high-performance DNS server, supports finding fastest IP, supports ad filtering, and supports avoiding DNS poisoning.") 25 | 26 | m:section(SimpleSection).template = "smartdns/smartdns_status" 27 | 28 | -- Basic 29 | s = m:section(TypedSection, "smartdns", translate("Settings"), translate("General Settings")) 30 | s.anonymous = true 31 | 32 | s:tab("settings", translate("General Settings")) 33 | s:tab("seconddns", translate("Second Server Settings")) 34 | s:tab("custom", translate("Custom Settings")) 35 | 36 | ---- Eanble 37 | o = s:taboption("settings", Flag, "enabled", translate("Enable"), translate("Enable or disable smartdns server")) 38 | o.default = o.disabled 39 | o.rempty = false 40 | 41 | ---- server name 42 | o = s:taboption("settings", Value, "server_name", translate("Server Name"), translate("Smartdns server name")) 43 | o.default = "smartdns" 44 | o.datatype = "hostname" 45 | o.rempty = false 46 | 47 | ---- Port 48 | o = s:taboption("settings", Value, "port", translate("Local Port"), translate("Smartdns local server port")) 49 | o.placeholder = 6053 50 | o.default = 6053 51 | o.datatype = "port" 52 | o.rempty = false 53 | 54 | ---- Enable TCP server 55 | o = s:taboption("settings", Flag, "tcp_server", translate("TCP Server"), translate("Enable TCP DNS Server")) 56 | o.rmempty = false 57 | o.default = o.enabled 58 | o.cfgvalue = function(...) 59 | return Flag.cfgvalue(...) or "1" 60 | end 61 | 62 | ---- Support IPV6 63 | o = s:taboption("settings", Flag, "ipv6_server", translate("IPV6 Server"), translate("Enable IPV6 DNS Server")) 64 | o.rmempty = false 65 | o.default = o.enabled 66 | o.cfgvalue = function(...) 67 | return Flag.cfgvalue(...) or "1" 68 | end 69 | 70 | ---- Support DualStack ip selection 71 | o = s:taboption("settings", Flag, "dualstack_ip_selection", translate("Dual-stack IP Selection"), translate("Enable IP selection between IPV4 and IPV6")) 72 | o.rmempty = false 73 | o.default = o.disabled 74 | o.cfgvalue = function(...) 75 | return Flag.cfgvalue(...) or "0" 76 | end 77 | 78 | ---- Domain prefetch load 79 | o = s:taboption("settings", Flag, "prefetch_domain", translate("Domain prefetch"), translate("Enable domain prefetch, accelerate domain response speed.")) 80 | o.rmempty = false 81 | o.default = o.disabled 82 | o.cfgvalue = function(...) 83 | return Flag.cfgvalue(...) or "0" 84 | end 85 | 86 | ---- Redirect 87 | o = s:taboption("settings", ListValue, "redirect", translate("Redirect"), translate("SmartDNS redirect mode")) 88 | o.placeholder = "none" 89 | o:value("none", translate("none")) 90 | o:value("dnsmasq-upstream", translate("Run as dnsmasq upstream server")) 91 | o:value("redirect", translate("Redirect 53 port to SmartDNS")) 92 | o.default = "none" 93 | o.rempty = false 94 | 95 | ---- cache-size 96 | o = s:taboption("settings", Value, "cache_size", translate("Cache Size"), translate("DNS domain result cache size")) 97 | o.rempty = true 98 | 99 | ---- rr-ttl 100 | o = s:taboption("settings", Value, "rr_ttl", translate("Domain TTL"), translate("TTL for all domain result.")) 101 | o.rempty = true 102 | 103 | ---- rr-ttl-min 104 | o = s:taboption("settings", Value, "rr_ttl_min", translate("Domain TTL Min"), translate("Minimum TTL for all domain result.")) 105 | o.rempty = true 106 | o.placeholder = "300" 107 | o.default = 300 108 | o.optional = true 109 | 110 | ---- second dns server 111 | ---- rr-ttl-max 112 | o = s:taboption("settings", Value, "rr_ttl_max", translate("Domain TTL Max"), translate("Maximum TTL for all domain result.")) 113 | o.rempty = true 114 | 115 | ---- Eanble 116 | o = s:taboption("seconddns", Flag, "seconddns_enabled", translate("Enable"), translate("Enable or disable second DNS server.")) 117 | o.default = o.disabled 118 | o.rempty = false 119 | 120 | ---- Port 121 | o = s:taboption("seconddns", Value, "seconddns_port", translate("Local Port"), translate("Smartdns local server port")) 122 | o.placeholder = 7053 123 | o.default = 7053 124 | o.datatype = "port" 125 | o.rempty = false 126 | 127 | ---- Enable TCP server 128 | o = s:taboption("seconddns", Flag, "seconddns_tcp_server", translate("TCP Server"), translate("Enable TCP DNS Server")) 129 | o.rmempty = false 130 | o.default = o.enabled 131 | o.cfgvalue = function(...) 132 | return Flag.cfgvalue(...) or "1" 133 | end 134 | 135 | o = s:taboption("seconddns", Flag, "seconddns_no_speed_check", translate("Skip Speed Check"), translate("Do not check speed.")) 136 | o.rmempty = false 137 | o.default = o.disabled 138 | o.cfgvalue = function(...) 139 | return Flag.cfgvalue(...) or "0" 140 | end 141 | 142 | ---- dns server group 143 | o = s:taboption("seconddns", Value, "seconddns_server_group", translate("Server Group"), translate("Query DNS through specific dns server group, such as office, home.")) 144 | o.rmempty = true 145 | o.placeholder = "default" 146 | o.datatype = "hostname" 147 | o.rempty = true 148 | 149 | ---- skip address rules 150 | o = s:taboption("seconddns", Flag, "seconddns_no_rule_addr", translate("Skip Address Rules"), translate("Skip address rules.")) 151 | o.rmempty = false 152 | o.default = o.disabled 153 | o.cfgvalue = function(...) 154 | return Flag.cfgvalue(...) or "0" 155 | end 156 | 157 | ---- skip name server rules 158 | o = s:taboption("seconddns", Flag, "seconddns_no_rule_nameserver", translate("Skip Nameserver Rule"), translate("Skip nameserver rules.")) 159 | o.rmempty = false 160 | o.default = o.disabled 161 | o.cfgvalue = function(...) 162 | return Flag.cfgvalue(...) or "0" 163 | end 164 | 165 | ---- skip ipset rules 166 | o = s:taboption("seconddns", Flag, "seconddns_no_rule_ipset", translate("Skip Ipset Rule"), translate("Skip ipset rules.")) 167 | o.rmempty = false 168 | o.default = o.disabled 169 | o.cfgvalue = function(...) 170 | return Flag.cfgvalue(...) or "0" 171 | end 172 | 173 | ---- skip soa address rule 174 | o = s:taboption("seconddns", Flag, "seconddns_no_rule_soa", translate("Skip SOA Address Rule"), translate("Skip SOA address rules.")) 175 | o.rmempty = false 176 | o.default = o.disabled 177 | o.cfgvalue = function(...) 178 | return Flag.cfgvalue(...) or "0" 179 | end 180 | 181 | o = s:taboption("seconddns", Flag, "seconddns_no_dualstack_selection", translate("Skip Dualstack Selection"), translate("Skip Sualstack Selection.")) 182 | o.rmempty = false 183 | o.default = o.disabled 184 | o.cfgvalue = function(...) 185 | return Flag.cfgvalue(...) or "0" 186 | end 187 | 188 | ---- skip cache 189 | o = s:taboption("seconddns", Flag, "seconddns_no_cache", translate("Skip Cache"), translate("Skip Cache.")) 190 | o.rmempty = false 191 | o.default = o.disabled 192 | o.cfgvalue = function(...) 193 | return Flag.cfgvalue(...) or "0" 194 | end 195 | 196 | ----- custom settings 197 | custom = s:taboption("custom", Value, "Custom Settings", 198 | translate(""), 199 | translate("smartdns custom settings")) 200 | 201 | custom.template = "cbi/tvalue" 202 | custom.rows = 20 203 | 204 | function custom.cfgvalue(self, section) 205 | return nixio.fs.readfile("/etc/smartdns/custom.conf") 206 | end 207 | 208 | function custom.write(self, section, value) 209 | value = value:gsub("\r\n?", "\n") 210 | nixio.fs.writefile("/etc/smartdns/custom.conf", value) 211 | end 212 | 213 | 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.")) 214 | o.rmempty = false 215 | o.default = o.disabled 216 | o.cfgvalue = function(...) 217 | return Flag.cfgvalue(...) or "0" 218 | end 219 | 220 | -- Upstream servers 221 | s = m:section(TypedSection, "server", translate("Upstream Servers"), translate("Upstream Servers, support UDP, TCP protocol. " .. 222 | "Please configure multiple DNS servers, including multiple foreign DNS servers.")) 223 | 224 | s.anonymous = true 225 | s.addremove = true 226 | s.template = "cbi/tblsection" 227 | s.extedit = luci.dispatcher.build_url("admin/services/smartdns/upstream/%s") 228 | 229 | ---- enable flag 230 | o = s:option(Flag, "enabled", translate("Enable"), translate("Enable")) 231 | o.rmempty = false 232 | o.default = o.enabled 233 | o.cfgvalue = function(...) 234 | return Flag.cfgvalue(...) or "1" 235 | end 236 | 237 | ---- name 238 | s:option(Value, "name", translate("DNS Server Name"), translate("DNS Server Name")) 239 | 240 | ---- IP address 241 | o = s:option(Value, "ip", translate("ip"), translate("DNS Server ip")) 242 | o.datatype = "or(ipaddr, string)" 243 | o.rmempty = false 244 | ---- port 245 | o = s:option(Value, "port", translate("port"), translate("DNS Server port")) 246 | o.placeholder = "default" 247 | o.datatype = "port" 248 | o.rempty = true 249 | o:depends("type", "udp") 250 | o:depends("type", "tcp") 251 | o:depends("type", "tls") 252 | 253 | ---- type 254 | o = s:option(ListValue, "type", translate("type"), translate("DNS Server type")) 255 | o.placeholder = "udp" 256 | o:value("udp", translate("udp")) 257 | o:value("tcp", translate("tcp")) 258 | o:value("tls", translate("tls")) 259 | o:value("https", translate("https")) 260 | o.default = "udp" 261 | o.rempty = false 262 | 263 | -- Doman addresss 264 | s = m:section(TypedSection, "smartdns", translate("Domain Address"), 265 | translate("Set Specific domain ip address.")) 266 | s.anonymous = true 267 | 268 | ---- address 269 | addr = s:option(Value, "address", 270 | translate(""), 271 | 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.")) 272 | 273 | addr.template = "cbi/tvalue" 274 | addr.rows = 20 275 | 276 | function addr.cfgvalue(self, section) 277 | return nixio.fs.readfile("/etc/smartdns/address.conf") 278 | end 279 | 280 | function addr.write(self, section, value) 281 | value = value:gsub("\r\n?", "\n") 282 | nixio.fs.writefile("/etc/smartdns/address.conf", value) 283 | end 284 | 285 | -- IP Blacklist 286 | s = m:section(TypedSection, "smartdns", translate("IP Blacklist"), 287 | translate("Set Specific ip blacklist.")) 288 | s.anonymous = true 289 | 290 | ---- blacklist 291 | addr = s:option(Value, "blacklist_ip", 292 | translate(""), 293 | translate("Configure IP blacklists that will be filtered from the results of specific DNS server.")) 294 | 295 | addr.template = "cbi/tvalue" 296 | addr.rows = 20 297 | 298 | function addr.cfgvalue(self, section) 299 | return nixio.fs.readfile("/etc/smartdns/blacklist-ip.conf") 300 | end 301 | 302 | function addr.write(self, section, value) 303 | value = value:gsub("\r\n?", "\n") 304 | nixio.fs.writefile("/etc/smartdns/blacklist-ip.conf", value) 305 | end 306 | 307 | -- Doman addresss 308 | s = m:section(TypedSection, "smartdns", translate("Technical Support"), 309 | translate("If you like this software, please buy me a cup of coffee.")) 310 | s.anonymous = true 311 | 312 | o = s:option(Button, "web") 313 | o.title = translate("SmartDNS official website") 314 | o.inputtitle = translate("open website") 315 | o.inputstyle = "apply" 316 | o.write = function() 317 | luci.http.redirect("https://pymumu.github.io/smartdns") 318 | end 319 | 320 | o = s:option(Button, "Donate") 321 | o.title = translate("Donate to smartdns") 322 | o.inputtitle = translate("Donate") 323 | o.inputstyle = "apply" 324 | o.write = function() 325 | luci.http.redirect("https://pymumu.github.io/smartdns/#donate") 326 | end 327 | 328 | return m 329 | 330 | -------------------------------------------------------------------------------- /luasrc/model/cbi/smartdns/upstream.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright (C) 2018-2020 Ruilin Peng (Nick) . 3 | -- 4 | -- smartdns is free software: you can redistribute it and/or modify 5 | -- it under the terms of the GNU General Public License as published by 6 | -- the Free Software Foundation, either version 3 of the License, or 7 | -- (at your option) any later version. 8 | -- 9 | -- smartdns is distributed in the hope that it will be useful, 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | -- GNU General Public License for more details. 13 | -- 14 | -- You should have received a copy of the GNU General Public License 15 | -- along with this program. If not, see . 16 | 17 | local sid = arg[1] 18 | 19 | m = Map("smartdns", "%s - %s" %{translate("SmartDNS Server"), translate("Upstream DNS Server Configuration")}) 20 | m.redirect = luci.dispatcher.build_url("admin/services/smartdns") 21 | 22 | if m.uci:get("smartdns", sid) ~= "server" then 23 | luci.http.redirect(m.redirect) 24 | return 25 | end 26 | 27 | -- [[ Edit Server ]]-- 28 | s = m:section(NamedSection, sid, "server") 29 | s.anonymous = true 30 | s.addremove = false 31 | 32 | ---- name 33 | s:option(Value, "name", translate("DNS Server Name"), translate("DNS Server Name")) 34 | 35 | ---- IP address 36 | o = s:option(Value, "ip", translate("ip"), translate("DNS Server ip")) 37 | o.datatype = "or(host, string)" 38 | o.rmempty = false 39 | ---- port 40 | o = s:option(Value, "port", translate("port"), translate("DNS Server port")) 41 | o.placeholder = "default" 42 | o.datatype = "port" 43 | o.rempty = true 44 | o:depends("type", "udp") 45 | o:depends("type", "tcp") 46 | o:depends("type", "tls") 47 | 48 | ---- type 49 | o = s:option(ListValue, "type", translate("type"), translate("DNS Server type")) 50 | o.placeholder = "udp" 51 | o:value("udp", translate("udp")) 52 | o:value("tcp", translate("tcp")) 53 | o:value("tls", translate("tls")) 54 | o:value("https", translate("https")) 55 | o.default = "udp" 56 | o.rempty = false 57 | 58 | ---- TLS host verify 59 | o = s:option(Value, "tls_host_verify", translate("TLS Hostname Verify"), translate("Set TLS hostname to verify.")) 60 | o.default = "" 61 | o.datatype = "string" 62 | o.rempty = true 63 | o:depends("type", "tls") 64 | o:depends("type", "https") 65 | 66 | ---- SNI host name 67 | o = s:option(Value, "host_name", translate("TLS SNI name"), translate("Sets the server name indication for query.")) 68 | o.default = "" 69 | o.datatype = "hostname" 70 | o.rempty = true 71 | o:depends("type", "tls") 72 | o:depends("type", "https") 73 | 74 | ---- http host 75 | 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.")) 76 | o.default = "" 77 | o.datatype = "hostname" 78 | o.rempty = true 79 | o:depends("type", "https") 80 | 81 | ---- server group 82 | o = s:option(Value, "server_group", translate("Server Group"), translate("DNS Server group belongs to, used with nameserver, such as office, home.")) 83 | o.rmempty = true 84 | o.placeholder = "default" 85 | o.datatype = "hostname" 86 | o.rempty = true 87 | 88 | ---- blacklist_ip 89 | o = s:option(Flag, "blacklist_ip", translate("IP Blacklist Filtering"), translate("Filtering IP with blacklist")) 90 | o.rmempty = false 91 | o.default = o.disabled 92 | o.cfgvalue = function(...) 93 | return Flag.cfgvalue(...) or "0" 94 | end 95 | 96 | ---- anti-Answer-Forgery 97 | -- 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")) 98 | -- o.rmempty = false 99 | -- o.default = o.disabled 100 | -- o:depends("type", "udp") 101 | -- o.cfgvalue = function(...) 102 | -- return Flag.cfgvalue(...) or "0" 103 | -- end 104 | 105 | ---- SPKI pin 106 | 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.")) 107 | o.default = "" 108 | o.datatype = "string" 109 | o.rempty = true 110 | o:depends("type", "tls") 111 | o:depends("type", "https") 112 | 113 | 114 | ---- other args 115 | o = s:option(Value, "addition_arg", translate("Additional Server Args"), translate("Additional Args for upstream dns servers")) 116 | o.default = "" 117 | o.rempty = true 118 | o.optional = true 119 | 120 | return m -------------------------------------------------------------------------------- /luasrc/model/smartdns.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright (C) 2018-2020 Ruilin Peng (Nick) . 3 | -- 4 | -- smartdns is free software: you can redistribute it and/or modify 5 | -- it under the terms of the GNU General Public License as published by 6 | -- the Free Software Foundation, either version 3 of the License, or 7 | -- (at your option) any later version. 8 | -- 9 | -- smartdns is distributed in the hope that it will be useful, 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | -- GNU General Public License for more details. 13 | -- 14 | -- You should have received a copy of the GNU General Public License 15 | -- along with this program. If not, see . 16 | 17 | require ("nixio.fs") 18 | require ("luci.http") 19 | require ("luci.dispatcher") 20 | require ("nixio.fs") 21 | 22 | local uci = require "luci.model.uci".cursor() 23 | 24 | module("luci.model.smartdns", package.seeall) 25 | 26 | function get_config_option(module, section, option, default) 27 | return uci:get_first(module, section, option) or default 28 | end 29 | 30 | return m 31 | 32 | -------------------------------------------------------------------------------- /luasrc/view/smartdns/smartdns_status.htm: -------------------------------------------------------------------------------- 1 | 36 | 37 |
38 |

39 | <%:Collecting data...%> 40 |

41 |
42 | -------------------------------------------------------------------------------- /po/zh-cn/smartdns.zh-cn.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | 4 | msgid "SmartDNS" 5 | msgstr "SmartDNS" 6 | 7 | msgid "SmartDNS is a local high-performance DNS server" 8 | msgstr "SmartDNS是一个本地高性能DNS服务器" 9 | 10 | msgid "SmartDNS Server" 11 | msgstr "SmartDNS 服务器" 12 | 13 | msgid "SmartDNS is a local high-performance DNS server, supports finding fastest IP, supports ad filtering, and supports avoiding DNS poisoning." 14 | msgstr "SmartDNS是一个本地高性能DNS服务器,支持返回最快IP,支持广告过滤。" 15 | 16 | msgid "Custom Settings" 17 | msgstr "自定义设置" 18 | 19 | msgid "Generate Coredump" 20 | msgstr "生成coredump" 21 | 22 | msgid "Generate Coredump file when smartdns crash, coredump file is located at /tmp/smartdns.xxx.core." 23 | msgstr "当smartdns异常时生成coredump文件,coredump文件在/tmp/smartdns.xxx.core." 24 | 25 | msgid "Server Name" 26 | msgstr "服务器名称" 27 | 28 | msgid "Smartdns server name" 29 | msgstr "SmartDNS的服务器名称,默认为smartdns,留空为主机名" 30 | 31 | msgid "SmartDNS is a local dns server to find fastest ip." 32 | msgstr "本地高性能服务器,优化网络访问性能。" 33 | 34 | msgid "Enable or disable smartdns server" 35 | msgstr "启用或禁用SmartDNS服务" 36 | 37 | msgid "Local Port" 38 | msgstr "本地端口" 39 | 40 | msgid "Smartdns local server port" 41 | msgstr "SmartDNS本地服务端口" 42 | 43 | msgid "IPV4 53 Port Redirect Failure" 44 | msgstr "IPV4 53端口重定向失败" 45 | 46 | msgid "IPV6 53 Port Redirect Failure" 47 | msgstr "IPV6 53端口重定向失败" 48 | 49 | msgid "Dnsmasq Forwared To Smartdns Failure" 50 | msgstr "重定向dnsmasq到smartdns失败" 51 | 52 | msgid "TCP Server" 53 | msgstr "TCP服务器" 54 | 55 | msgid "Enable TCP DNS Server" 56 | msgstr "启用TCP服务器" 57 | 58 | msgid "IPV6 Server" 59 | msgstr "IPV6服务器" 60 | 61 | msgid "Enable IPV6 DNS Server" 62 | msgstr "启用IPV6服务器" 63 | 64 | msgid "Dual-stack IP Selection" 65 | msgstr "双栈IP优选" 66 | 67 | msgid "Enable IP selection between IPV4 and IPV6" 68 | msgstr "启用或禁用IPV4,IPV6间的IP优选策略。" 69 | 70 | msgid "Domain prefetch" 71 | msgstr "域名预加载" 72 | 73 | msgid "Enable domain prefetch, accelerate domain response speed." 74 | msgstr "启用域名预加载,加速域名响应速度。" 75 | 76 | msgid "Redirect" 77 | msgstr "重定向" 78 | 79 | msgid "SmartDNS redirect mode" 80 | msgstr "SmartDNS 重定向模式" 81 | 82 | msgid "Run as dnsmasq upstream server" 83 | msgstr "作为dnsmasq的上游服务器" 84 | 85 | msgid "Redirect 53 port to SmartDNS" 86 | msgstr "重定向53端口到SmartDNS" 87 | 88 | msgid "Cache Size" 89 | msgstr "缓存大小" 90 | 91 | msgid "DNS domain result cache size" 92 | msgstr "缓存DNS的结果,缓存大小,配置零则不缓存" 93 | 94 | msgid "Domain TTL" 95 | msgstr "域名TTL" 96 | 97 | msgid "TTL for all domain result." 98 | msgstr "设置所有域名的TTL值" 99 | 100 | msgid "Domain TTL Min" 101 | msgstr "域名TTL最小值" 102 | 103 | msgid "Minimum TTL for all domain result." 104 | msgstr "设置所有域名的TTL最小值" 105 | 106 | msgid "Domain TTL Max" 107 | msgstr "域名TTL最大值" 108 | 109 | msgid "Maximum TTL for all domain result." 110 | msgstr "设置所有域名的TTL最大值" 111 | 112 | msgid "smartdns custom settings" 113 | msgstr "smartdns 自定义设置,具体配置参数参考指导" 114 | 115 | msgid "Second Server Settings" 116 | msgstr "第二DNS服务器" 117 | 118 | msgid "Enable or disable second DNS server." 119 | msgstr "是否启用第二DNS服务器。" 120 | 121 | msgid "Skip Speed Check" 122 | msgstr "跳过测速" 123 | 124 | msgid "Do not check speed." 125 | msgstr "禁用测速。" 126 | 127 | msgid "Server Group" 128 | msgstr "服务器组" 129 | 130 | msgid "Query DNS through specific dns server group, such as office, home." 131 | msgstr "使用指定服务器组查询,比如office, home。" 132 | 133 | msgid "Skip Address Rules" 134 | msgstr "跳过address规则" 135 | 136 | msgid "Skip address rules." 137 | msgstr "跳过address规则。" 138 | 139 | msgid "Skip Nameserver Rule" 140 | msgstr "跳过Nameserver规则" 141 | 142 | msgid "Skip nameserver rules." 143 | msgstr "跳过Nameserver规则。" 144 | 145 | msgid "Skip Ipset Rule" 146 | msgstr "跳过ipset规则" 147 | 148 | msgid "Skip ipset rules." 149 | msgstr "跳过ipset规则。" 150 | 151 | msgid "Skip SOA Address Rule" 152 | msgstr "跳过address SOA(#)规则" 153 | 154 | msgid "Skip SOA address rules." 155 | msgstr "跳过address SOA(#)规则。" 156 | 157 | msgid "Skip Dualstack Selection" 158 | msgstr "跳过双栈优选" 159 | 160 | msgid "Skip Sualstack Selection." 161 | msgstr "跳过双栈优选。" 162 | 163 | msgid "Skip Cache" 164 | msgstr "跳过cache" 165 | 166 | msgid "Skip Cache." 167 | msgstr "跳过cache。" 168 | 169 | msgid "Upstream Servers" 170 | msgstr "上游服务器" 171 | 172 | msgid "Upstream Servers, support UDP, TCP protocol. Please configure multiple DNS servers, including multiple foreign DNS servers." 173 | msgstr "上游DNS服务器列表,支持UDP,TCP协议,请配置多个上游DNS服务器,包括多个国内外服务器" 174 | 175 | msgid "DNS Server Name" 176 | msgstr "DNS服务器名称" 177 | 178 | msgid "port" 179 | msgstr "端口" 180 | 181 | msgid "DNS Server port" 182 | msgstr "DNS服务器端口" 183 | 184 | msgid "DNS Server ip" 185 | msgstr "DNS服务器IP" 186 | 187 | msgid "type" 188 | msgstr "类型" 189 | 190 | msgid "DNS Server type" 191 | msgstr "协议类型" 192 | 193 | msgid "Domain Address" 194 | msgstr "域名地址" 195 | 196 | msgid "TLS Hostname Verify" 197 | msgstr "校验TLS主机名" 198 | 199 | msgid "Set TLS hostname to verify." 200 | msgstr "设置校验TLS主机名。" 201 | 202 | msgid "TLS SNI name" 203 | msgstr "TLS SNI名称" 204 | 205 | msgid "HTTP Host" 206 | msgstr "HTTP主机" 207 | 208 | msgid "Sets the server name indication for query." 209 | msgstr "设置查询时使用的服务器SNI名称。" 210 | 211 | msgid "Set the HTTP host used for the query. Use this parameter when the host of the URL address is an IP address." 212 | msgstr "设置查询时使用的HTTP主机,当URL地址的host是IP地址时,使用此参数。" 213 | 214 | msgid "Server Group" 215 | msgstr "服务器组" 216 | 217 | msgid "DNS Server group belongs to, used with nameserver, such as office, home." 218 | msgstr "DNS服务器所属组, 配合nameserver使用,例如:office,home。" 219 | 220 | msgid "IP Blacklist Filtering" 221 | msgstr "IP黑名单过滤" 222 | 223 | msgid "Anti Answer Forgery" 224 | msgstr "反回答伪造" 225 | 226 | msgid "Anti answer forgery, if DNS does not work properly after enabling, please turn off this feature" 227 | msgstr "反回答伪造,如果启用后DNS工作不正常,请关闭此功能。" 228 | 229 | msgid "Filtering IP with blacklist" 230 | msgstr "使用IP黑名单过滤" 231 | 232 | msgid "TLS SPKI Pinning" 233 | msgstr "TLS SPKI 指纹" 234 | 235 | 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." 236 | msgstr "用于校验TLS服务器的有效性,数值为Base64编码的SPKI指纹, 留空表示不验证TLS的合法性" 237 | 238 | msgid "Additional Server Args" 239 | msgstr "额外的服务器参数" 240 | 241 | msgid "Additional Args for upstream dns servers" 242 | msgstr "额外的上游DNS服务器参数" 243 | 244 | msgid "Upstream DNS Server Configuration" 245 | msgstr "上游DNS服务器配置" 246 | 247 | msgid "Set Specific domain ip address." 248 | msgstr "指定特定域名的IP地址" 249 | 250 | 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." 251 | msgstr "配置特定域名返回特定的IP地址,域名查询将不到上游服务器请求,直接返回配置的IP地址,可用于广告屏蔽。" 252 | 253 | msgid "IP Blacklist" 254 | msgstr "IP黑名单" 255 | 256 | msgid "Set Specific ip blacklist." 257 | msgstr "设置IP黑名单列表" 258 | 259 | msgid "Configure IP blacklists that will be filtered from the results of specific DNS server." 260 | msgstr "配置需要从指定域名服务器结果过滤的IP黑名单。" 261 | 262 | msgid "Technical Support" 263 | msgstr "技术支持" 264 | 265 | msgid "If you like this software, please buy me a cup of coffee." 266 | msgstr "如果本软件对你有帮助,请给作者加个蛋。" 267 | 268 | msgid "SmartDNS official website" 269 | msgstr "SmartDNS官方网站" 270 | 271 | msgid "open website" 272 | msgstr "打开网站" 273 | 274 | msgid "Donate to smartdns" 275 | msgstr "捐助smartdns项目" 276 | 277 | msgid "Donate" 278 | msgstr "捐助" 279 | 280 | 281 | 282 | 283 | -------------------------------------------------------------------------------- /root/etc/uci-defaults/50_luci-smartdns: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (C) 2018-2020 Ruilin Peng (Nick) . 4 | # 5 | # smartdns is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # smartdns is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program. If not, see . 17 | 18 | uci -q batch <<-EOF >/dev/null 19 | delete ucitrack.@smartdns[-1] 20 | add ucitrack smartdns 21 | set ucitrack.@smartdns[-1].init=smartdns 22 | commit ucitrack 23 | EOF 24 | 25 | rm -f /tmp/luci-indexcache 26 | exit 0 27 | --------------------------------------------------------------------------------