dnsproxy: add hosts configurations
authorTianling Shen <[email protected]>
Sat, 24 Aug 2024 10:04:42 +0000 (18:04 +0800)
committerTianling Shen <[email protected]>
Sun, 25 Aug 2024 06:45:40 +0000 (14:45 +0800)
trim whitespaces while at it.

Signed-off-by: Tianling Shen <[email protected]>
net/dnsproxy/Makefile
net/dnsproxy/files/dnsproxy.config
net/dnsproxy/files/dnsproxy.init

index 278904c4ccdc94006211695ab7cbb41625c863eb..2f741d0c24b30a589b0bf577134e1db482ac201a 100644 (file)
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnsproxy
 PKG_VERSION:=0.73.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://codeload.github.com/AdguardTeam/dnsproxy/tar.gz/v$(PKG_VERSION)?
index ac704a7bb43d581f8b01accabfc12c997b609dfc..857a0dccd1fda10a09d10d8aa7ba81fdbce7e93d 100644 (file)
@@ -37,6 +37,10 @@ config dnsproxy 'edns'
        option enabled '0'
        option edns_addr ''
 
+config dnsproxy 'hosts'
+       option enabled '0'
+       list hosts_files ''
+
 config dnsproxy 'private_rdns'
        option enabled '0'
        list upstream '127.0.0.1:53'
index f39038c37e234440336645dc1e8adb71a995e02d..4ddbb0053f33c74dcaf254075817144570f57080 100644 (file)
@@ -54,18 +54,22 @@ load_config_arg() {
 load_config_list() {
        if is_empty "global" "listen_addr"; then
                append_param "--listen" "127.0.0.1"
-       else 
+       else
                config_list_foreach "global" "listen_addr" "append_param '--listen'"
        fi
 
        if is_empty "global" "listen_port"; then
                append_param "--port" "5353"
-       else 
+       else
                config_list_foreach "global" "listen_port" "append_param '--port'"
        fi
 
        is_empty "bogus_nxdomain" "ip_addr" || config_list_foreach "bogus_nxdomain" "ip_addr" "append_param '--bogus-nxdomain'"
 
+       is_enabled "hosts" "enabled" && {
+               config_list_foreach "hosts" "hosts_files" "append_param '--hosts-files'"
+       }
+
        is_enabled "private_rdns" "enabled" && {
                append_param "--use-private-rdns"
                config_list_foreach "private_rdns" "upstream" "append_param '--private-rdns-upstream'"
@@ -83,6 +87,8 @@ load_config_param() {
        append_param_arg "global" "rate_limit" "--ratelimit"
        append_param_arg "global" "udp_buf_size" "--udp-buf-size"
 
+       append_param_arg "hosts" "enabled" "--hosts-file-enabled" "0"
+
        is_enabled "cache" "enabled" && {
                append_param "--cache"
                append_param_bool "cache" "cache_optimistic"