Documentation
¶
Index ¶
- Constants
- Variables
- func TypeToString(t uint16) string
- func UpdateTTL(record RR, expire time.Time)
- type A
- func (rr *A) Header() *Header
- func (rr *A) IsSame(o RR) bool
- func (rr *A) Len() uint16
- func (rr *A) Pack(buf []byte, offset int, _ compression.Map) (int, error)
- func (rr *A) SetData(data ...interface{}) error
- func (rr *A) SetHeader(header Header)
- func (rr *A) String() string
- func (rr *A) Unpack(data []byte, offset int) (int, error)
- type AAAA
- func (rr *AAAA) Header() *Header
- func (rr *AAAA) IsSame(o RR) bool
- func (rr *AAAA) Len() uint16
- func (rr *AAAA) Pack(buf []byte, offset int, _ compression.Map) (int, error)
- func (rr *AAAA) SetData(data ...interface{}) error
- func (rr *AAAA) SetHeader(header Header)
- func (rr *AAAA) String() string
- func (rr *AAAA) Unpack(data []byte, offset int) (int, error)
- type CNAME
- func (rr *CNAME) Header() *Header
- func (rr *CNAME) IsSame(o RR) bool
- func (rr *CNAME) Len() uint16
- func (rr *CNAME) Pack(buf []byte, offset int, comp compression.Map) (int, error)
- func (rr *CNAME) SetData(data ...interface{}) error
- func (rr *CNAME) SetHeader(header Header)
- func (rr *CNAME) String() string
- func (rr *CNAME) Unpack(data []byte, offset int) (int, error)
- type HINFO
- func (rr *HINFO) Header() *Header
- func (rr *HINFO) IsSame(o RR) bool
- func (rr *HINFO) Len() uint16
- func (rr *HINFO) Pack(buf []byte, offset int, _ compression.Map) (int, error)
- func (rr *HINFO) SetData(data ...interface{}) error
- func (rr *HINFO) SetHeader(header Header)
- func (rr *HINFO) String() string
- func (rr *HINFO) Unpack(data []byte, offset int) (int, error)
- type Header
- type MB
- func (rr *MB) Header() *Header
- func (rr *MB) IsSame(o RR) bool
- func (rr *MB) Len() uint16
- func (rr *MB) Pack(buf []byte, offset int, comp compression.Map) (int, error)
- func (rr *MB) SetData(data ...interface{}) error
- func (rr *MB) SetHeader(header Header)
- func (rr *MB) String() string
- func (rr *MB) Unpack(data []byte, offset int) (int, error)
- type MD
- func (rr *MD) Header() *Header
- func (rr *MD) IsSame(o RR) bool
- func (rr *MD) Len() uint16
- func (rr *MD) Pack(buf []byte, offset int, comp compression.Map) (int, error)
- func (rr *MD) SetData(data ...interface{}) error
- func (rr *MD) SetHeader(header Header)
- func (rr *MD) String() string
- func (rr *MD) Unpack(data []byte, offset int) (int, error)
- type MF
- func (rr *MF) Header() *Header
- func (rr *MF) IsSame(o RR) bool
- func (rr *MF) Len() uint16
- func (rr *MF) Pack(buf []byte, offset int, comp compression.Map) (int, error)
- func (rr *MF) SetData(data ...interface{}) error
- func (rr *MF) SetHeader(header Header)
- func (rr *MF) String() string
- func (rr *MF) Unpack(data []byte, offset int) (int, error)
- type MG
- func (rr *MG) Header() *Header
- func (rr *MG) IsSame(o RR) bool
- func (rr *MG) Len() uint16
- func (rr *MG) Pack(buf []byte, offset int, comp compression.Map) (int, error)
- func (rr *MG) SetData(data ...interface{}) error
- func (rr *MG) SetHeader(header Header)
- func (rr *MG) String() string
- func (rr *MG) Unpack(data []byte, offset int) (int, error)
- type MINFO
- func (rr *MINFO) Header() *Header
- func (rr *MINFO) IsSame(o RR) bool
- func (rr *MINFO) Len() uint16
- func (rr *MINFO) Pack(buf []byte, offset int, comp compression.Map) (int, error)
- func (rr *MINFO) SetData(data ...interface{}) error
- func (rr *MINFO) SetHeader(header Header)
- func (rr *MINFO) String() string
- func (rr *MINFO) Unpack(data []byte, offset int) (int, error)
- type MR
- func (rr *MR) Header() *Header
- func (rr *MR) IsSame(o RR) bool
- func (rr *MR) Len() uint16
- func (rr *MR) Pack(buf []byte, offset int, comp compression.Map) (int, error)
- func (rr *MR) SetData(data ...interface{}) error
- func (rr *MR) SetHeader(header Header)
- func (rr *MR) String() string
- func (rr *MR) Unpack(data []byte, offset int) (int, error)
- type MX
- func (rr *MX) Header() *Header
- func (rr *MX) IsSame(o RR) bool
- func (rr *MX) Len() uint16
- func (rr *MX) Pack(buf []byte, offset int, comp compression.Map) (int, error)
- func (rr *MX) SetData(data ...interface{}) error
- func (rr *MX) SetHeader(header Header)
- func (rr *MX) String() string
- func (rr *MX) Unpack(data []byte, offset int) (int, error)
- type NS
- func (rr *NS) Header() *Header
- func (rr *NS) IsSame(o RR) bool
- func (rr *NS) Len() uint16
- func (rr *NS) Pack(buf []byte, offset int, comp compression.Map) (int, error)
- func (rr *NS) SetData(data ...interface{}) error
- func (rr *NS) SetHeader(header Header)
- func (rr *NS) String() string
- func (rr *NS) Unpack(data []byte, offset int) (int, error)
- type NULL
- func (rr *NULL) Header() *Header
- func (rr *NULL) IsSame(o RR) bool
- func (rr *NULL) Len() uint16
- func (rr *NULL) Pack(data []byte, offset int, _ compression.Map) (int, error)
- func (rr *NULL) SetData(data ...interface{}) error
- func (rr *NULL) SetHeader(header Header)
- func (rr *NULL) String() string
- func (rr *NULL) Unpack(data []byte, offset int) (int, error)
- type OPT
- func (rr *OPT) Header() *Header
- func (rr *OPT) IsSame(o RR) bool
- func (rr *OPT) Len() uint16
- func (rr *OPT) Pack(buf []byte, offset int, _ compression.Map) (int, error)
- func (rr *OPT) SetData(data ...interface{}) error
- func (rr *OPT) SetHeader(header Header)
- func (rr *OPT) String() string
- func (rr *OPT) Unpack(data []byte, offset int) (int, error)
- type PTR
- func (rr *PTR) Header() *Header
- func (rr *PTR) IsSame(o RR) bool
- func (rr *PTR) Len() uint16
- func (rr *PTR) Pack(buf []byte, offset int, comp compression.Map) (int, error)
- func (rr *PTR) SetData(data ...interface{}) error
- func (rr *PTR) SetHeader(header Header)
- func (rr *PTR) String() string
- func (rr *PTR) Unpack(data []byte, offset int) (int, error)
- type RR
- type SOA
- func (rr *SOA) Header() *Header
- func (rr *SOA) IsSame(o RR) bool
- func (rr *SOA) Len() uint16
- func (rr *SOA) Pack(buf []byte, offset int, comp compression.Map) (int, error)
- func (rr *SOA) SerialAdd(n int) error
- func (rr *SOA) SerialCompare(soa *SOA) SerialComparison
- func (rr *SOA) SetData(data ...interface{}) error
- func (rr *SOA) SetHeader(header Header)
- func (rr *SOA) String() string
- func (rr *SOA) Unpack(data []byte, offset int) (int, error)
- type SerialComparison
- type TXT
- func (rr *TXT) Header() *Header
- func (rr *TXT) IsSame(o RR) bool
- func (rr *TXT) Len() uint16
- func (rr *TXT) Pack(buf []byte, offset int, _ compression.Map) (int, error)
- func (rr *TXT) SetData(data ...interface{}) error
- func (rr *TXT) SetHeader(header Header)
- func (rr *TXT) String() string
- func (rr *TXT) Unpack(data []byte, offset int) (int, error)
Constants ¶
const ( IN uint16 = 1 // The Internet CS uint16 = 2 // The CSNET class (Obsolete - used only for examples in some obsolete RFCs) CH uint16 = 3 // The CHAOS class HS uint16 = 4 // Hesiod [Dyer 87] ANY uint16 = 255 // Any class (*) )
Class describes RR class codes. See https://datatracker.ietf.org/doc/html/rfc1035#section-3.2.4
const ( TypeNone uint16 = 0 TypeA uint16 = 1 // A host address TypeNS uint16 = 2 // An authoritative name server TypeMD uint16 = 3 // A mail destination (Obsolete - use MX) TypeMF uint16 = 4 // A mail forwarded (Obsolete - use MX) TypeCNAME uint16 = 5 // The canonical name for an alias TypeSOA uint16 = 6 // Marks the start of a zone of authority TypeMB uint16 = 7 // A mailbox domain name (EXPERIMENTAL) TypeMG uint16 = 8 // A mail group member (EXPERIMENTAL) TypeMR uint16 = 9 // A mail rename domain name (EXPERIMENTAL) TypeNULL uint16 = 10 // A null RR (EXPERIMENTAL) TypePTR uint16 = 12 // A domain name pointer TypeHINFO uint16 = 13 // Host information TypeMINFO uint16 = 14 // Mailbox or mail list information TypeMX uint16 = 15 // Mail exchange TypeTXT uint16 = 16 // Text strings TypeAAAA uint16 = 28 // AAAA host address TypeOPT uint16 = 41 // OPT Record / Meta record TypeAXFR uint16 = 252 // A request for a transfer of an entire zone TypeMAILB uint16 = 253 // A request for mailbox-related records (MB, MG or MR) TypeMAILA uint16 = 254 // A request for mail agent RRs (Obsolete - see MX) TypeANY uint16 = 255 // A request for all records (*) )
Variables ¶
var ( ErrNoSuchType = errors.New("no such RR type") ErrFailedToConvertRRData = errors.New("failed to convert RR data") ErrInvalidRRData = errors.New("invalid RR data") )
var (
ErrSOASerialOutOfRange = errors.New("serial out of range")
)
Functions ¶
func TypeToString ¶
Types ¶
type Header ¶
type Header struct { // Name specifies an owner name Name string // Type specifies a RR type code Type uint16 // Class specifies a RR class code Class uint16 // TTL specifies the time interval in seconds that the RR // may be cached before it should be considered outdated TTL uint32 // RDLength specifies the length of RDATA in octets RDLength uint16 // Additional Expires field. This helps to more easily handle cached records Expires int64 }
Header describes header data of a resource record. See https://datatracker.ietf.org/doc/html/rfc1035#section-3.2.1
type MB ¶
See https://datatracker.ietf.org/doc/html/rfc1035#section-3.3.3 (EXPERIMENTAL)
type MD ¶
https://datatracker.ietf.org/doc/html/rfc1035#section-3.3.4 (Obsolete)
type MF ¶
See https://datatracker.ietf.org/doc/html/rfc1035#section-3.3.5 (Obsolete)
type MG ¶
See https://datatracker.ietf.org/doc/html/rfc1035#section-3.3.6 (EXPERIMENTAL)
type MINFO ¶
See https://datatracker.ietf.org/doc/html/rfc1035#section-3.3.7 (EXPERIMENTAL)
type MR ¶
See https://datatracker.ietf.org/doc/html/rfc1035#section-3.3.8 (EXPERIMENTAL)
type RR ¶
type RR interface { // Get header of RR Header() *Header // Set header of RR SetHeader(Header) // Set resource record data SetData(...interface{}) error // String returns the representation of any RR as text String() string // Len returns the records RDLENGTH Len() uint16 // IsSame compares both RRs and returns if they are the same IsSame(RR) bool // Unpack unpacks the RDATA Unpack([]byte, int) (int, error) // Pack packs the RDATA Pack([]byte, int, compression.Map) (int, error) }
RR describes a resource record. Information of a (domain) name is composed of a set of resource records. See https://datatracker.ietf.org/doc/html/rfc1035#section-3.2
type SOA ¶
type SOA struct { H Header MName string RName string Serial uint32 Refresh uint32 Retry uint32 Expire uint32 Minimum uint32 }
See https://datatracker.ietf.org/doc/html/rfc1035#section-3.3.13
func (*SOA) SerialCompare ¶
func (rr *SOA) SerialCompare(soa *SOA) SerialComparison
type SerialComparison ¶
type SerialComparison int
const ( SerialEqual SerialComparison = iota SerialLess SerialGreater )