Documentation
¶
Overview ¶
Package present turns DNS presentation form (RFC 1035 master file syntax) into bdns leaves and back. It is the one place a DNS library is used: the command and the renderer import it, the codec and the module never do.
A name in a record's data is written as a name part (docs/spec.md section 3), never as bytes: relative to the origin when it is written without a trailing dot, absolute when it ends in one. A type that carries a name and that this package has no layout for is refused, so no name is ever copied into a byte part.
Index ¶
- Variables
- func Leaf(name, ttl, typ string, records []string, domain string) (*zonerec.Leaf, error)
- func Master(typ uint16, d zonerec.Data, origin []string) (typeText, text string, ok bool)
- func Owner(name, domain string) (zonerec.Name, error)
- func Record(typ uint16, d zonerec.Data) string
- func Records(l *zonerec.Leaf) []string
- func Type(s string) (uint16, error)
- func TypeName(t uint16) string
- func WellFormed(typ uint16, d zonerec.Data, origin []string) bool
- func Zone(r io.Reader, domain, file string) (leaves []*zonerec.Leaf, notes []string, err error)
Constants ¶
This section is empty.
Variables ¶
var ErrNamedType = errors.New("present: the type's data carries a name bdns has no layout for yet")
ErrNamedType is a record type whose data carries a name in a layout this package does not know.
Functions ¶
func Leaf ¶
Leaf reads one record set from its presentation form: a name, a TTL, a type, and one argument for each record's data, as in
www 300 A 192.0.2.1 192.0.2.2 @ 3600 MX "10 mail"
A name in the data is relative to the origin unless it ends in a dot. domain, when set, lets the leaf's own name be written in full.
func Master ¶
Master is one record as an RFC 1035 master file holds it under origin, the origin's labels leftmost first: the type as the file names it and the data after it. It is Record's form (a relative name stays relative, for a file that sets $ORIGIN) only when that text, read back as one line of a master file under origin, is exactly the data's wire bytes. Any other data is written in RFC 3597 form, TYPE<n> and \# <length> <hex> over the wire bytes with each name in full: nothing a leaf holds reaches the file as text unless a parser gives the same bytes back.
It is false when a name would pass 255 bytes under origin, and when the data is not data of its type, for a type this package knows the layout of (WellFormed): a server that knows the type refuses such a record in any form, and with it the whole file.
func Owner ¶
Owner reads a leaf's name: "@" is the apex, a name without a trailing dot is relative to the origin, and a name with one must be at or under domain, which is then needed.
func WellFormed ¶
WellFormed reports whether the data, on the wire under origin, is data of its type: for a type with a layout in the DNS library, the bytes read as that layout and write back the same. Data of a type the library does not know is always well formed. False too when a name would pass 255 bytes under origin.
func Zone ¶
Zone reads an RFC 1035 master file for domain into leaves in key order. Names at or under domain, a leaf's own and those in data, are written relative to the origin; any other name in data stays absolute. SOA and DNSSEC records are left out, one note for each type. $INCLUDE is not followed.
Types ¶
This section is empty.