# README
DNS - Simple DNS Client and Server
Installation
To install the package, run:
go get github.com/go-zoox/dns
Getting Started
func main() {
server := dns.NewServer(&dns.ServerOptions{
Port: 53,
})
client := dns.NewClient()
server.Handle(func(host string, typ int) ([]string, error) {
key := fmt.Sprintf("%s_%d", host, typ)
if host == "gozoox.com" {
return []string{"6.6.6.6"}, nil
}
if ips, err := client.LookUp(host, &dns.LookUpOptions{Typ: typ}); err != nil {
return nil, err
} else {
logger.Info("found host(%s %d) %v", host, typ, ips)
return ips, nil
}
})
server.Serve()
}
Features
Client
- Plain DNS
- Plain DNS in UDP
- Plain DNS in TCP
- DNS-over-TLS (DoT)
- DNS-over-HTTPS (DoH)
- DNS-over-QUIC (DoQ)
- DNSCrypt
Server
- Plain DNS
- Plain DNS in UDP
- Plain DNS in TCP
- DNS-over-TLS (DoT)
- DNS-over-HTTPS (DoH)
- DNS-over-QUIC (DoQ)
Inspired By
- AdGuardHome - Network-wide ads & trackers blocking DNS server.
- kenshinx/godns - A fast dns cache server written by go.
- miekg/dns - DNS library in Go.
License
GoZoox is released under the MIT License.
# Variables
Version is the version of dns.
# Type aliases
ClientOptions is an alias for client.Options.
ServerOptions is an alias for server.Options.