Documentation
¶
Overview ¶
Package zone bridges miekg/dns RR types and pkg/object Blob payloads.
It owns:
- The canonical RRset byte format (per docs/OBJECT_MODEL.md §4).
- RFC 1035 zonefile import/export via miekg/dns.
Everything DNS-aware lives here. pkg/object is intentionally kept DNS-unaware so that the canonical-encoding rules can evolve without touching the hash/object machinery.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeRRset ¶
EncodeRRset serializes the canonical bytes of an RRset.
Format (see docs/OBJECT_MODEL.md §4):
version uint8
owner DNS name in RFC 4034 canonical wire form (lowercased, length-prefixed)
class uint16 BE
type uint16 BE
ttl uint32 BE
rr_count uint16 BE
rr_recs sorted [count]{ length:uint16 BE, bytes:[]byte }
Sorting is by raw rdata bytes, lexicographically. This makes {1.2.3.4, 5.6.7.8} and {5.6.7.8, 1.2.3.4} hash identically.
Types ¶
type RRset ¶
type RRset struct {
Key RRsetKey
TTL uint32
RRs []dns.RR // all share the same Header() name/class/type
}
RRset is a logical grouping of RRs sharing (owner, class, type) plus a shared TTL. miekg/dns RR.Header().Ttl is the source of truth at encode time; we collapse to the first RR's TTL (callers must homogenize beforehand).
func BumpSOASerial ¶ added in v0.3.0
BumpSOASerial returns a new RRset identical to soa but with the SOA's Serial field incremented by 1 (mod 2^32 per RFC 1982 serial arithmetic).
The input must be an apex SOA RRset (exactly one RR, type SOA). Anything else is an error: SOA is by definition single-record, and bumping a non-SOA RRset makes no sense.
Callers re-encode the returned RRset via EncodeRRset and re-stage it on the next commit, which is what pkg/repo.Commit does automatically when other RRsets change.
func DecodeRRset ¶
DecodeRRset reverses EncodeRRset.
func ImportZonefile ¶
ImportZonefile parses an RFC 1035 zonefile and groups its RRs into RRsets. `origin` is the default owner (e.g. "foo.com.") used for relative names.
All RRs sharing (owner, class, type) are merged into one RRset. If their TTLs differ, the smallest is chosen (matching common DNS server behavior).