Last active
April 12, 2024 10:08
-
-
Save missdeer/5c7c82b5b67f8afb41cfd43d51b82c2d to your computer and use it in GitHub Desktop.
generate Corefile which uses your ISP's DNS servers to resolve domain names in China and uses OpenDNS/Cloudflare/Google DNS servers to resolve domain names outside China for CoreDNS. You should change 119.29.29.29/223.5.5.5 to your ISP's DNS server address or use public DNS server such as 114/DNSPod etc. directly.
This file contains 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
#!/bin/sh | |
echo 'use "curl -sSL git.io/corefile | bash" to update Corefile' | |
echo "remember to change 192.168.1.1 to your ISP's DNS server address or use public DNS server such as 114/DNSPod etc. directly" | |
china=`curl -sSL https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf | while read line; do awk -F '/' '{print $2}' | grep -v '#' ; done | paste -sd " " -` | |
apple=`curl -sSL https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf | while read line; do awk -F '/' '{print $2}' | grep -v '#' ; done | paste -sd " " -` | |
google=`curl -sSL https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf | while read line; do awk -F '/' '{print $2}' | grep -v '#' ; done | paste -sd " " -` | |
bogus=`curl -sSL https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/bogus-nxdomain.china.conf | grep "=" | while read line; do awk -F '=' '{print $2}' | grep -v '#' ; done | paste -sd " " -` | |
cat>Corefile<<EOF | |
. { | |
# comment below lines to disable ads plugin | |
ads { | |
blacklist https://anti-ad.net/domains.txt | |
blacklist https://raw.githubusercontent.com/missdeer/blocklist/master/convert/AdguardMobileAds.txt | |
blacklist https://raw.githubusercontent.com/missdeer/blocklist/master/convert/AdguardMobileSpyware.txt | |
blacklist https://raw.githubusercontent.com/missdeer/blocklist/master/convert/AdguardTracking.txt | |
blacklist https://raw.githubusercontent.com/missdeer/blocklist/master/convert/AdguardCNAMEAds.txt | |
blacklist https://raw.githubusercontent.com/missdeer/blocklist/master/convert/AdguardCNAMEClickthroughs.txt | |
blacklist https://raw.githubusercontent.com/missdeer/blocklist/master/convert/AdguardCNAMEMicrosites.txt | |
blacklist https://raw.githubusercontent.com/missdeer/blocklist/master/convert/AdguardCNAME.txt | |
blacklist https://raw.githubusercontent.com/missdeer/blocklist/master/convert/AdguardDNS.txt | |
blacklist https://raw.githubusercontent.com/missdeer/blocklist/master/convert/EasyPrivacyCNAME.txt | |
blacklist https://raw.githubusercontent.com/missdeer/blocklist/master/convert/EasyPrivacySpecific.txt | |
blacklist https://raw.githubusercontent.com/missdeer/blocklist/master/convert/EasyPrivacy3rdParty.txt | |
nxdomain | |
log | |
auto-update-interval 24h | |
list-store ads-cache | |
} | |
hosts { | |
fallthrough | |
} | |
# choose your favourite DNS servers below | |
forward . 127.0.0.1:5300 127.0.0.1:5301 127.0.0.1:5302 127.0.0.1:5303 127.0.0.1:5304 { | |
except $china $apple $google dns.quad9.net cloudflare-dns.com dns.google dns.opendns.com | |
} | |
proxy . 119.29.29.29 223.5.5.5 | |
bogus $bogus | |
log | |
cache | |
# uncomment lines below to enable redis plugin | |
#redisc { | |
# endpoint 127.0.0.1:6379 | |
#} | |
health | |
reload | |
} | |
.:5300 { | |
bind 127.0.0.1 | |
forward . tls://208.67.222.222 tls://208.67.220.220 { | |
tls_servername dns.opendns.com | |
health_check 60s | |
} | |
cache | |
} | |
.:5301 { | |
bind 127.0.0.1 | |
forward . tls://9.9.9.9 tls://9.9.9.10 { | |
tls_servername dns.quad9.net | |
health_check 60s | |
} | |
cache | |
} | |
.:5302 { | |
bind 127.0.0.1 | |
forward . tls://1.1.1.1 tls://1.0.0.1 { | |
tls_servername cloudflare-dns.com | |
health_check 60s | |
} | |
cache | |
} | |
.:5303 { | |
bind 127.0.0.1 | |
forward . tls://8.8.8.8 tls://8.8.4.4 { | |
tls_servername dns.google | |
health_check 60s | |
} | |
cache | |
} | |
EOF |
line 7, there is a duplicate letter "m" for "https://raw.521000.bestm"
line 7, there is a duplicate letter "m" for "https://raw.521000.bestm"
Fixed. Thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
参考:
https://github.com/missdeer/coredns_custom_build