MCPcopy
hub / github.com/google/gopacket / decode

Method decode

layers/dns.go:636–647  ·  view source on GitHub ↗
(data []byte, offset int, df gopacket.DecodeFeedback, buffer *[]byte)

Source from the content-addressed store, hash-verified

634}
635
636func (q *DNSQuestion) decode(data []byte, offset int, df gopacket.DecodeFeedback, buffer *[]byte) (int, error) {
637 name, endq, err := decodeName(data, offset, buffer, 1)
638 if err != nil {
639 return 0, err
640 }
641
642 q.Name = name
643 q.Type = DNSType(binary.BigEndian.Uint16(data[endq : endq+2]))
644 q.Class = DNSClass(binary.BigEndian.Uint16(data[endq+2 : endq+4]))
645
646 return endq + 4, nil
647}
648
649func (q *DNSQuestion) encode(data []byte, offset int) int {
650 noff := encodeName(q.Name, data, offset)

Callers 2

DecodeFromBytesMethod · 0.95
TestDHCPv4DecodeOptionFunction · 0.45

Calls 3

decodeNameFunction · 0.85
DNSTypeTypeAlias · 0.85
DNSClassTypeAlias · 0.85

Tested by 1

TestDHCPv4DecodeOptionFunction · 0.36