dnsproxy: add hosts configurations

trim whitespaces while at it.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2024-08-24 18:04:42 +08:00 committed by Tianling Shen
parent c183be97d9
commit ecdf98767e
3 changed files with 13 additions and 3 deletions

View 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)?

View 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'

View 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"