Documentation
¶
Overview ¶
Package zone handles master files which may be textual data formated as per RFC 1035 chapter 5 or binary data produced by Compiler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Load ¶
Load attempts to load a zone/master (RFC1034/5.1) file from fname. On syntax error the errHandler is invoked if it's not nil, otherwise the loading is aborted and Error returned. If errHandler is not nil and returns false the loading is also aborted. On unrecoverable errors like file not found the load is aborted and Error returned. rrHandler is invoked for every resource record found in the zone file. If rrHandler returns false the loading is aborted and returns nil Error.
Types ¶
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
Compiler is an object for compiling (large amounts of) DNS resource records to binary data for faster loading (no tokenizing/parsing).
func NewCompiler ¶
NewCompiler returns a newly created Compiler writing to w. The produced binary data may be embeded in another data as their end (a logical EOF) is marked on creation and detected on loading. Compiled RRs are also smaller than the original textual data. The data compression ratio on some measured real world sample of cca 3.5 million RRs was about 60% (i.e. space savings were about 40%).
func (*Compiler) Done ¶
Done marks the logical EOF of the compiled RRs block. After calling Done the Compiler is no more usable and will panic on attempts to use it. If the io.Writer passed to NewCompiler is an bufio.Writer then the user of Compiler is responsible for calling Writer.Flush and possibly Writer.Close after calling Compiler.Done. The semantics of Done are like os.File.Close except that no io.Writer closing is performed and the closed entity is the Compiler per se.
Warning: Failure to invoke Done as a last task of a compilation causes loss and/or corruption of the produced binary data.