Documentation
¶
Overview ¶
Package implement a DNS zone, held in a binary tree. Each RR(set) that gets inserted will need to create any empty non-terminals (ENT) it possesses. I.e. inserting www.example.org into example.org is easy, but when www.a.b.c.example.org inserts we need to make sure that 'c.example.org', 'b.c.example.org' and 'a.b.c.example.org' also exist and are ENTs (have no actual RRs). For deleted the opposite must happen. As an example from RFC 4592, the record: sub.*.example. TXT "this is not a wildcard" is a fun one. As this means the '*.example' ENT exists meaning that bogus.example. gets a NODATA response instead of NXDOMAIN.
Doing this on insert sucks a bit, but makes the lookup code much more simple (and correct), which is more important for a DNS server.
CNAME, DNSSEC, wildcards, etc. are all supported. Not supported is: DNAME (RFC 6672), the server will just return the DNAME without any of the (in the RFC required) post-processing.
Index ¶
- type Zone
- func (z *Zone) Apex() dnszone.Node
- func (z *Zone) AuthoritativeWalk(fn func(dnszone.Node, bool) bool)
- func (z *Zone) Get(name string) (dnszone.Node, bool)
- func (z *Zone) Labels() int
- func (z *Zone) Load() error
- func (z *Zone) Origin() string
- func (z *Zone) Previous(name string) dnszone.Node
- func (z *Zone) Set(node dnszone.Node) string
- func (z *Zone) Walk(fn func(dnszone.Node) bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Zone ¶
type Zone struct { Path string Tree *btree.BTreeG[dnszone.Node] // contains filtered or unexported fields }
Zone holds the main zone and some meta data of the DNS zone we are serving. There is no locking, because after creation this structure is basically read-only. Tree will be used to write, but that has its own locking.
func (*Zone) AuthoritativeWalk ¶
AuthoritativeWalk walks the the zone, but keeps track of authoritative names and call fn auth a boolean indicating is the name is considered that.
func (*Zone) Load ¶
Load loads a new zone with origin from path from z. Load also sets the apex, so the z.Apex can return that.