diff options
author | Stan Grishin <stangri@melmac.net> | 2018-08-23 15:11:49 -0700 |
---|---|---|
committer | Stan Grishin <stangri@melmac.net> | 2018-09-02 18:49:54 -0700 |
commit | 89110b1757f8270e127cbd773afa13db41898418 (patch) | |
tree | bcc7d37a177b1cd9b592ee96138599c1978cab51 /applications/luci-app-https_dns_proxy/luasrc | |
parent | 875d80a07e83b6e0f0d79f080b63bd5b8ea45908 (diff) |
luci-app-https_dns_proxy: initial commit
Signed-off-by: Stan Grishin <stangri@melmac.net>
Diffstat (limited to 'applications/luci-app-https_dns_proxy/luasrc')
-rw-r--r-- | applications/luci-app-https_dns_proxy/luasrc/controller/https_dns_proxy.lua | 7 | ||||
-rw-r--r-- | applications/luci-app-https_dns_proxy/luasrc/model/cbi/https_dns_proxy.lua | 53 |
2 files changed, 60 insertions, 0 deletions
diff --git a/applications/luci-app-https_dns_proxy/luasrc/controller/https_dns_proxy.lua b/applications/luci-app-https_dns_proxy/luasrc/controller/https_dns_proxy.lua new file mode 100644 index 0000000000..e1fd8fcb9b --- /dev/null +++ b/applications/luci-app-https_dns_proxy/luasrc/controller/https_dns_proxy.lua @@ -0,0 +1,7 @@ +module("luci.controller.https_dns_proxy", package.seeall) +function index() + if not nixio.fs.access("/etc/config/https_dns_proxy") then + return + end + entry({"admin", "services", "https_dns_proxy"}, cbi("https_dns_proxy"), _("HTTPS DNS Proxy")) +end diff --git a/applications/luci-app-https_dns_proxy/luasrc/model/cbi/https_dns_proxy.lua b/applications/luci-app-https_dns_proxy/luasrc/model/cbi/https_dns_proxy.lua new file mode 100644 index 0000000000..61511a4130 --- /dev/null +++ b/applications/luci-app-https_dns_proxy/luasrc/model/cbi/https_dns_proxy.lua @@ -0,0 +1,53 @@ +local uci = require("luci.model.uci").cursor() + +m = Map("https_dns_proxy", translate("HTTPS DNS Proxy Settings")) +m.template="cbi/map" + +s3 = m:section(TypedSection, "https_dns_proxy", translate("Instances")) +s3.template = "cbi/tblsection" +s3.sortable = false +s3.anonymous = true +s3.addremove = true + +prov = s3:option(ListValue, "url_prefix", translate("Provider")) +prov:value("https://cloudflare-dns.com/dns-query?ct=application/dns-json&","Cloudflare") +prov:value("https://dns.google.com/resolve?","Google") +prov.write = function(self, section, value) + if value and value:match("cloudflare") then + uci:set("https_dns_proxy", section, "bootstrap_dns", "1.1.1.1,1.0.0.1") + uci:set("https_dns_proxy", section, "url_prefix", "https://cloudflare-dns.com/dns-query?ct=application/dns-json&") + else + uci:set("https_dns_proxy", section, "bootstrap_dns", "8.8.8.8,8.8.4.4") + uci:set("https_dns_proxy", section, "url_prefix", "https://dns.google.com/resolve?") + end + uci:set("https_dns_proxy", section, "user", "nobody") + uci:set("https_dns_proxy", section, "group", "nogroup") + uci:save("https_dns_proxy") +end + +la = s3:option(Value, "listen_addr", translate("Listen address")) +la.value = "127.0.0.1" +la.rmempty = true + +lp = s3:option(Value, "listen_port", translate("Listen port")) +lp.datatype = "port" +lp.placeholder = "5053" +lp.rmempty = true + +-- user = s3:option(Value, "user", translate("User name")) +-- user.placeholder = "nobody" +-- user.rmempty = true + +-- group = s3:option(Value, "group", translate("Group name")) +-- group.placeholder = "nogroup" +-- group.rmempty = true + +sa = s3:option(Value, "subnet_addr", translate("Subnet address")) +sa.datatype = "ip4prefix" +sa.rmempty = true + +ps = s3:option(Value, "proxy_server", translate("Proxy server")) +-- ps.datatype = "or(ipaddr,hostname)" +ps.rmempty = true + +return m |