From 84f9ca8d8941f8c80e6033fbd43ef86e316da6f5 Mon Sep 17 00:00:00 2001 From: jonwltn <86822083+jonwltn@users.noreply.github.com> Date: Fri, 2 Jul 2021 02:42:12 -0700 Subject: [PATCH] Add NextDNS as a DOH option. --- acme.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/acme.sh b/acme.sh index d62f7007..09e075b0 100755 --- a/acme.sh +++ b/acme.sh @@ -105,6 +105,7 @@ DOH_CLOUDFLARE=1 DOH_GOOGLE=2 DOH_ALI=3 DOH_DP=4 +DOH_NEXTDNS=5 HIDDEN_VALUE="[hidden](please add '--output-insecure' to see this value)" @@ -3940,6 +3941,22 @@ _ns_lookup_dp() { _ns_lookup_impl "$_cf_ep" "$_cf_ld" "$_cf_ld_type" } +_ns_is_available_nextdns() { + if _get "https://dns.nextdns.io" "" 1 >/dev/null 2>&1; then + return 0 + else + return 1 + fi +} + +#domain, type +_ns_lookup_nextdns() { + _cf_ld="$1" + _cf_ld_type="$2" + _cf_ep="https://dns.nextdns.io" + _ns_lookup_impl "$_cf_ep" "$_cf_ld" "$_cf_ld_type" +} + #domain, type _ns_lookup() { if [ -z "$DOH_USE" ]; then @@ -3956,6 +3973,9 @@ _ns_lookup() { elif _ns_is_available_dp; then _debug "Use dns pod doh server" export DOH_USE=$DOH_DP + elif _ns_is_available_nextdns; then + _debug "Use nextdns doh server" + export DOH_USE=$DOH_NEXTDNS else _err "No doh" fi @@ -3969,6 +3989,8 @@ _ns_lookup() { _ns_lookup_ali "$@" elif [ "$DOH_USE" = "$DOH_DP" ]; then _ns_lookup_dp "$@" + elif [ "$DOH_USE" = "$DOH_NEXTDNS" ]; then + _ns_lookup_nextdns "$@" else _err "Unknown doh provider: DOH_USE=$DOH_USE" fi