Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assemble ¶
func Assemble(p ParsedPacket, max int) ([]byte, error)
Assemble returns a possibly truncated payload for a ParsedPacket. Setting max to a negative value disables truncation.
func EncodeName ¶
EncodeName encodes a namelabel into the DNS on-wire format: <strlen1><rawstr1><strlen2><rawstr2>
func ParseSoaTtl ¶
Types ¶
type EdnsAttribute ¶
type EdnsRecord ¶
type EdnsRecord struct { // Whether or not EDNS data is present. Present bool Version uint8 UdpPayloadSize uint16 FlagDnssecOk bool Attributes []EdnsAttribute // contains filtered or unexported fields }
type Namelabel ¶
type Namelabel struct {
// contains filtered or unexported fields
}
String array typed to describe DNS labels
func NewNamelabel ¶
func NewNamelabelString ¶
NewNamelabelString returns a new absolute namelabel from given string.
func (Namelabel) Equals ¶
Equals returns true if two namelabels are equal. This function is case sensitive, call ToLower() on both if you do not care about case sensitivity.
func (Namelabel) PoppedLabel ¶
Pops a label from the label list, walking the hierarchy
type ParsedPacket ¶
type ParsedPacket struct { Header ParsedPacketHeader Questions []QuestionFormat Answers []ResourceRecordFormat Nameservers []ResourceRecordFormat Additionals []ResourceRecordFormat Edns EdnsRecord }
A fully parsed DNS packet
func Parse ¶
func Parse(buf []byte) (*ParsedPacket, error)
type ParsedPacketHeader ¶
type ParsedPacketHeader struct { Id uint16 // Id of this query Response bool // `true' if this is a response (qr) Opcode uint8 // The RFC1035 opcode of this query (usually OP_QUERY) Authoritative bool // `true' if we have authorative data in the reply Truncated bool // `true' if the query was truncated and might be re-done using TCP or EDNS RecDesired bool // `true' if the client asked us to resolve recursively RecAvailable bool // indicates if the host generating this reply is willing to do recursive queries ResponseCode uint16 // RFC1035 or EDNS response code, such as NXDOMAIN QuestionCount uint16 // Number of questions in this packet AnswerCount uint16 // Number of items in the answer section NameserverCount uint16 // Number of items in the NS section AdditionalCount uint16 // Number of items in the additional section }
The parsed representation of a DNS header
type QuestionFormat ¶
Question section of the DNS packet
Source Files ¶
Click to show internal directories.
Click to hide internal directories.