publicdns

package
v0.0.0-...-113f59a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package publicdns contains mapping and helpers for working with public DNS providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoHEndpointFromIP

func DoHEndpointFromIP(ip netip.Addr) (dohBase string, dohOnly bool, ok bool)

DoHEndpointFromIP returns the DNS-over-HTTPS base URL for a given IP and whether it's DoH-only (not speaking DNS on port 53).

The ok result is whether the IP is a known DNS server.

func DoHIPsOfBase

func DoHIPsOfBase(dohBase string) []netip.Addr

DoHIPsOfBase returns the IP addresses to use to dial the provided DoH base URL.

It is basically the inverse of DoHEndpointFromIP with the exception that for NextDNS it returns IPv4 addresses that DoHEndpointFromIP doesn't map back.

func DoHV6

func DoHV6(base string) (ip netip.Addr, ok bool)

DoHV6 returns the first IPv6 DNS address from a given public DNS provider if found, along with a boolean indicating success.

func IPIsDoHOnlyServer

func IPIsDoHOnlyServer(ip netip.Addr) bool

IPIsDoHOnlyServer reports whether ip is a DNS server that should only use DNS-over-HTTPS (not regular port 53 DNS).

func KnownDoHPrefixes

func KnownDoHPrefixes() []string

KnownDoHPrefixes returns the list of DoH base URLs.

It returns a new copy each time, sorted. It's meant for tests.

It does not include providers that have customer-specific DoH URLs like NextDNS.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL