-
Notifications
You must be signed in to change notification settings - Fork 3.9k
dnsproxy: Update to 0.39.0 and add init script #16198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
|
|
||
| # For documents, please see https://github.com/AdguardTeam/dnsproxy#usage | ||
|
|
||
| config dnsproxy 'global' | ||
| option enabled '0' | ||
| option listen_addr '127.0.0.1' | ||
| option listen_port '5353' | ||
| option log_file '' | ||
| option all_servers '0' | ||
| option fastest_addr '0' | ||
| option insecure '0' | ||
| option ipv6_disabled '0' | ||
| option max_go_routines '' | ||
| option rate_limit '' | ||
| option refuse_any '0' | ||
| option udp_buf_size '' | ||
| option verbose '0' | ||
|
|
||
| config dnsproxy 'bogus_nxdomain' | ||
| list ip_addr '' | ||
|
1715173329 marked this conversation as resolved.
|
||
|
|
||
| config dnsproxy 'cache' | ||
| option enabled '0' | ||
| option cache_optimistic '0' | ||
| option size '65535' | ||
| option min_ttl '' | ||
| option max_ttl '' | ||
|
|
||
| config dnsproxy 'dns64' | ||
| option enabled '0' | ||
| option dns64_prefix '64:ff9b::' | ||
|
|
||
| config dnsproxy 'edns' | ||
| option enabled '0' | ||
| option edns_addr '' | ||
|
|
||
| config dnsproxy 'servers' | ||
| list bootstrap 'tls://8.8.8.8' | ||
| list fallback 'tls://9.9.9.9' | ||
| list upstream 'tls://1.1.1.1' | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| #!/bin/sh /etc/rc.common | ||
| # Copyright (C) 2021 Tianling Shen <cnsztl@immortalwrt.org> | ||
|
|
||
| USE_PROCD=1 | ||
| START=90 | ||
|
|
||
| CONF="dnsproxy" | ||
| PROG="/usr/bin/dnsproxy" | ||
|
|
||
| is_enabled() { | ||
| local enabled | ||
| config_get enabled "$1" "$2" "0" | ||
| if [ "$enabled" -eq "1" ]; then | ||
| return 0 | ||
| else | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
| is_empty() { | ||
| local empty | ||
| config_get empty "$1" "$2" $3 | ||
| if [ -z "$empty" ]; then | ||
| return 0 | ||
| else | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
| append_param() { | ||
| procd_append_param command "$1" $2 | ||
| } | ||
|
|
||
| append_param_arg() { | ||
| local value | ||
| config_get value "$1" "$2" $4 | ||
| [ -n "$value" ] && append_param "$3" "$value" | ||
| } | ||
|
|
||
| append_param_bool() { | ||
| is_enabled "$1" "$2" && append_param "--${2//_/-}" | ||
| } | ||
|
|
||
| load_config_arg() { | ||
| append_param_bool "$1" "all_servers" | ||
| append_param_bool "$1" "fastest_addr" | ||
| append_param_bool "$1" "insecure" | ||
| append_param_bool "$1" "ipv6_disabled" | ||
| append_param_bool "$1" "refuse_any" | ||
| append_param_bool "$1" "verbose" | ||
| } | ||
|
|
||
| load_config_list() { | ||
| is_empty "bogus_nxdomain" "ip_addr" || config_list_foreach "bogus_nxdomain" "ip_addr" "append_param '--bogus-nxdomain'" | ||
|
|
||
| for i in "bootstrap" "fallback" "upstream"; do | ||
| is_empty "servers" "$i" || config_list_foreach "servers" "$i" "append_param '--$i'" | ||
|
1715173329 marked this conversation as resolved.
|
||
| done | ||
| } | ||
|
|
||
| load_config_param() { | ||
| append_param_arg "global" "listen_addr" "--listen" "127.0.0.1" | ||
| append_param_arg "global" "listen_port" "--port" "5353" | ||
| append_param_arg "global" "log_file" "--output" | ||
| append_param_arg "global" "max_go_routines" "--max-go-routines" | ||
| append_param_arg "global" "rate_limit" "--ratelimit" | ||
| append_param_arg "global" "udp_buf_size" "--udp-buf-size" | ||
|
|
||
| is_enabled "cache" "enabled" && { | ||
| append_param "--cache" | ||
| append_param_bool "cache" "cache_optimistic" | ||
| append_param_arg "cache" "size" "--cache-size" | ||
| append_param_arg "cache" "min_ttl" "--cache-min-ttl" | ||
| append_param_arg "cache" "max_ttl" "--cache-max-ttl" | ||
|
1715173329 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| is_enabled "dns64" "enabled" && { | ||
| append_param "--dns64" | ||
| append_param_arg "dns64" "dns64_prefix" "--dns64-prefix" | ||
| } | ||
|
|
||
| is_enabled "edns" "enabled" && { | ||
| append_param "--edns" | ||
| append_param_arg "edns" "edns_addr" "--edns-addr" | ||
| } | ||
| } | ||
|
|
||
| start_service() { | ||
| config_load "$CONF" | ||
|
|
||
| is_enabled "global" "enabled" || exit 1 | ||
|
|
||
| procd_open_instance "$CONF" | ||
| procd_set_param command "$PROG" | ||
|
|
||
| load_config_arg "global" | ||
| load_config_list | ||
| load_config_param | ||
|
|
||
|
1715173329 marked this conversation as resolved.
|
||
| procd_set_param respawn | ||
| procd_set_param stdout 1 | ||
| procd_set_param stderr 1 | ||
| procd_set_param user dnsproxy | ||
|
|
||
| procd_close_instance | ||
| } | ||
|
|
||
| reload_service() { | ||
| stop | ||
| start | ||
| } | ||
|
|
||
| service_triggers() { | ||
| procd_add_reload_trigger "$CONF" | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.