Documentation ¶
Index ¶
- Variables
- func ReleaseA(r *A)
- func ReleaseAAAA(r *AAAA)
- func ReleaseMX(r *MX)
- func ReleaseMsg(m *Msg)
- func ReleaseNAME(r *NAMEResource)
- func ReleaseName(n Name)
- func ReleaseQuestion(q *Question)
- func ReleaseRaw(r *RawResource)
- func ReleaseResource(r Resource)
- func ReleaseSOA(r *SOA)
- func ReleaseSRV(r *SRV)
- func RemoveEDNS0(m *Msg)
- func ToLowerName(n []byte) error
- func ToReadable(n []byte) (pool.Buffer, error)
- type A
- type AAAA
- type Class
- type Header
- type MX
- type Msg
- type NAMEResource
- type Name
- type NameBuilder
- type NameScanner
- type OpCode
- type Question
- type RCode
- type RawResource
- type Resource
- type ResourceHdr
- type SOA
- type SRV
- type Type
Constants ¶
This section is empty.
Variables ¶
var (
ErrSmallBuffer = errors.New("buffer is too small")
)
Functions ¶
func ReleaseAAAA ¶
func ReleaseAAAA(r *AAAA)
func ReleaseMsg ¶
func ReleaseMsg(m *Msg)
func ReleaseNAME ¶
func ReleaseNAME(r *NAMEResource)
func ReleaseName ¶
func ReleaseName(n Name)
func ReleaseQuestion ¶
func ReleaseQuestion(q *Question)
func ReleaseRaw ¶
func ReleaseRaw(r *RawResource)
func ReleaseResource ¶
func ReleaseResource(r Resource)
func ReleaseSOA ¶
func ReleaseSOA(r *SOA)
func ReleaseSRV ¶
func ReleaseSRV(r *SRV)
func RemoveEDNS0 ¶
func RemoveEDNS0(m *Msg)
func ToLowerName ¶
func ToReadable ¶
Convert n from wire format to common readable format. Root domain will be '.' . Labels will be split by '.' . No '.' at the end of the name. Unprintable characters will be escaped as "\DDD". '.' and '\' will be "\.", "\\". If n is invalid, returns nil, err.
Types ¶
type AAAA ¶
type AAAA struct { ResourceHdr AAAA [16]byte }
func (*AAAA) Hdr ¶
func (r *AAAA) Hdr() *ResourceHdr
type Header ¶
type Header struct { ID uint16 Response bool OpCode OpCode Authoritative bool Truncated bool RecursionDesired bool RecursionAvailable bool AuthenticData bool CheckingDisabled bool RCode RCode }
Header is a representation of a DNS message header.
type MX ¶
type MX struct { ResourceHdr Pref uint16 MX Name }
func (*MX) Hdr ¶
func (r *MX) Hdr() *ResourceHdr
type Msg ¶
type Msg struct { Header Questions []*Question Answers []Resource Authorities []Resource Additionals []Resource }
func (*Msg) Pack ¶
Pack m into b. Returns the msg size. compression == true will only compress rr header. Size is the msg size limit. Upon reach the limit, no rr will be packed and the msg will be "Truncated". Minimum is 512. 0 means no limit. The size of b should be m.Len(). If b is not big enough, an error will be returned. Without compression, the msg will have the size of m.Len(). TODO: Calculate compressed length?
type NAMEResource ¶
type NAMEResource struct { ResourceHdr NameData Name }
CNAME, NS, PTR
func NewNAME ¶
func NewNAME() *NAMEResource
func (*NAMEResource) Hdr ¶
func (r *NAMEResource) Hdr() *ResourceHdr
type NameBuilder ¶
type NameBuilder struct {
// contains filtered or unexported fields
}
func (*NameBuilder) AppendLabel ¶
func (b *NameBuilder) AppendLabel(s []byte) error
func (*NameBuilder) Data ¶
func (b *NameBuilder) Data() []byte
func (*NameBuilder) Parse ¶
func (b *NameBuilder) Parse(labels [][]byte) error
func (*NameBuilder) ParseReadable ¶
func (b *NameBuilder) ParseReadable(s []byte) error
Empty s or "." will be the root domain. Both FQDN/non-FQDN are OK.
Note: escaping ("\.", "\DDD" etc.) is not supported yet and will be parsed as part of the label. Which is not as expected. TODO: Support escaping or return an error.
func (*NameBuilder) Reset ¶
func (b *NameBuilder) Reset()
func (*NameBuilder) ToName ¶
func (b *NameBuilder) ToName() Name
type NameScanner ¶
type NameScanner struct {
// contains filtered or unexported fields
}
func NewNameScanner ¶
func NewNameScanner(n []byte) NameScanner
func (*NameScanner) Err ¶
func (s *NameScanner) Err() error
func (*NameScanner) Label ¶
func (s *NameScanner) Label() []byte
func (*NameScanner) LabelOff ¶
func (s *NameScanner) LabelOff() int
func (*NameScanner) Scan ¶
func (s *NameScanner) Scan() bool
type Question ¶
func NewQuestion ¶
func NewQuestion() *Question
type RawResource ¶
type RawResource struct { ResourceHdr Data pool.Buffer }
func NewRaw ¶
func NewRaw() *RawResource
func (*RawResource) Hdr ¶
func (r *RawResource) Hdr() *ResourceHdr
type Resource ¶
type Resource interface { Hdr() *ResourceHdr // contains filtered or unexported methods }
type ResourceHdr ¶
type SOA ¶
type SOA struct { ResourceHdr NS Name MBox Name Serial uint32 Refresh uint32 Retry uint32 Expire uint32 MinTTL uint32 }
func (*SOA) Hdr ¶
func (r *SOA) Hdr() *ResourceHdr
type SRV ¶
type SRV struct { ResourceHdr Priority uint16 Weight uint16 Port uint16 Target Name // Not compressed as per RFC 2782. }
func (*SRV) Hdr ¶
func (r *SRV) Hdr() *ResourceHdr
type Type ¶
type Type uint16
A Type is a type of DNS request and response.
const ( // ResourceHeader.Type and Question.Type TypeA Type = 1 TypeNS Type = 2 TypeCNAME Type = 5 TypeSOA Type = 6 TypePTR Type = 12 TypeMX Type = 15 TypeTXT Type = 16 TypeAAAA Type = 28 TypeSRV Type = 33 TypeOPT Type = 41 // Question.Type TypeWKS Type = 11 TypeHINFO Type = 13 TypeMINFO Type = 14 TypeAXFR Type = 252 TypeALL Type = 255 )