Reduce compression memory use with map[string]uint16 (#852)
* Reduce compression memory use with map[string]uint16 map[string]uint16 uses 25% less memory per-entry than a map[string]int (16+2)/(16+8) = 0.75. All entries in the compression map are bound by maxCompressionOffset which is 14-bits and fits within a uint16. * Add PackMsg benchmark with more RRs * Add a comment to the compressionMap struct
This commit is contained in:
parent
5c9c0e7818
commit
470f08e191
@ -166,7 +166,7 @@ func (dns *Msg) IsEdns0() *OPT {
|
||||
// label fits in 63 characters, but there is no length check for the entire
|
||||
// string s. I.e. a domain name longer than 255 characters is considered valid.
|
||||
func IsDomainName(s string) (labels int, ok bool) {
|
||||
_, labels, err := packDomainName(s, nil, 0, nil, false)
|
||||
_, labels, err := packDomainName(s, nil, 0, compressionMap{}, false)
|
||||
return labels, err == nil
|
||||
}
|
||||
|
||||
|
2
dns.go
2
dns.go
@ -42,7 +42,7 @@ type RR interface {
|
||||
len(off int, compression map[string]struct{}) int
|
||||
|
||||
// pack packs an RR into wire format.
|
||||
pack([]byte, int, map[string]int, bool) (int, error)
|
||||
pack([]byte, int, compressionMap, bool) (int, error)
|
||||
}
|
||||
|
||||
// RR_Header is the header all DNS resource records share.
|
||||
|
@ -277,6 +277,33 @@ func BenchmarkPackMsg(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkPackMsgMassive(b *testing.B) {
|
||||
makeMsg := func(question string, ans, ns, e []RR) *Msg {
|
||||
msg := new(Msg)
|
||||
msg.SetQuestion(Fqdn(question), TypeANY)
|
||||
msg.Answer = append(msg.Answer, ans...)
|
||||
msg.Ns = append(msg.Ns, ns...)
|
||||
msg.Extra = append(msg.Extra, e...)
|
||||
msg.Compress = true
|
||||
return msg
|
||||
}
|
||||
const name1 = "12345678901234567890123456789012345.12345678.123."
|
||||
rrMx := testRR(name1 + " 3600 IN MX 10 " + name1)
|
||||
answer := []RR{rrMx, rrMx}
|
||||
for i := 0; i < 128; i++ {
|
||||
rrA := testRR(fmt.Sprintf("example%03d.something%03delse.org. 2311 IN A 127.0.0.1", i/32, i%32))
|
||||
answer = append(answer, rrA)
|
||||
}
|
||||
answer = append(answer, rrMx, rrMx)
|
||||
msg := makeMsg(name1, answer, nil, nil)
|
||||
buf := make([]byte, 512)
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, _ = msg.PackBuffer(buf)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkPackMsgOnlyQuestion(b *testing.B) {
|
||||
msg := new(Msg)
|
||||
msg.SetQuestion(Fqdn("12345678901234567890123456789012345.12345678.123."), TypeANY)
|
||||
|
@ -326,7 +326,7 @@ func TestCompareCompressionMapsForANY(t *testing.T) {
|
||||
lenFake := msgLenWithCompressionMap(msg, compressionFake)
|
||||
|
||||
compressionReal := make(map[string]int)
|
||||
buf, err := msg.packBufferWithCompressionMap(nil, compressionReal, true)
|
||||
buf, err := msg.packBufferWithCompressionMap(nil, compressionMap{ext: compressionReal}, true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -359,7 +359,7 @@ func TestCompareCompressionMapsForSRV(t *testing.T) {
|
||||
lenFake := msgLenWithCompressionMap(msg, compressionFake)
|
||||
|
||||
compressionReal := make(map[string]int)
|
||||
buf, err := msg.packBufferWithCompressionMap(nil, compressionReal, true)
|
||||
buf, err := msg.packBufferWithCompressionMap(nil, compressionMap{ext: compressionReal}, true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
67
msg.go
67
msg.go
@ -190,6 +190,39 @@ var RcodeToString = map[int]string{
|
||||
RcodeBadCookie: "BADCOOKIE",
|
||||
}
|
||||
|
||||
// compressionMap is used to allow a more efficient compression map
|
||||
// to be used for internal packDomainName calls without changing the
|
||||
// signature or functionality of public API.
|
||||
//
|
||||
// In particular, map[string]uint16 uses 25% less per-entry memory
|
||||
// than does map[string]int.
|
||||
type compressionMap struct {
|
||||
ext map[string]int // external callers
|
||||
int map[string]uint16 // internal callers
|
||||
}
|
||||
|
||||
func (m compressionMap) valid() bool {
|
||||
return m.int != nil || m.ext != nil
|
||||
}
|
||||
|
||||
func (m compressionMap) insert(s string, pos int) {
|
||||
if m.ext != nil {
|
||||
m.ext[s] = pos
|
||||
} else {
|
||||
m.int[s] = uint16(pos)
|
||||
}
|
||||
}
|
||||
|
||||
func (m compressionMap) find(s string) (int, bool) {
|
||||
if m.ext != nil {
|
||||
pos, ok := m.ext[s]
|
||||
return pos, ok
|
||||
}
|
||||
|
||||
pos, ok := m.int[s]
|
||||
return int(pos), ok
|
||||
}
|
||||
|
||||
// Domain names are a sequence of counted strings
|
||||
// split at the dots. They end with a zero-length string.
|
||||
|
||||
@ -198,11 +231,11 @@ var RcodeToString = map[int]string{
|
||||
// map needs to hold a mapping between domain names and offsets
|
||||
// pointing into msg.
|
||||
func PackDomainName(s string, msg []byte, off int, compression map[string]int, compress bool) (off1 int, err error) {
|
||||
off1, _, err = packDomainName(s, msg, off, compression, compress)
|
||||
off1, _, err = packDomainName(s, msg, off, compressionMap{ext: compression}, compress)
|
||||
return
|
||||
}
|
||||
|
||||
func packDomainName(s string, msg []byte, off int, compression map[string]int, compress bool) (off1 int, labels int, err error) {
|
||||
func packDomainName(s string, msg []byte, off int, compression compressionMap, compress bool) (off1 int, labels int, err error) {
|
||||
// special case if msg == nil
|
||||
lenmsg := 256
|
||||
if msg != nil {
|
||||
@ -292,8 +325,8 @@ loop:
|
||||
// Don't try to compress '.'
|
||||
// We should only compress when compress is true, but we should also still pick
|
||||
// up names that can be used for *future* compression(s).
|
||||
if compression != nil && !isRootLabel(s, bs, begin, ls) {
|
||||
if p, ok := compression[s[compBegin:]]; ok {
|
||||
if compression.valid() && !isRootLabel(s, bs, begin, ls) {
|
||||
if p, ok := compression.find(s[compBegin:]); ok {
|
||||
// The first hit is the longest matching dname
|
||||
// keep the pointer offset we get back and store
|
||||
// the offset of the current name, because that's
|
||||
@ -306,7 +339,7 @@ loop:
|
||||
}
|
||||
} else if off < maxCompressionOffset {
|
||||
// Only offsets smaller than maxCompressionOffset can be used.
|
||||
compression[s[compBegin:]] = off
|
||||
compression.insert(s[compBegin:], off)
|
||||
}
|
||||
}
|
||||
|
||||
@ -586,6 +619,10 @@ func intToBytes(i *big.Int, length int) []byte {
|
||||
// PackRR packs a resource record rr into msg[off:].
|
||||
// See PackDomainName for documentation about the compression.
|
||||
func PackRR(rr RR, msg []byte, off int, compression map[string]int, compress bool) (off1 int, err error) {
|
||||
return packRR(rr, msg, off, compressionMap{ext: compression}, compress)
|
||||
}
|
||||
|
||||
func packRR(rr RR, msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) {
|
||||
if rr == nil {
|
||||
return len(msg), &Error{err: "nil rr"}
|
||||
}
|
||||
@ -708,15 +745,15 @@ func (dns *Msg) PackBuffer(buf []byte) (msg []byte, err error) {
|
||||
// If this message can't be compressed, avoid filling the
|
||||
// compression map and creating garbage.
|
||||
if dns.Compress && dns.isCompressible() {
|
||||
compression := make(map[string]int) // Compression pointer mappings.
|
||||
return dns.packBufferWithCompressionMap(buf, compression, true)
|
||||
compression := make(map[string]uint16) // Compression pointer mappings.
|
||||
return dns.packBufferWithCompressionMap(buf, compressionMap{int: compression}, true)
|
||||
}
|
||||
|
||||
return dns.packBufferWithCompressionMap(buf, nil, false)
|
||||
return dns.packBufferWithCompressionMap(buf, compressionMap{}, false)
|
||||
}
|
||||
|
||||
// packBufferWithCompressionMap packs a Msg, using the given buffer buf.
|
||||
func (dns *Msg) packBufferWithCompressionMap(buf []byte, compression map[string]int, compress bool) (msg []byte, err error) {
|
||||
func (dns *Msg) packBufferWithCompressionMap(buf []byte, compression compressionMap, compress bool) (msg []byte, err error) {
|
||||
if dns.Rcode < 0 || dns.Rcode > 0xFFF {
|
||||
return nil, ErrRcode
|
||||
}
|
||||
@ -784,19 +821,19 @@ func (dns *Msg) packBufferWithCompressionMap(buf []byte, compression map[string]
|
||||
}
|
||||
}
|
||||
for _, r := range dns.Answer {
|
||||
off, err = PackRR(r, msg, off, compression, compress)
|
||||
off, err = packRR(r, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
for _, r := range dns.Ns {
|
||||
off, err = PackRR(r, msg, off, compression, compress)
|
||||
off, err = packRR(r, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
for _, r := range dns.Extra {
|
||||
off, err = PackRR(r, msg, off, compression, compress)
|
||||
off, err = packRR(r, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -1072,8 +1109,8 @@ func (dns *Msg) CopyTo(r1 *Msg) *Msg {
|
||||
return r1
|
||||
}
|
||||
|
||||
func (q *Question) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
off, err := PackDomainName(q.Name, msg, off, compression, compress)
|
||||
func (q *Question) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, _, err := packDomainName(q.Name, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -1114,7 +1151,7 @@ func unpackQuestion(msg []byte, off int) (Question, int, error) {
|
||||
return q, off, err
|
||||
}
|
||||
|
||||
func (dh *Header) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (dh *Header) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := packUint16(dh.Id, msg, off)
|
||||
if err != nil {
|
||||
return off, err
|
||||
|
@ -80,7 +80,7 @@ func main() {
|
||||
o := scope.Lookup(name)
|
||||
st, _ := getTypeStruct(o.Type(), scope)
|
||||
|
||||
fmt.Fprintf(b, "func (rr *%s) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {\n", name)
|
||||
fmt.Fprintf(b, "func (rr *%s) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {\n", name)
|
||||
fmt.Fprint(b, `off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -116,9 +116,9 @@ return off, err
|
||||
switch {
|
||||
case st.Tag(i) == `dns:"-"`: // ignored
|
||||
case st.Tag(i) == `dns:"cdomain-name"`:
|
||||
o("off, err = PackDomainName(rr.%s, msg, off, compression, compress)\n")
|
||||
o("off, _, err = packDomainName(rr.%s, msg, off, compression, compress)\n")
|
||||
case st.Tag(i) == `dns:"domain-name"`:
|
||||
o("off, err = PackDomainName(rr.%s, msg, off, compression, false)\n")
|
||||
o("off, _, err = packDomainName(rr.%s, msg, off, compression, false)\n")
|
||||
case st.Tag(i) == `dns:"a"`:
|
||||
o("off, err = packDataA(rr.%s, msg, off)\n")
|
||||
case st.Tag(i) == `dns:"aaaa"`:
|
||||
|
@ -101,12 +101,12 @@ func unpackHeader(msg []byte, off int) (rr RR_Header, off1 int, truncmsg []byte,
|
||||
|
||||
// pack packs an RR header, returning the offset to the end of the header.
|
||||
// See PackDomainName for documentation about the compression.
|
||||
func (hdr RR_Header) pack(msg []byte, off int, compression map[string]int, compress bool) (off1 int, err error) {
|
||||
func (hdr RR_Header) pack(msg []byte, off int, compression compressionMap, compress bool) (off1 int, err error) {
|
||||
if off == len(msg) {
|
||||
return off, nil
|
||||
}
|
||||
|
||||
off, err = PackDomainName(hdr.Name, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(hdr.Name, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return len(msg), err
|
||||
}
|
||||
@ -621,10 +621,10 @@ func unpackDataDomainNames(msg []byte, off, end int) ([]string, int, error) {
|
||||
return servers, off, nil
|
||||
}
|
||||
|
||||
func packDataDomainNames(names []string, msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func packDataDomainNames(names []string, msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
var err error
|
||||
for j := 0; j < len(names); j++ {
|
||||
off, err = PackDomainName(names[j], msg, off, compression, compress)
|
||||
off, _, err = packDomainName(names[j], msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return len(msg), err
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ func (r *PrivateRR) copy() RR {
|
||||
}
|
||||
return rr
|
||||
}
|
||||
func (r *PrivateRR) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (r *PrivateRR) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := r.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
|
204
zmsg.go
204
zmsg.go
@ -4,7 +4,7 @@ package dns
|
||||
|
||||
// pack*() functions
|
||||
|
||||
func (rr *A) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *A) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -18,7 +18,7 @@ func (rr *A) pack(msg []byte, off int, compression map[string]int, compress bool
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *AAAA) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *AAAA) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -32,7 +32,7 @@ func (rr *AAAA) pack(msg []byte, off int, compression map[string]int, compress b
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *AFSDB) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *AFSDB) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -42,7 +42,7 @@ func (rr *AFSDB) pack(msg []byte, off int, compression map[string]int, compress
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Hostname, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Hostname, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -50,7 +50,7 @@ func (rr *AFSDB) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *ANY) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *ANY) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -60,7 +60,7 @@ func (rr *ANY) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *AVC) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *AVC) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -74,7 +74,7 @@ func (rr *AVC) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *CAA) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *CAA) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -96,7 +96,7 @@ func (rr *CAA) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *CDNSKEY) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *CDNSKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -122,7 +122,7 @@ func (rr *CDNSKEY) pack(msg []byte, off int, compression map[string]int, compres
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *CDS) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *CDS) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -148,7 +148,7 @@ func (rr *CDS) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *CERT) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *CERT) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -174,13 +174,13 @@ func (rr *CERT) pack(msg []byte, off int, compression map[string]int, compress b
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *CNAME) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *CNAME) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Target, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Target, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -188,7 +188,7 @@ func (rr *CNAME) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *CSYNC) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *CSYNC) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -210,7 +210,7 @@ func (rr *CSYNC) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *DHCID) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *DHCID) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -224,7 +224,7 @@ func (rr *DHCID) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *DLV) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *DLV) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -250,13 +250,13 @@ func (rr *DLV) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *DNAME) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *DNAME) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Target, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Target, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -264,7 +264,7 @@ func (rr *DNAME) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *DNSKEY) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *DNSKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -290,7 +290,7 @@ func (rr *DNSKEY) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *DS) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *DS) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -316,7 +316,7 @@ func (rr *DS) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *EID) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *EID) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -330,7 +330,7 @@ func (rr *EID) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *EUI48) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *EUI48) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -344,7 +344,7 @@ func (rr *EUI48) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *EUI64) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *EUI64) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -358,7 +358,7 @@ func (rr *EUI64) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *GID) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *GID) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -372,7 +372,7 @@ func (rr *GID) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *GPOS) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *GPOS) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -394,7 +394,7 @@ func (rr *GPOS) pack(msg []byte, off int, compression map[string]int, compress b
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *HINFO) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *HINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -412,7 +412,7 @@ func (rr *HINFO) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *HIP) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *HIP) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -446,7 +446,7 @@ func (rr *HIP) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *KEY) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *KEY) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -472,7 +472,7 @@ func (rr *KEY) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *KX) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *KX) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -482,7 +482,7 @@ func (rr *KX) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Exchanger, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Exchanger, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -490,7 +490,7 @@ func (rr *KX) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *L32) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *L32) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -508,7 +508,7 @@ func (rr *L32) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *L64) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *L64) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -526,7 +526,7 @@ func (rr *L64) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *LOC) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *LOC) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -564,7 +564,7 @@ func (rr *LOC) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *LP) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *LP) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -574,7 +574,7 @@ func (rr *LP) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Fqdn, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Fqdn, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -582,13 +582,13 @@ func (rr *LP) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *MB) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *MB) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Mb, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Mb, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -596,13 +596,13 @@ func (rr *MB) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *MD) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *MD) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Md, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Md, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -610,13 +610,13 @@ func (rr *MD) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *MF) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *MF) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Mf, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Mf, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -624,13 +624,13 @@ func (rr *MF) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *MG) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *MG) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Mg, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Mg, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -638,17 +638,17 @@ func (rr *MG) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *MINFO) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *MINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Rmail, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Rmail, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Email, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Email, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -656,13 +656,13 @@ func (rr *MINFO) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *MR) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *MR) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Mr, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Mr, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -670,7 +670,7 @@ func (rr *MR) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *MX) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *MX) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -680,7 +680,7 @@ func (rr *MX) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Mx, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Mx, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -688,7 +688,7 @@ func (rr *MX) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NAPTR) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *NAPTR) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -714,7 +714,7 @@ func (rr *NAPTR) pack(msg []byte, off int, compression map[string]int, compress
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Replacement, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Replacement, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -722,7 +722,7 @@ func (rr *NAPTR) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NID) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *NID) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -740,7 +740,7 @@ func (rr *NID) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NIMLOC) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *NIMLOC) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -754,7 +754,7 @@ func (rr *NIMLOC) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NINFO) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *NINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -768,13 +768,13 @@ func (rr *NINFO) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NS) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *NS) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Ns, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Ns, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -782,13 +782,13 @@ func (rr *NS) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NSAPPTR) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *NSAPPTR) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Ptr, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Ptr, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -796,13 +796,13 @@ func (rr *NSAPPTR) pack(msg []byte, off int, compression map[string]int, compres
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NSEC) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *NSEC) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.NextDomain, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.NextDomain, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -814,7 +814,7 @@ func (rr *NSEC) pack(msg []byte, off int, compression map[string]int, compress b
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NSEC3) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *NSEC3) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -859,7 +859,7 @@ func (rr *NSEC3) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *NSEC3PARAM) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *NSEC3PARAM) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -892,7 +892,7 @@ func (rr *NSEC3PARAM) pack(msg []byte, off int, compression map[string]int, comp
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *OPENPGPKEY) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *OPENPGPKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -906,7 +906,7 @@ func (rr *OPENPGPKEY) pack(msg []byte, off int, compression map[string]int, comp
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *OPT) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *OPT) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -920,13 +920,13 @@ func (rr *OPT) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *PTR) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *PTR) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Ptr, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Ptr, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -934,7 +934,7 @@ func (rr *PTR) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *PX) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *PX) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -944,11 +944,11 @@ func (rr *PX) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Map822, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Map822, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Mapx400, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Mapx400, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -956,7 +956,7 @@ func (rr *PX) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *RFC3597) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *RFC3597) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -970,7 +970,7 @@ func (rr *RFC3597) pack(msg []byte, off int, compression map[string]int, compres
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *RKEY) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *RKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -996,17 +996,17 @@ func (rr *RKEY) pack(msg []byte, off int, compression map[string]int, compress b
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *RP) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *RP) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Mbox, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Mbox, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Txt, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Txt, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -1014,7 +1014,7 @@ func (rr *RP) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *RRSIG) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *RRSIG) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1048,7 +1048,7 @@ func (rr *RRSIG) pack(msg []byte, off int, compression map[string]int, compress
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.SignerName, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.SignerName, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -1060,7 +1060,7 @@ func (rr *RRSIG) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *RT) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *RT) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1070,7 +1070,7 @@ func (rr *RT) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Host, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Host, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -1078,7 +1078,7 @@ func (rr *RT) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *SIG) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *SIG) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1112,7 +1112,7 @@ func (rr *SIG) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.SignerName, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.SignerName, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -1124,7 +1124,7 @@ func (rr *SIG) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *SMIMEA) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *SMIMEA) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1150,17 +1150,17 @@ func (rr *SMIMEA) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *SOA) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *SOA) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Ns, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Ns, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Mbox, msg, off, compression, compress)
|
||||
off, _, err = packDomainName(rr.Mbox, msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -1188,7 +1188,7 @@ func (rr *SOA) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *SPF) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *SPF) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1202,7 +1202,7 @@ func (rr *SPF) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *SRV) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *SRV) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1220,7 +1220,7 @@ func (rr *SRV) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.Target, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Target, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -1228,7 +1228,7 @@ func (rr *SRV) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *SSHFP) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *SSHFP) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1250,7 +1250,7 @@ func (rr *SSHFP) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *TA) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *TA) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1276,17 +1276,17 @@ func (rr *TA) pack(msg []byte, off int, compression map[string]int, compress boo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *TALINK) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *TALINK) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.PreviousName, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.PreviousName, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
off, err = PackDomainName(rr.NextName, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.NextName, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -1294,13 +1294,13 @@ func (rr *TALINK) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *TKEY) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *TKEY) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Algorithm, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Algorithm, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -1340,7 +1340,7 @@ func (rr *TKEY) pack(msg []byte, off int, compression map[string]int, compress b
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *TLSA) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *TLSA) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1366,13 +1366,13 @@ func (rr *TLSA) pack(msg []byte, off int, compression map[string]int, compress b
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *TSIG) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *TSIG) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
headerEnd := off
|
||||
off, err = PackDomainName(rr.Algorithm, msg, off, compression, false)
|
||||
off, _, err = packDomainName(rr.Algorithm, msg, off, compression, false)
|
||||
if err != nil {
|
||||
return off, err
|
||||
}
|
||||
@ -1412,7 +1412,7 @@ func (rr *TSIG) pack(msg []byte, off int, compression map[string]int, compress b
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *TXT) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *TXT) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1426,7 +1426,7 @@ func (rr *TXT) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *UID) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *UID) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1440,7 +1440,7 @@ func (rr *UID) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *UINFO) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *UINFO) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1454,7 +1454,7 @@ func (rr *UINFO) pack(msg []byte, off int, compression map[string]int, compress
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *URI) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *URI) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
@ -1476,7 +1476,7 @@ func (rr *URI) pack(msg []byte, off int, compression map[string]int, compress bo
|
||||
return off, nil
|
||||
}
|
||||
|
||||
func (rr *X25) pack(msg []byte, off int, compression map[string]int, compress bool) (int, error) {
|
||||
func (rr *X25) pack(msg []byte, off int, compression compressionMap, compress bool) (int, error) {
|
||||
off, err := rr.Hdr.pack(msg, off, compression, compress)
|
||||
if err != nil {
|
||||
return off, err
|
||||
|
Loading…
x
Reference in New Issue
Block a user