Documentation ¶
Index ¶
- Variables
- func NewRequestRecordWithReader(reader *Reader) (*record, error)
- type AAAARecord
- func (a *AAAARecord) Address() net.IP
- func (r AAAARecord) Bytes() ([]byte, error)
- func (r AAAARecord) Class() Class
- func (r AAAARecord) CompressionBytes() []byte
- func (a *AAAARecord) Content() string
- func (r AAAARecord) Data() []byte
- func (r AAAARecord) Equal(other ResourceRecord) bool
- func (r AAAARecord) HasNamePrefix(prefix string) bool
- func (r AAAARecord) HasNameSuffix(suffix string) bool
- func (r AAAARecord) IsName(name string) bool
- func (r AAAARecord) Name() string
- func (r AAAARecord) Reader() (*Reader, error)
- func (r AAAARecord) RequestBytes() ([]byte, error)
- func (r AAAARecord) ResponseBytes() ([]byte, error)
- func (r AAAARecord) SetClass(cls Class) Record
- func (r AAAARecord) SetCompressionBytes(b []byte)
- func (r AAAARecord) SetData(b []byte) Record
- func (r AAAARecord) SetName(name string) Record
- func (r AAAARecord) SetTTL(ttl uint) Record
- func (r AAAARecord) SetType(typ Type) Record
- func (r AAAARecord) SetUnicastResponse(enabled bool) Record
- func (r AAAARecord) TTL() uint
- func (r AAAARecord) Type() Type
- func (r AAAARecord) UnicastResponse() bool
- type ARecord
- func (a *ARecord) Address() net.IP
- func (r ARecord) Bytes() ([]byte, error)
- func (r ARecord) Class() Class
- func (r ARecord) CompressionBytes() []byte
- func (a *ARecord) Content() string
- func (r ARecord) Data() []byte
- func (r ARecord) Equal(other ResourceRecord) bool
- func (r ARecord) HasNamePrefix(prefix string) bool
- func (r ARecord) HasNameSuffix(suffix string) bool
- func (r ARecord) IsName(name string) bool
- func (r ARecord) Name() string
- func (r ARecord) Reader() (*Reader, error)
- func (r ARecord) RequestBytes() ([]byte, error)
- func (r ARecord) ResponseBytes() ([]byte, error)
- func (r ARecord) SetClass(cls Class) Record
- func (r ARecord) SetCompressionBytes(b []byte)
- func (r ARecord) SetData(b []byte) Record
- func (r ARecord) SetName(name string) Record
- func (r ARecord) SetTTL(ttl uint) Record
- func (r ARecord) SetType(typ Type) Record
- func (r ARecord) SetUnicastResponse(enabled bool) Record
- func (r ARecord) TTL() uint
- func (r ARecord) Type() Type
- func (r ARecord) UnicastResponse() bool
- type Addition
- type Additions
- type Answer
- type Answers
- type Attribute
- type Attributes
- type Class
- type Header
- func (header *Header) AA() bool
- func (header *Header) AD() bool
- func (header *Header) AN() uint
- func (header *Header) AR() uint
- func (header *Header) Bytes() []byte
- func (header *Header) CD() bool
- func (header *Header) Copy() *Header
- func (header *Header) Equal(other *Header) bool
- func (header *Header) Flags() []byte
- func (header *Header) ID() uint
- func (header *Header) IsQuery() bool
- func (header *Header) IsResponse() bool
- func (header *Header) NS() uint
- func (header *Header) Opcode() Opcode
- func (header *Header) Parse(reader io.Reader) error
- func (header *Header) QD() uint
- func (header *Header) QR() QR
- func (header *Header) RA() bool
- func (header *Header) RD() bool
- func (header *Header) ResponseCode() ResponseCode
- func (header *Header) String() string
- func (header *Header) TC() bool
- func (header *Header) Z() bool
- type Message
- func (msg *Message) AddAddition(a Addition)
- func (msg *Message) AddAnswer(a Answer)
- func (msg *Message) AddNameServer(ns NameServer)
- func (msg *Message) AddQuestion(q *Question)
- func (msg *Message) Bytes() []byte
- func (msg *Message) Copy() *Message
- func (msg *Message) Equal(other *Message) bool
- func (msg *Message) HasResourceRecord(name string) bool
- func (msg *Message) LookupResourceRecordForName(name string) (ResourceRecord, bool)
- func (msg *Message) LookupResourceRecordForNamePrefix(prefix string) (ResourceRecord, bool)
- func (msg *Message) LookupResourceRecordForNameSuffix(prefix string) (ResourceRecord, bool)
- func (msg *Message) Parse(msgBytes []byte) error
- func (msg *Message) Records() Records
- func (msg *Message) ResourceRecords() ResourceRecords
- func (msg *Message) String() string
- type MessageHandler
- type NSECRecord
- func (r NSECRecord) Bytes() ([]byte, error)
- func (r NSECRecord) Class() Class
- func (r NSECRecord) CompressionBytes() []byte
- func (nsec *NSECRecord) Content() string
- func (r NSECRecord) Data() []byte
- func (r NSECRecord) Equal(other ResourceRecord) bool
- func (r NSECRecord) HasNamePrefix(prefix string) bool
- func (r NSECRecord) HasNameSuffix(suffix string) bool
- func (r NSECRecord) IsName(name string) bool
- func (r NSECRecord) Name() string
- func (r NSECRecord) Reader() (*Reader, error)
- func (r NSECRecord) RequestBytes() ([]byte, error)
- func (r NSECRecord) ResponseBytes() ([]byte, error)
- func (r NSECRecord) SetClass(cls Class) Record
- func (r NSECRecord) SetCompressionBytes(b []byte)
- func (r NSECRecord) SetData(b []byte) Record
- func (r NSECRecord) SetName(name string) Record
- func (r NSECRecord) SetTTL(ttl uint) Record
- func (r NSECRecord) SetType(typ Type) Record
- func (r NSECRecord) SetUnicastResponse(enabled bool) Record
- func (r NSECRecord) TTL() uint
- func (r NSECRecord) Type() Type
- func (r NSECRecord) UnicastResponse() bool
- type NameServer
- type NameServers
- type Opcode
- type PTRRecord
- func (r PTRRecord) Bytes() ([]byte, error)
- func (r PTRRecord) Class() Class
- func (r PTRRecord) CompressionBytes() []byte
- func (ptr *PTRRecord) Content() string
- func (r PTRRecord) Data() []byte
- func (ptr *PTRRecord) DomainName() string
- func (r PTRRecord) Equal(other ResourceRecord) bool
- func (r PTRRecord) HasNamePrefix(prefix string) bool
- func (r PTRRecord) HasNameSuffix(suffix string) bool
- func (r PTRRecord) IsName(name string) bool
- func (r PTRRecord) Name() string
- func (r PTRRecord) Reader() (*Reader, error)
- func (r PTRRecord) RequestBytes() ([]byte, error)
- func (r PTRRecord) ResponseBytes() ([]byte, error)
- func (r PTRRecord) SetClass(cls Class) Record
- func (r PTRRecord) SetCompressionBytes(b []byte)
- func (r PTRRecord) SetData(b []byte) Record
- func (r PTRRecord) SetName(name string) Record
- func (r PTRRecord) SetTTL(ttl uint) Record
- func (r PTRRecord) SetType(typ Type) Record
- func (r PTRRecord) SetUnicastResponse(enabled bool) Record
- func (r PTRRecord) TTL() uint
- func (r PTRRecord) Type() Type
- func (r PTRRecord) UnicastResponse() bool
- type QR
- type Question
- func (r Question) Bytes() ([]byte, error)
- func (r Question) Class() Class
- func (r Question) CompressionBytes() []byte
- func (r Question) Content() string
- func (r Question) Data() []byte
- func (r Question) Equal(other ResourceRecord) bool
- func (r Question) HasNamePrefix(prefix string) bool
- func (r Question) HasNameSuffix(suffix string) bool
- func (r Question) IsName(name string) bool
- func (r Question) Name() string
- func (r Question) Reader() (*Reader, error)
- func (r Question) RequestBytes() ([]byte, error)
- func (r Question) ResponseBytes() ([]byte, error)
- func (r Question) SetClass(cls Class) Record
- func (r Question) SetCompressionBytes(b []byte)
- func (r Question) SetData(b []byte) Record
- func (r Question) SetName(name string) Record
- func (r Question) SetTTL(ttl uint) Record
- func (r Question) SetType(typ Type) Record
- func (r Question) SetUnicastResponse(enabled bool) Record
- func (r Question) TTL() uint
- func (r Question) Type() Type
- func (r Question) UnicastResponse() bool
- type Questions
- type Reader
- func (reader *Reader) CompressionBytes() []byte
- func (reader *Reader) Read(p []byte) (int, error)
- func (reader *Reader) ReadName() (string, error)
- func (reader *Reader) ReadString() (string, error)
- func (reader *Reader) ReadStrings() ([]string, error)
- func (reader *Reader) ReadUint16() (uint16, error)
- func (reader *Reader) ReadUint32() (uint32, error)
- func (reader *Reader) ReadUint8() (uint8, error)
- func (reader *Reader) SetCompressionBytes(b []byte)
- type Record
- type Records
- func (records Records) HasRecord(name string) bool
- func (records Records) LookupAAAARecords() []*AAAARecord
- func (records Records) LookupARecords() []*ARecord
- func (records Records) LookupPTRRecords() []*PTRRecord
- func (records Records) LookupRecordForName(name string) (Record, bool)
- func (records Records) LookupRecordForNamePrefix(prefix string) (Record, bool)
- func (records Records) LookupRecordForNameSuffix(suffix string) (Record, bool)
- func (records Records) LookupRecordForType(t Type) (Record, bool)
- func (records Records) LookupRecordsForName(name string) Records
- func (records Records) LookupRecordsForNamePrefix(prefix string) Records
- func (records Records) LookupRecordsForNameSuffix(suffix string) Records
- func (records Records) LookupRecordsForType(t Type) []Record
- func (records Records) LookupSRVRecords() []*SRVRecord
- func (records Records) LookupTXTRecords() []*TXTRecord
- func (records Records) String() string
- type ResourceRecord
- type ResourceRecords
- type ResponseCode
- type SRVRecord
- func (r SRVRecord) Bytes() ([]byte, error)
- func (r SRVRecord) Class() Class
- func (r SRVRecord) CompressionBytes() []byte
- func (srv *SRVRecord) Content() string
- func (r SRVRecord) Data() []byte
- func (r SRVRecord) Equal(other ResourceRecord) bool
- func (r SRVRecord) HasNamePrefix(prefix string) bool
- func (r SRVRecord) HasNameSuffix(suffix string) bool
- func (r SRVRecord) IsName(name string) bool
- func (srv *SRVRecord) Name() string
- func (srv *SRVRecord) Port() uint
- func (srv *SRVRecord) Priority() uint
- func (srv *SRVRecord) Proto() string
- func (r SRVRecord) Reader() (*Reader, error)
- func (r SRVRecord) RequestBytes() ([]byte, error)
- func (r SRVRecord) ResponseBytes() ([]byte, error)
- func (srv *SRVRecord) Service() string
- func (r SRVRecord) SetClass(cls Class) Record
- func (r SRVRecord) SetCompressionBytes(b []byte)
- func (r SRVRecord) SetData(b []byte) Record
- func (r SRVRecord) SetName(name string) Record
- func (r SRVRecord) SetTTL(ttl uint) Record
- func (r SRVRecord) SetType(typ Type) Record
- func (r SRVRecord) SetUnicastResponse(enabled bool) Record
- func (r SRVRecord) TTL() uint
- func (srv *SRVRecord) Target() string
- func (r SRVRecord) Type() Type
- func (r SRVRecord) UnicastResponse() bool
- func (srv *SRVRecord) Weight() uint
- type TXTRecord
- func (txt *TXTRecord) Attributes() (Attributes, error)
- func (r TXTRecord) Bytes() ([]byte, error)
- func (r TXTRecord) Class() Class
- func (r TXTRecord) CompressionBytes() []byte
- func (txt *TXTRecord) Content() string
- func (r TXTRecord) Data() []byte
- func (r TXTRecord) Equal(other ResourceRecord) bool
- func (txt *TXTRecord) HasAttribute(name string) bool
- func (r TXTRecord) HasNamePrefix(prefix string) bool
- func (r TXTRecord) HasNameSuffix(suffix string) bool
- func (r TXTRecord) IsName(name string) bool
- func (txt *TXTRecord) LookupAttribute(name string) (*Attribute, bool)
- func (r TXTRecord) Name() string
- func (r TXTRecord) Reader() (*Reader, error)
- func (r TXTRecord) RequestBytes() ([]byte, error)
- func (r TXTRecord) ResponseBytes() ([]byte, error)
- func (r TXTRecord) SetClass(cls Class) Record
- func (r TXTRecord) SetCompressionBytes(b []byte)
- func (r TXTRecord) SetData(b []byte) Record
- func (r TXTRecord) SetName(name string) Record
- func (r TXTRecord) SetTTL(ttl uint) Record
- func (r TXTRecord) SetType(typ Type) Record
- func (r TXTRecord) SetUnicastResponse(enabled bool) Record
- func (txt *TXTRecord) Strings() []string
- func (r TXTRecord) TTL() uint
- func (r TXTRecord) Type() Type
- func (r TXTRecord) UnicastResponse() bool
- type Type
- type Writer
- func (writer *Writer) WriteBytes(v []byte) error
- func (writer *Writer) WriteClass(v Class) error
- func (writer *Writer) WriteData(v []byte) error
- func (writer *Writer) WriteHeader(header *Header) error
- func (writer *Writer) WriteName(name string) error
- func (writer *Writer) WriteString(v string) error
- func (writer *Writer) WriteTTL(v uint) error
- func (writer *Writer) WriteType(v Type) error
- func (writer *Writer) WriteUint16(v uint16) error
- func (writer *Writer) WriteUint32(v uint32) error
- func (writer *Writer) WriteUint8(v uint8) error
Constants ¶
This section is empty.
Variables ¶
var ErrInvalid = errors.New("invalid")
var ErrNil = errors.New("nil")
var ErrNilReader = fmt.Errorf("reader is %w", ErrNil)
Functions ¶
func NewRequestRecordWithReader ¶
NewRequestRecordWithReader returns a new request resource record instance with the specified reader.
Types ¶
type AAAARecord ¶
type AAAARecord struct {
// contains filtered or unexported fields
}
AAAARecord represents a AAAA record.
func NewAAAARecord ¶
func NewAAAARecord() *AAAARecord
NewAAAARecord returns a new AAAA record instance.
func (*AAAARecord) Address ¶
func (a *AAAARecord) Address() net.IP
Address returns the resource ip address.
func (AAAARecord) Class ¶
func (r AAAARecord) Class() Class
Class returns the resource record class.
func (AAAARecord) CompressionBytes ¶
func (r AAAARecord) CompressionBytes() []byte
CompressionBytes returns the compression bytes.
func (*AAAARecord) Content ¶
func (a *AAAARecord) Content() string
Content returns a string representation to the record data.
func (AAAARecord) Equal ¶
func (r AAAARecord) Equal(other ResourceRecord) bool
Equal returns true if this record is equal to the specified resource record. otherwise false.
func (AAAARecord) HasNamePrefix ¶
HasNamePrefix returns true if the resource record name has the specified prefix.
func (AAAARecord) HasNameSuffix ¶
HasNameSuffix returns true if the resource record name has the specified suffix.
func (AAAARecord) RequestBytes ¶
RequestBytes returns only the binary representation of the request fields.
func (AAAARecord) ResponseBytes ¶
ResponseBytes returns only the binary representation of the all fields.
func (AAAARecord) SetCompressionBytes ¶
func (r AAAARecord) SetCompressionBytes(b []byte)
SetCompressionBytes sets the compression bytes.
func (AAAARecord) SetUnicastResponse ¶
SetUnicastResponse sets the specified unicast response flag.
func (AAAARecord) UnicastResponse ¶
func (r AAAARecord) UnicastResponse() bool
UnicastResponse returns the unicast response flag.
type ARecord ¶
type ARecord struct {
// contains filtered or unexported fields
}
ARecord represents a A record.
func (ARecord) CompressionBytes ¶
func (r ARecord) CompressionBytes() []byte
CompressionBytes returns the compression bytes.
func (ARecord) Equal ¶
func (r ARecord) Equal(other ResourceRecord) bool
Equal returns true if this record is equal to the specified resource record. otherwise false.
func (ARecord) HasNamePrefix ¶
HasNamePrefix returns true if the resource record name has the specified prefix.
func (ARecord) HasNameSuffix ¶
HasNameSuffix returns true if the resource record name has the specified suffix.
func (ARecord) RequestBytes ¶
RequestBytes returns only the binary representation of the request fields.
func (ARecord) ResponseBytes ¶
ResponseBytes returns only the binary representation of the all fields.
func (ARecord) SetCompressionBytes ¶
func (r ARecord) SetCompressionBytes(b []byte)
SetCompressionBytes sets the compression bytes.
func (ARecord) SetUnicastResponse ¶
SetUnicastResponse sets the specified unicast response flag.
func (ARecord) UnicastResponse ¶
func (r ARecord) UnicastResponse() bool
UnicastResponse returns the unicast response flag.
type Attribute ¶
type Attribute struct {
// contains filtered or unexported fields
}
Attribute represents a DNS attribute.
func NewAttributeFromString ¶
NewAttributeFromString returns a new attribute instance from the specified string.
type Attributes ¶
type Attributes []*Attribute
func NewAttributes ¶
func NewAttributes() Attributes
NewAttributes returns a new attributes instance.
func NewAttributesFromStrings ¶
func NewAttributesFromStrings(strs []string) (Attributes, error)
NewAttributesFromStrings returns a new attributes instance from the specified strings.
func (Attributes) HasAttribute ¶
func (attrs Attributes) HasAttribute(name string) bool
HasAttribute returns true if this instance has the specified attribute.
func (Attributes) LookupAttribute ¶
func (attrs Attributes) LookupAttribute(name string) (*Attribute, bool)
LookupAttribute returns the attribute with the specified name.
func (Attributes) String ¶
func (attrs Attributes) String() string
String returns the attribute string.
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
Header represents a protocol header.
func NewHeaderWithBytes ¶
NewHeaderWithBytes returns a header instance with the specified bytes.
func NewHeaderWithReader ¶
NewHeaderWithReader returns a header instance with the specified reader.
func NewRequestHeader ¶
func NewRequestHeader() *Header
NewRequestHeader returns a request header instance.
func NewResponseHeader ¶
func NewResponseHeader() *Header
NewResponseHeader returns a response header instance.
func (*Header) AA ¶
AA returns the authoritative answer bit. RFC 6762: 18.4. AA (Authoritative Answer) Bit In query messages, the Authoritative Answer bit MUST be zero on transmission, and MUST be ignored on reception. In response messages for Multicast domains, the Authoritative Answer bit MUST be set to one (not setting this bit would imply there's some other place where "better" information may be found) and MUST be ignored on reception.
func (*Header) AD ¶
AD returns the authentic data bit. RFC 6762: 18.9. AD (Authentic Data) Bit In both multicast query and multicast response messages, the Authentic Data bit [RFC2535] MUST be zero on transmission, and MUST be ignored on reception.
func (*Header) CD ¶
CD returns the checking disabled bit. RFC 6762: 18.10. CD (Checking Disabled) Bit In both multicast query and multicast response messages, the Checking Disabled bit [RFC2535] MUST be zero on transmission, and MUST be ignored on reception.
func (*Header) Equal ¶
Equal returns true if the header is same as the specified header, otherwise false.
func (*Header) ID ¶
ID returns the query identifier. RFC 6762: 18.1. ID (Query Identifier) In multicast query messages, the Query Identifier SHOULD be set to zero on transmission. In multicast responses, including unsolicited multicast responses, the Query Identifier MUST be set to zero on transmission, and MUST be ignored on reception.
func (*Header) IsResponse ¶
IsResponse returns true the QR bit is one, otherwise false.
func (*Header) NS ¶
NS returns the number of name server resource records in the authority records section.
func (*Header) Opcode ¶
Opcode returns the kind of query. RFC 6762: 18.3. OPCODE In both multicast query and multicast response messages, the OPCODE MUST be zero on transmission (only standard queries are currently supported over multicast).
func (*Header) QR ¶
QR returns the query type. RFC 6762: 18.2. QR (Query/Response) Bit In query messages the QR bit MUST be zero. In response messages the QR bit MUST be one.
func (*Header) RA ¶
RA returns the recursion available bit. RFC 6762: 18.7. RA (Recursion Available) Bit In both multicast query and multicast response messages, the Recursion Available bit MUST be zero on transmission, and MUST be ignored on reception.
func (*Header) RD ¶
RD returns the recursion desired bit. RFC 6762: 18.6. RD (Recursion Desired) Bit In both multicast query and multicast response messages, the Recursion Desired bit SHOULD be zero on transmission, and MUST be ignored on reception.
func (*Header) ResponseCode ¶
func (header *Header) ResponseCode() ResponseCode
ResponseCode returns the checking disabled bit. RFC 6762: 18.11. RCODE (Response Code) In both multicast query and multicast response messages, the Response Code MUST be zero on transmission. Multicast DNS messages received with non-zero Response Codes MUST be silently ignored.
func (*Header) TC ¶
TC returns the truncated bit. RFC 6762: 18.5. TC (Truncated) Bit In query messages, if the TC bit is set, it means that additional Known-Answer records may be following shortly. A responder SHOULD record this fact, and wait for those additional Known-Answer records, before deciding whether to respond. If the TC bit is clear, it means that the querying host has no additional Known Answers. In multicast response messages, the TC bit MUST be zero on transmission, and MUST be ignored on reception.
type Message ¶
type Message struct { *Header Questions Answers NameServers Additions }
Message represents a protocol message.
func NewMessageWithBytes ¶
NewMessageWithBytes returns a message instance with the specified bytes.
func NewRequestMessage ¶
func NewRequestMessage() *Message
NewRequestMessage returns a request message instance.
func NewResponseMessage ¶
func NewResponseMessage() *Message
NewResponseMessage returns a response message instance.
func (*Message) AddAddition ¶
AddAddition adds the specified additional record into the message.
func (*Message) AddNameServer ¶
func (msg *Message) AddNameServer(ns NameServer)
AddNameServer adds the specified name server into the message.
func (*Message) AddQuestion ¶
AddQuestion adds the specified question into the message.
func (*Message) Equal ¶
Equal returns true if the message is same as the specified message, otherwise false.
func (*Message) HasResourceRecord ¶
HasResourceRecord returns true if the resource record of the specified name is included in the message. otherwise false.
func (*Message) LookupResourceRecordForName ¶
func (msg *Message) LookupResourceRecordForName(name string) (ResourceRecord, bool)
LookupResourceRecordForName returns the resource record of the specified name.
func (*Message) LookupResourceRecordForNamePrefix ¶
func (msg *Message) LookupResourceRecordForNamePrefix(prefix string) (ResourceRecord, bool)
LookupResourceRecordForNamePrefix returns the resource record of the specified name prefix.
func (*Message) LookupResourceRecordForNameSuffix ¶
func (msg *Message) LookupResourceRecordForNameSuffix(prefix string) (ResourceRecord, bool)
LookupResourceRecordForNameSuffix returns the resource record of the specified name suffix.
func (*Message) ResourceRecords ¶
func (msg *Message) ResourceRecords() ResourceRecords
ResourceRecords returns all resource records.
type MessageHandler ¶
MessageHandler represents a protocol message handler interface.
type NSECRecord ¶
type NSECRecord struct {
// contains filtered or unexported fields
}
NSECRecord represents a NSEC record. RFC 4034: Resource Records for the DNS Security Extensions. https://www.rfc-editor.org/rfc/rfc4034
func NewNSECRecord ¶
func NewNSECRecord() *NSECRecord
NewNSECRecord returns a new NSEC record instance.
func (NSECRecord) Class ¶
func (r NSECRecord) Class() Class
Class returns the resource record class.
func (NSECRecord) CompressionBytes ¶
func (r NSECRecord) CompressionBytes() []byte
CompressionBytes returns the compression bytes.
func (*NSECRecord) Content ¶
func (nsec *NSECRecord) Content() string
Content returns a string representation to the record data.
func (NSECRecord) Equal ¶
func (r NSECRecord) Equal(other ResourceRecord) bool
Equal returns true if this record is equal to the specified resource record. otherwise false.
func (NSECRecord) HasNamePrefix ¶
HasNamePrefix returns true if the resource record name has the specified prefix.
func (NSECRecord) HasNameSuffix ¶
HasNameSuffix returns true if the resource record name has the specified suffix.
func (NSECRecord) RequestBytes ¶
RequestBytes returns only the binary representation of the request fields.
func (NSECRecord) ResponseBytes ¶
ResponseBytes returns only the binary representation of the all fields.
func (NSECRecord) SetCompressionBytes ¶
func (r NSECRecord) SetCompressionBytes(b []byte)
SetCompressionBytes sets the compression bytes.
func (NSECRecord) SetUnicastResponse ¶
SetUnicastResponse sets the specified unicast response flag.
func (NSECRecord) UnicastResponse ¶
func (r NSECRecord) UnicastResponse() bool
UnicastResponse returns the unicast response flag.
type NameServer ¶
type NameServer = ResourceRecord
NameServer represents an authoritative nameserver resource record.
type NameServers ¶
type NameServers = Records
NameServers represents an authoritative nameserver resource record array.
type PTRRecord ¶
type PTRRecord struct {
// contains filtered or unexported fields
}
PTRRecord represents a PTR record.
func (PTRRecord) CompressionBytes ¶
func (r PTRRecord) CompressionBytes() []byte
CompressionBytes returns the compression bytes.
func (*PTRRecord) DomainName ¶
DomainName returns the resource domain name.
func (PTRRecord) Equal ¶
func (r PTRRecord) Equal(other ResourceRecord) bool
Equal returns true if this record is equal to the specified resource record. otherwise false.
func (PTRRecord) HasNamePrefix ¶
HasNamePrefix returns true if the resource record name has the specified prefix.
func (PTRRecord) HasNameSuffix ¶
HasNameSuffix returns true if the resource record name has the specified suffix.
func (PTRRecord) RequestBytes ¶
RequestBytes returns only the binary representation of the request fields.
func (PTRRecord) ResponseBytes ¶
ResponseBytes returns only the binary representation of the all fields.
func (PTRRecord) SetCompressionBytes ¶
func (r PTRRecord) SetCompressionBytes(b []byte)
SetCompressionBytes sets the compression bytes.
func (PTRRecord) SetUnicastResponse ¶
SetUnicastResponse sets the specified unicast response flag.
func (PTRRecord) UnicastResponse ¶
func (r PTRRecord) UnicastResponse() bool
UnicastResponse returns the unicast response flag.
type Question ¶
type Question struct {
// contains filtered or unexported fields
}
Question represents a question.
func NewQuestionWithReader ¶
NewQuestionWithRecord returns a new question instance with the specified record.
func NewQuestionWithRecord ¶
func NewQuestionWithRecord(record *record) *Question
NewQuestionWithRecord returns a new question instance with the specified record.
func (Question) CompressionBytes ¶
func (r Question) CompressionBytes() []byte
CompressionBytes returns the compression bytes.
func (Question) Content ¶
func (r Question) Content() string
Content returns a string representation to the record data.
func (Question) Equal ¶
func (r Question) Equal(other ResourceRecord) bool
Equal returns true if this record is equal to the specified resource record. otherwise false.
func (Question) HasNamePrefix ¶
HasNamePrefix returns true if the resource record name has the specified prefix.
func (Question) HasNameSuffix ¶
HasNameSuffix returns true if the resource record name has the specified suffix.
func (Question) RequestBytes ¶
RequestBytes returns only the binary representation of the request fields.
func (Question) ResponseBytes ¶
ResponseBytes returns only the binary representation of the all fields.
func (Question) SetCompressionBytes ¶
func (r Question) SetCompressionBytes(b []byte)
SetCompressionBytes sets the compression bytes.
func (Question) SetUnicastResponse ¶
SetUnicastResponse sets the specified unicast response flag.
func (Question) UnicastResponse ¶
func (r Question) UnicastResponse() bool
UnicastResponse returns the unicast response flag.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader represents a record reader.
func NewReaderWithBytes ¶
NewReaderWithBytes returns a new reader instance with the specified bytes.
func (*Reader) CompressionBytes ¶
CompressionBytes returns the compression bytes.
func (*Reader) ReadString ¶
ReadString returns a string from the reader.
func (*Reader) ReadStrings ¶
ReadStrings returns strings from the reader.
func (*Reader) ReadUint16 ¶
ReadUint16 returns a uint16 from the reader.
func (*Reader) ReadUint32 ¶
ReadUint32 returns a uint32 from the reader.
func (*Reader) SetCompressionBytes ¶
SetCompressionBytes sets the compression bytes.
type Record ¶
type Record interface { // SetName sets the resource record name. SetName(name string) Record // Name returns the resource record name. Name() string // IsName returns true if the resource record name is the specified name, ignoring case. IsName(name string) bool // HasNamePrefix returns true if the resource record name has the specified prefix. HasNamePrefix(prefix string) bool // HasNameSuffix returns true if the resource record name has the specified suffix. HasNameSuffix(prefix string) bool // SetType sets the resource record type. SetType(t Type) Record // Type returns the resource record type. Type() Type // SetClass sets the resource record class. SetClass(c Class) Record // Class returns the resource record class. Class() Class // SetTTL sets the TTL second. SetTTL(ttl uint) Record // TTL returns the TTL second. TTL() uint // SetUnicastResponse sets the unicast response flag. SetUnicastResponse(flag bool) Record // UnicastResponse returns the unicast response flag. UnicastResponse() bool // SetData sets the record data. SetData(data []byte) Record // Data returns the record data. Data() []byte // Content returns a string representation to the record data. Content() string // SetCompressionBytes sets the compression bytes. SetCompressionBytes(b []byte) // CompressionBytes returns the compression bytes. CompressionBytes() []byte // RequestBytes returns only the binary representation of the request fields. RequestBytes() ([]byte, error) // ResponseBytes returns only the binary representation of the all fields. ResponseBytes() ([]byte, error) // Bytes returns the binary representation of the record. Bytes() ([]byte, error) }
Record represents a record interface.
type Records ¶
type Records []Record
Records is a list of Record.
func (Records) HasRecord ¶
HasRecord returns true if the resource record of the specified name is included in the list. otherwise false.
func (Records) LookupAAAARecords ¶
func (records Records) LookupAAAARecords() []*AAAARecord
LookupAAAARecords returns the AAAA records.
func (Records) LookupARecords ¶
LookupARecords returns the A records.
func (Records) LookupPTRRecords ¶
LookupPTRRecords returns the PTR records.
func (Records) LookupRecordForName ¶
LookupRecordForName returns the resource record of the specified name.
func (Records) LookupRecordForNamePrefix ¶
LookupRecordForNamePrefix returns the resource record of the specified name prefix.
func (Records) LookupRecordForNameSuffix ¶
LookupRecordForNameSuffix returns the resource record of the specified name suffix.
func (Records) LookupRecordForType ¶
LookupRecordForType returns the resource record of the specified type.
func (Records) LookupRecordsForName ¶
LookupRecordsForName returns the resource records of the specified name.
func (Records) LookupRecordsForNamePrefix ¶
LookupRecordsForNamePrefix returns the resource records of the specified name prefix.
func (Records) LookupRecordsForNameSuffix ¶
LookupRecordsForNameSuffix returns the resource records of the specified name suffix.
func (Records) LookupRecordsForType ¶
LookupRecordForType returns the resource records of the specified type.
func (Records) LookupSRVRecords ¶
LookupSRVRecords returns the SRV records.
func (Records) LookupTXTRecords ¶
LookupTXTRecords returns the TXT records.
type ResourceRecord ¶
type ResourceRecord = Record
ResourceRecord represents a resource record interface.
func NewResourceRecordWithReader ¶
func NewResourceRecordWithReader(reader *Reader) (ResourceRecord, error)
NewResourceRecordWithReader returns a new resource record instance with the specified reader.
type ResponseCode ¶
type ResponseCode byte
const ( NoError ResponseCode = 0 FormatError ResponseCode = 1 ServerFailure ResponseCode = 2 NameError ResponseCode = 3 NotImplemented ResponseCode = 4 Refused ResponseCode = 5 )
type SRVRecord ¶
type SRVRecord struct {
// contains filtered or unexported fields
}
SRVRecord represents a SRV record. RFC 2782: A DNS RR for specifying the location of services (DNS SRV). https://www.rfc-editor.org/rfc/rfc2782
func (SRVRecord) CompressionBytes ¶
func (r SRVRecord) CompressionBytes() []byte
CompressionBytes returns the compression bytes.
func (SRVRecord) Equal ¶
func (r SRVRecord) Equal(other ResourceRecord) bool
Equal returns true if this record is equal to the specified resource record. otherwise false.
func (SRVRecord) HasNamePrefix ¶
HasNamePrefix returns true if the resource record name has the specified prefix.
func (SRVRecord) HasNameSuffix ¶
HasNameSuffix returns true if the resource record name has the specified suffix.
func (SRVRecord) RequestBytes ¶
RequestBytes returns only the binary representation of the request fields.
func (SRVRecord) ResponseBytes ¶
ResponseBytes returns only the binary representation of the all fields.
func (SRVRecord) SetCompressionBytes ¶
func (r SRVRecord) SetCompressionBytes(b []byte)
SetCompressionBytes sets the compression bytes.
func (SRVRecord) SetUnicastResponse ¶
SetUnicastResponse sets the specified unicast response flag.
func (SRVRecord) UnicastResponse ¶
func (r SRVRecord) UnicastResponse() bool
UnicastResponse returns the unicast response flag.
type TXTRecord ¶
type TXTRecord struct {
// contains filtered or unexported fields
}
TXTRecord represents a TXT record.
func (*TXTRecord) Attributes ¶
func (txt *TXTRecord) Attributes() (Attributes, error)
Attributes returns the resource attribute strings.
func (TXTRecord) CompressionBytes ¶
func (r TXTRecord) CompressionBytes() []byte
CompressionBytes returns the compression bytes.
func (TXTRecord) Equal ¶
func (r TXTRecord) Equal(other ResourceRecord) bool
Equal returns true if this record is equal to the specified resource record. otherwise false.
func (*TXTRecord) HasAttribute ¶
HasAttribute returns true if this instance has the specified attribute.
func (TXTRecord) HasNamePrefix ¶
HasNamePrefix returns true if the resource record name has the specified prefix.
func (TXTRecord) HasNameSuffix ¶
HasNameSuffix returns true if the resource record name has the specified suffix.
func (*TXTRecord) LookupAttribute ¶
LookupAttribute returns the attribute with the specified name.
func (TXTRecord) RequestBytes ¶
RequestBytes returns only the binary representation of the request fields.
func (TXTRecord) ResponseBytes ¶
ResponseBytes returns only the binary representation of the all fields.
func (TXTRecord) SetCompressionBytes ¶
func (r TXTRecord) SetCompressionBytes(b []byte)
SetCompressionBytes sets the compression bytes.
func (TXTRecord) SetUnicastResponse ¶
SetUnicastResponse sets the specified unicast response flag.
func (TXTRecord) UnicastResponse ¶
func (r TXTRecord) UnicastResponse() bool
UnicastResponse returns the unicast response flag.
type Writer ¶
Writer represents a record writer.
func (*Writer) WriteBytes ¶
WriteBytes writes bytes.
func (*Writer) WriteClass ¶
WriteClass writes a class.
func (*Writer) WriteHeader ¶
WriteHeader writes a header.
func (*Writer) WriteString ¶
WriteString writes a string with a length.
func (*Writer) WriteUint16 ¶
WriteUint16 writes a uint16 value.
func (*Writer) WriteUint32 ¶
WriteUint32 writes a uint32 value.
func (*Writer) WriteUint8 ¶
WriteByte writes a byte value.
Source Files ¶
- a_record.go
- aaaa_record.go
- addition.go
- answer.go
- attribute.go
- attributes.go
- class.go
- errors.go
- handler.go
- header.go
- message.go
- name.go
- name_server.go
- nsec_record.go
- ptr_record.go
- question.go
- reader.go
- record.go
- record_impl.go
- records.go
- resource_record.go
- resource_records.go
- srv_record.go
- txt.go
- txt_record.go
- type.go
- writer.go