Categorygithub.com/go-zoox/dns
modulepackage
1.2.0
Repository: https://github.com/go-zoox/dns.git
Documentation: pkg.go.dev

# README

DNS - Simple DNS Client and Server

PkgGoDev Build Status Go Report Card Coverage Status GitHub issues Release

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

License

GoZoox is released under the MIT License.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

NewClient creates a new DNS client.
NewServer creates a new DNS server.

# Variables

Version is the version of dns.

# Type aliases

ClientOptions is an alias for client.Options.
ServerOptions is an alias for server.Options.