dnsresolver

package module
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: BSD-3-Clause Imports: 12 Imported by: 3

README

OVERVIEW

Go Reference Go Report Card Go Build

paepcke.de/dnsresolver

  • Alternative DNS Resolver package with focus on security and speed
  • Provides many apis 100% plugin compatible with the golang stdlib net dns resolver, just import & change the prefix, done
  • Uses the popular miekg/dns package to enable more flexible options for DNS requests
  • TLS/DOT secured transport via fixed and built-in keypin
  • 100% pure go, minimal extenral imports, use as app or api (see api.go)

TODO

[] DNSSEC validation [] DoT/DoH Cert SCT (certificat-transparency) tracking, in addition / partial replacement for fixed keypins [] advanced caching (see paepcke.de/dnscache)

EXTERNAL RESOURCES

Special thanks goes to:

  • Miek for the dns package

DOCS

pkg.go.dev/paepcke.de/dnsresolver

CONTRIBUTION

Yes, Please! PRs Welcome!

Documentation

Overview

package dnsresolver

Index

Constants

This section is empty.

Variables

View Source
var TypeAll []uint16 = rTypeAll()

TypeAll holds all DNS Types (A, AAA, CNAME, MX ...)

Functions

func CacheAll

func CacheAll(hostname string)

CacheAll ...

func Lookup

func Lookup(hostname string, rType uint16) ([]string, error)

Lookup ...

func LookupIP

func LookupIP(hostname string) ([]netip.Addr, error)

LookupIP ...

func LookupIP4

func LookupIP4(hostname string) ([]netip.Addr, error)

LookupIP4 ...

func LookupIP6

func LookupIP6(hostname string) ([]netip.Addr, error)

LookupIP6 ...

func ReverseLookupIP4

func ReverseLookupIP4(ip4 string) (string, error)

ReverseLookupIP4 ...

func ReverseLookupIP4Addr

func ReverseLookupIP4Addr(ip4Addr netip.Addr) (string, error)

ReverseLookupIP4Addr ...

Types

type Answer

type Answer struct {
	Raw     map[uint16]string
	Summary map[uint16]string
}

Answer ...

type Resolver

type Resolver struct {
	Name string
	// Server server_ip:port
	Server string
	// NoIP4 no dns.srv conn attempt via ip4
	NoIP4 bool
	// NoIP6 no dns.srv conn attempt via ip6
	NoIP6 bool
	// NoUDP no dns.src conn attempt via udp
	NoUDP bool
	// NoTCP no dns.src conn attempt via tcp
	NoTCP bool
	// DoT/TLS enforced, disables TCP & UDP
	DoT bool
	// TLSKeyPin for DoT (optional)
	TLSKeyPin string
	// TLSconfig TLS/DoT settings (optional)
	// when custom tls.Config and TLSKeyPin are enabled a tlsconfig.VerifyConnection
	// function is required (examples, see resolver.go or use tlsConfigPin(TLSKeyPin))
	TLSConfig *tls.Config
	// Timeout ...
	Timeout time.Duration
}

Resolver ..

func ResolverAuto

func ResolverAuto() *Resolver

ResolverAuto ...

func ResolverLocalhost

func ResolverLocalhost() *Resolver

ResolverLocalhost ...

func ResolverResolvConf

func ResolverResolvConf() *Resolver

ResolverResolvConf ...

func ResolverViaProvider

func ResolverViaProvider(name string, dot bool) *Resolver

ResolverViaProvider ...

func (*Resolver) Exchange

func (r *Resolver) Exchange(query string, raw, summary bool, rTypes []uint16) (*Answer, error)

Exchange ...

func (*Resolver) IsFunctional

func (r *Resolver) IsFunctional() error

IsFunctional ...

func (*Resolver) IsReachable

func (r *Resolver) IsReachable() bool

IsReachable ...

func (*Resolver) Lookup

func (r *Resolver) Lookup(query string, rType uint16) ([]string, error)

Lookup ...

func (*Resolver) LookupAddr

func (r *Resolver) LookupAddr(query string, rType uint16) ([]netip.Addr, error)

LookupAddr ...

func (*Resolver) LookupAddrs

func (r *Resolver) LookupAddrs(query string, rTypes []uint16) ([]netip.Addr, error)

LookupAddrs ...

func (*Resolver) ReverseLookupIP4

func (r *Resolver) ReverseLookupIP4(ip4 string) (string, error)

ReverseLookupIP4 ...

func (*Resolver) ReverseLookupIP4Addr

func (r *Resolver) ReverseLookupIP4Addr(addrIP4 netip.Addr) (string, error)

ReverseLookupIP4Addr ...

Jump to

Keyboard shortcuts

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