Documentation ¶
Overview ¶
Package dnsserver implements a simple, authoritative DNS server. It is built upon https://github.com/miekg/dns.
See the top-level package for general documentation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { Addr string // Defaults to ":dns" NoTCP bool NoUDP bool ErrorLog Logger // Defaults to log package's standard logger DebugLog Logger // Defaults to nothingness // If provided, this channel will be closed once all listeners are ready. Ready chan struct{} // If the NS field of SOA is set, the name server will be authoritative and // NS and SOA records are returned. SOA SOA }
Config of DNS server.
type Logger ¶
type Logger interface {
Printf(fmt string, args ...interface{})
}
Logger is a subset of log.Logger.
type Resolver ¶
type Resolver interface { // ResolveRecords copies a host's records. It should return empty node // name if and only if the host name doesn't fall into any known zone: // unknown node names in known zones should be returned without records. // // The filter parameter selects a single record type, or all records if // dns.TypeAny is specified. Unknown values must be handled by returning // an empty record set. // // serial is the current serial number of the node's zone. It is non-zero // for known zones, and zero if zone wasn't found. ResolveRecords(hostname string, filter dns.RecordType) (node string, rs dns.Records, serial uint32) // TransferZone copies the contents of a domain. The apex node must be // first, if present. // // serial is the current serial number of the zone. It is non-zero if the // zone was found, and zero if not. TransferZone(domain string) (zone []dns.NodeRecords, serial uint32) }
Resolver can dump host and zone records. It must be instantaneous.
type SOA ¶
type SOA struct { NS string // Name of this name server (like "ns1.example.net.") Mbox string // Email mailbox (like "hostmaster.example.net.") Refresh uint32 // Defaults to a reasonable value Retry uint32 // Defaults to a reasonable value Expire uint32 // Defaults to a reasonable value TTL uint32 // Defaults to a reasonable value }
SOA and primary NS record information. NS and Mbox fields must both be specified or empty. If they are specified, the server is authoritative for all zones (which are specified elsewhere).
TTL is used for SOA and NS records' TTL and MINIMUM values.
Click to show internal directories.
Click to hide internal directories.