https-dns-proxy: new init script and config files 6853/head
authorStan Grishin <stangri@melmac.net>
Thu, 23 Aug 2018 22:05:23 +0000 (15:05 -0700)
committerStan Grishin <stangri@melmac.net>
Mon, 3 Sep 2018 01:35:45 +0000 (18:35 -0700)
Signed-off-by: Stan Grishin <stangri@melmac.net>
net/https-dns-proxy/Makefile
net/https-dns-proxy/files/https_dns_proxy.config
net/https-dns-proxy/files/https_dns_proxy.init

index 3a8e754040ccca80692a6b5605d00c038c4c614c..6e9f8e1cdc1df94719d965fc01e7f7351fe71d54 100644 (file)
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=https_dns_proxy
 PKG_VERSION:=2018-04-23
-PKG_RELEASE=1
+PKG_RELEASE=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_MIRROR_HASH:=24b7e4238c37e646f33eee3a374f6b7beb5c167b9c5008cc13b51e5f1f3a44ea
index b124aeb9ddff97ed53d9295f4e8e97285c600782..b5b49ba66ee855e317b5da25352f9c27ba9cfc53 100644 (file)
@@ -1,8 +1,19 @@
 config https_dns_proxy
        option listen_addr '127.0.0.1'
        option listen_port '5053'
+       option bootstrap_dns '8.8.8.8,8.8.4.4'
+       option url_prefix 'https://dns.google.com/resolve?'
+       option user 'nobody'
+       option group 'nogroup'
+       option subnet_addr ''
+       option proxy_server ''
+
+config https_dns_proxy
+       option listen_addr '127.0.0.1'
+       option listen_port '5054'
+       option bootstrap_dns '1.1.1.1,1.0.0.1'
+       option url_prefix 'https://cloudflare-dns.com/dns-query?ct=application/dns-json&'
        option user 'nobody'
        option group 'nogroup'
        option subnet_addr ''
        option proxy_server ''
-       option url_prefix 'https://dns.google.com/resolve?'
index 9a5f797925f085ee9599a5c939a46782b67f2ac9..645c17aa46ca263d79f81e2327330b21eaea5824 100644 (file)
@@ -1,39 +1,37 @@
 #!/bin/sh /etc/rc.common
 
 START=80
-
 USE_PROCD=1
-PROG=/usr/sbin/https_dns_proxy
-
-start_instance() {
-       local cfg="$1"
-       local listen_addr listen_port user group
 
-       config_get listen_addr "$cfg" listen_addr
-       config_get listen_port "$cfg" listen_port
-       config_get user "$cfg" user
-       config_get group "$cfg" group
-       config_get subnet_addr "$cfg" subnet_addr
-       config_get proxy_server "$cfg" proxy_server
-       config_get url_prefix "$cfg" url_prefix
+PROG=/usr/sbin/https_dns_proxy
 
-       if [ -n "$subnet_addr" ]; then
-               subnet_param="-e $subnet_addr"
-       fi
+xappend() { param="$param $1"; }
+
+append_parm() {
+       local section="$1"
+       local option="$2"
+       local switch="$3"
+       local default="$4"
+       local _loctmp
+       config_get _loctmp "$section" "$option" "$default"
+       [ -z "$_loctmp" ] && return 0
+       xappend "$switch $_loctmp"
+}
 
-       if [ -n "$proxy_server" ]; then
-               proxy_param="-t $proxy_server"
-       fi
+start_instance() {
+       local cfg="$1" param
 
-       if [ -z "$url_prefix" ]; then
-               url_prefix="https://dns.google.com/resolve?"
-       fi
+       append_parm "$cfg" 'listen_addr' '-a' '127.0.0.1'
+       append_parm "$cfg" 'listen_port' '-p' '5053'
+       append_parm "$cfg" 'bootstrap_dns' '-b'
+       append_parm "$cfg" 'url_prefix' '-r'
+       append_parm "$cfg" 'user' '-u' 'nobody'
+       append_parm "$cfg" 'group' '-g' 'nogroup'
+       append_parm "$cfg" 'subnet_addr' '-e'
+       append_parm "$cfg" 'proxy_server' '-t'
 
        procd_open_instance
-       procd_set_param command ${PROG} \
-               -a "$listen_addr" -p "$listen_port" \
-               -u "$user" -g "$group" $subnet_param $proxy_param \
-               -r "$url_prefix"
+       procd_set_param command ${PROG} ${param}
        procd_set_param respawn
        procd_close_instance
 }