diff options
author | Stan Grishin <stangri@melmac.net> | 2021-07-31 10:47:25 +0000 |
---|---|---|
committer | Stan Grishin <stangri@melmac.net> | 2021-07-31 10:57:47 +0000 |
commit | b52b32f2e27eb0d6daaf8bdf0069e82154baa3de (patch) | |
tree | 0bc2c45162a91819b81770843dbbe10f431065fa /applications/luci-app-https-dns-proxy/luasrc/model/cbi | |
parent | 7f5becc69e004f831c9dc09e0859c179b439c7d2 (diff) |
luci-app-https-dns-proxy: update to 2021-07-29-1
* add HTTP/2-only supporting providers: Mullvad, Digitale-Gesellschaft, dns.sb and Rubyfish.cn
* switch default provider from Google to Cloudflare
* add IPv6 addresses for bootstrap resolvers for Google DNS
* add secondary bootstrap resolver (Cloudflare's) to all providers with a single bootstrap resolver
* modify model/cbi file to show HTTP/2-only providers (and help texts) on HTTP/2-supporting systems
Signed-off-by: Stan Grishin <stangri@melmac.net>
Diffstat (limited to 'applications/luci-app-https-dns-proxy/luasrc/model/cbi')
-rw-r--r-- | applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua | 19 |
1 files changed, 15 insertions, 4 deletions
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 index 620c8d6c88..a8e45b5807 100644 --- 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 @@ -9,6 +9,7 @@ local packageName = "https-dns-proxy" local readmeURL = "https://docs.openwrt.melmac.net/" .. packageName .. "/" local providers_dir = "/usr/lib/lua/luci/" .. packageName .. "/providers/" local helperText = "" +local http2Supported = false function getPackageVersion() local opkgFile = "/usr/lib/opkg/status" @@ -30,7 +31,7 @@ function createHelperText() local p_func = loadfile(providers_dir .. filename) setfenv(p_func, { _ = i18n.translate }) local p = p_func() - if p.help_link then + if p.help_link and (not p.http2_only or http2Supported) then local url, domain url = p.help_link domain = p.help_link_text or url:match('^%w+://([^/]+)') @@ -102,6 +103,10 @@ else end end +if sys.call("curl --version | grep -q HTTP2") == 0 then + http2Supported = true +end + m = Map("https-dns-proxy", translate("DNS HTTPS Proxy Settings")) h = m:section(TypedSection, "_dummy", translatef("Service Status [%s %s]", packageName, packageVersion)) @@ -142,7 +147,9 @@ for filename in fs.dir(providers_dir) do local p_func = loadfile(providers_dir .. filename) setfenv(p_func, { _ = i18n.translate }) local p = p_func() - prov:value(p.resolver_url, p.label) + if not p.http2_only or http2Supported then + prov:value(p.resolver_url, p.label) + end if p.default then prov.default = p.resolver_url end @@ -157,8 +164,12 @@ prov.write = function(self, section, value) value = value:gsub('[%p%c%s]', '') p.url_match = p.resolver_url:gsub('[%p%c%s]', '') if value:match(p.url_match) then - uci:set(packageName, section, "bootstrap_dns", p.bootstrap_dns) - uci:set(packageName, section, "resolver_url", p.resolver_url) + if p.bootstrap_dns then + uci:set(packageName, section, "bootstrap_dns", p.bootstrap_dns) + end + if p.resolver_url then + uci:set(packageName, section, "resolver_url", p.resolver_url) + end end end uci:save(packageName) |