Browse Source

https-dns-proxy: shellcheck & beautify

Signed-off-by: Stan Grishin <stangri@melmac.net>
lilik-openwrt-22.03
Stan Grishin 5 years ago
committed by Gerard Ryan
parent
commit
5b03da037a
2 changed files with 9 additions and 7 deletions
  1. +1
    -1
      net/https-dns-proxy/files/README.md
  2. +8
    -6
      net/https-dns-proxy/files/https-dns-proxy.init

+ 1
- 1
net/https-dns-proxy/files/README.md View File

@ -88,7 +88,7 @@ The https-dns-proxy instance settings are:
|group|String|nogroup|Local group to run instance under.| |group|String|nogroup|Local group to run instance under.|
|use_http1|Boolean|0|If set to 1, use HTTP/1 on installations with broken/outdated ```curl``` package. Included for posterity reasons, you will most likely not ever need it on OpenWrt.| |use_http1|Boolean|0|If set to 1, use HTTP/1 on installations with broken/outdated ```curl``` package. Included for posterity reasons, you will most likely not ever need it on OpenWrt.|
|verbosity|Integer|0|logging verbosity level. fatal = 0, error = 1, warning = 2, info = 3, debug = 4| |verbosity|Integer|0|logging verbosity level. fatal = 0, error = 1, warning = 2, info = 3, debug = 4|
|ipv6_resolvers_only|Boolean|0|If set to 1, Forces IPv6 DNS resolvers instead of IPv4|
|use_ipv6_resolvers_only|Boolean|0|If set to 1, Forces IPv6 DNS resolvers instead of IPv4|
## Thanks ## Thanks


+ 8
- 6
net/https-dns-proxy/files/https-dns-proxy.init View File

@ -48,12 +48,14 @@ start_instance() {
append_bool "$cfg" 'use_http1' '-x' append_bool "$cfg" 'use_http1' '-x'
config_get verbosity "$cfg" 'verbosity' "0" config_get verbosity "$cfg" 'verbosity' "0"
# shellcheck disable=SC2086,SC2154
for i in $(seq 1 $verbosity); do for i in $(seq 1 $verbosity); do
xappend "-v" xappend "-v"
done done
config_get_bool ipv6_resolvers_only "$cfg" 'ipv6_resolvers_only' '0'
if [ "$ipv6_resolvers_only" == 0 ]; then
config_get_bool ipv6_resolvers_only "$cfg" 'use_ipv6_resolvers_only' '0'
# shellcheck disable=SC2154
if [ "$ipv6_resolvers_only" = 0 ]; then
xappend "-4" xappend "-4"
fi fi
@ -123,8 +125,8 @@ dnsmasq_add_doh_server() {
;; ;;
esac esac
uci -q del_list dhcp."$cfg".server="$address#$port"
uci -q add_list dhcp."$cfg".server="$address#$port"
uci -q del_list "dhcp.$cfg.server=${address}#${port}"
uci -q add_list "dhcp.$cfg.server=${address}#${port}"
} }
dnsmasq_create_server_backup() { dnsmasq_create_server_backup() {
@ -134,7 +136,7 @@ dnsmasq_create_server_backup() {
for i in $(uci -q get "dhcp.$cfg.server"); do for i in $(uci -q get "dhcp.$cfg.server"); do
uci -q add_list dhcp."$cfg".doh_backup_server="$i" uci -q add_list dhcp."$cfg".doh_backup_server="$i"
if [ "$i" = "${i//127.0.0.1}" ] && [ "$i" = "$(echo "$i" | tr -d /)" ]; then if [ "$i" = "${i//127.0.0.1}" ] && [ "$i" = "$(echo "$i" | tr -d /)" ]; then
uci -q del_list dhcp."$cfg".server="$i"
uci -q del_list "dhcp.$cfg.server=$i"
fi fi
done done
} }
@ -145,7 +147,7 @@ dnsmasq_restore_server_backup() {
if uci -q get "dhcp.$cfg.doh_backup_server" >/dev/null; then if uci -q get "dhcp.$cfg.doh_backup_server" >/dev/null; then
uci -q del "dhcp.$cfg.server" uci -q del "dhcp.$cfg.server"
for i in $(uci -q get "dhcp.$cfg.doh_backup_server"); do for i in $(uci -q get "dhcp.$cfg.doh_backup_server"); do
uci -q add_list dhcp."$cfg".server="$i"
uci -q add_list "dhcp.$cfg.server=$i"
done done
uci -q del "dhcp.$cfg.doh_backup_server" uci -q del "dhcp.$cfg.doh_backup_server"
fi fi


Loading…
Cancel
Save