mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-16 03:31:39 +00:00
net/dns/publicdns: add support for Wikimedia DNS
RELNOTE=Adds support for Wikimedia DNS Updates #9255 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I4213c29e0f91ea5aa0304a5a026c32b6690fead9
This commit is contained in:
parent
d61494db68
commit
d413dd7ee5
@ -129,6 +129,11 @@ func addDoH(ipStr, base string) {
|
|||||||
dohIPsOfBase[base] = append(dohIPsOfBase[base], ip)
|
dohIPsOfBase[base] = append(dohIPsOfBase[base], ip)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
wikimediaDNSv4 = "185.71.138.138"
|
||||||
|
wikimediaDNSv6 = "2001:67c:930::1"
|
||||||
|
)
|
||||||
|
|
||||||
// populate is called once to initialize the knownDoH and dohIPsOfBase maps.
|
// populate is called once to initialize the knownDoH and dohIPsOfBase maps.
|
||||||
func populate() {
|
func populate() {
|
||||||
// Cloudflare
|
// Cloudflare
|
||||||
@ -185,6 +190,10 @@ func populate() {
|
|||||||
addDoH("194.242.2.3", "https://adblock.doh.mullvad.net/dns-query")
|
addDoH("194.242.2.3", "https://adblock.doh.mullvad.net/dns-query")
|
||||||
addDoH("193.19.108.3", "https://adblock.doh.mullvad.net/dns-query")
|
addDoH("193.19.108.3", "https://adblock.doh.mullvad.net/dns-query")
|
||||||
addDoH("2a07:e340::3", "https://adblock.doh.mullvad.net/dns-query")
|
addDoH("2a07:e340::3", "https://adblock.doh.mullvad.net/dns-query")
|
||||||
|
|
||||||
|
// Wikimedia
|
||||||
|
addDoH(wikimediaDNSv4, "https://wikimedia-dns.org/dns-query")
|
||||||
|
addDoH(wikimediaDNSv6, "https://wikimedia-dns.org/dns-query")
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -207,6 +216,10 @@ var (
|
|||||||
nextDNSv4RangeB = netip.MustParsePrefix("45.90.30.0/24")
|
nextDNSv4RangeB = netip.MustParsePrefix("45.90.30.0/24")
|
||||||
nextDNSv4One = nextDNSv4RangeA.Addr()
|
nextDNSv4One = nextDNSv4RangeA.Addr()
|
||||||
nextDNSv4Two = nextDNSv4RangeB.Addr()
|
nextDNSv4Two = nextDNSv4RangeB.Addr()
|
||||||
|
|
||||||
|
// Wikimedia DNS server IPs (anycast)
|
||||||
|
wikimediaDNSv4Addr = netip.MustParseAddr(wikimediaDNSv4)
|
||||||
|
wikimediaDNSv6Addr = netip.MustParseAddr(wikimediaDNSv6)
|
||||||
)
|
)
|
||||||
|
|
||||||
// nextDNSv6Gen generates a NextDNS IPv6 address from the upper 8 bytes in the
|
// nextDNSv6Gen generates a NextDNS IPv6 address from the upper 8 bytes in the
|
||||||
@ -224,5 +237,6 @@ func nextDNSv6Gen(ip netip.Addr, id []byte) netip.Addr {
|
|||||||
// DNS-over-HTTPS (not regular port 53 DNS).
|
// DNS-over-HTTPS (not regular port 53 DNS).
|
||||||
func IPIsDoHOnlyServer(ip netip.Addr) bool {
|
func IPIsDoHOnlyServer(ip netip.Addr) bool {
|
||||||
return nextDNSv6RangeA.Contains(ip) || nextDNSv6RangeB.Contains(ip) ||
|
return nextDNSv6RangeA.Contains(ip) || nextDNSv6RangeB.Contains(ip) ||
|
||||||
nextDNSv4RangeA.Contains(ip) || nextDNSv4RangeB.Contains(ip)
|
nextDNSv4RangeA.Contains(ip) || nextDNSv4RangeB.Contains(ip) ||
|
||||||
|
ip == wikimediaDNSv4Addr || ip == wikimediaDNSv6Addr
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user