@@ -492,7 +492,7 @@ func (r *Resource) GoString() string {
492492// A ResourceBody is a DNS resource record minus the header.
493493type ResourceBody interface {
494494 // pack packs a Resource except for its header.
495- pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error )
495+ pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error )
496496
497497 // realType returns the actual type of the Resource. This is used to
498498 // fill in the header Type field.
@@ -503,7 +503,7 @@ type ResourceBody interface {
503503}
504504
505505// pack appends the wire format of the Resource to msg.
506- func (r * Resource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
506+ func (r * Resource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
507507 if r .Body == nil {
508508 return msg , errNilResouceBody
509509 }
@@ -1129,7 +1129,7 @@ func (m *Message) AppendPack(b []byte) ([]byte, error) {
11291129 // DNS messages can be a maximum of 512 bytes long. Without compression,
11301130 // many DNS response messages are over this limit, so enabling
11311131 // compression will help ensure compliance.
1132- compression := map [string ]int {}
1132+ compression := map [string ]uint16 {}
11331133
11341134 for i := range m .Questions {
11351135 var err error
@@ -1220,7 +1220,7 @@ type Builder struct {
12201220
12211221 // compression is a mapping from name suffixes to their starting index
12221222 // in msg.
1223- compression map [string ]int
1223+ compression map [string ]uint16
12241224}
12251225
12261226// NewBuilder creates a new builder with compression disabled.
@@ -1257,7 +1257,7 @@ func NewBuilder(buf []byte, h Header) Builder {
12571257//
12581258// Compression should be enabled before any sections are added for best results.
12591259func (b * Builder ) EnableCompression () {
1260- b .compression = map [string ]int {}
1260+ b .compression = map [string ]uint16 {}
12611261}
12621262
12631263func (b * Builder ) startCheck (s section ) error {
@@ -1673,7 +1673,7 @@ func (h *ResourceHeader) GoString() string {
16731673// pack appends the wire format of the ResourceHeader to oldMsg.
16741674//
16751675// lenOff is the offset in msg where the Length field was packed.
1676- func (h * ResourceHeader ) pack (oldMsg []byte , compression map [string ]int , compressionOff int ) (msg []byte , lenOff int , err error ) {
1676+ func (h * ResourceHeader ) pack (oldMsg []byte , compression map [string ]uint16 , compressionOff int ) (msg []byte , lenOff int , err error ) {
16771677 msg = oldMsg
16781678 if msg , err = h .Name .pack (msg , compression , compressionOff ); err != nil {
16791679 return oldMsg , 0 , & nestedError {"Name" , err }
@@ -1946,7 +1946,7 @@ func (n *Name) GoString() string {
19461946//
19471947// The compression map will be updated with new domain suffixes. If compression
19481948// is nil, compression will not be used.
1949- func (n * Name ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
1949+ func (n * Name ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
19501950 oldMsg := msg
19511951
19521952 if n .Length > nonEncodedNameMax {
@@ -2010,7 +2010,7 @@ func (n *Name) pack(msg []byte, compression map[string]int, compressionOff int)
20102010 // multiple times (for next labels).
20112011 nameAsStr = string (n .Data [:n .Length ])
20122012 }
2013- compression [nameAsStr [i :]] = newPtr
2013+ compression [nameAsStr [i :]] = uint16 ( newPtr )
20142014 }
20152015 }
20162016 }
@@ -2150,7 +2150,7 @@ type Question struct {
21502150}
21512151
21522152// pack appends the wire format of the Question to msg.
2153- func (q * Question ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2153+ func (q * Question ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
21542154 msg , err := q .Name .pack (msg , compression , compressionOff )
21552155 if err != nil {
21562156 return msg , & nestedError {"Name" , err }
@@ -2246,7 +2246,7 @@ func (r *CNAMEResource) realType() Type {
22462246}
22472247
22482248// pack appends the wire format of the CNAMEResource to msg.
2249- func (r * CNAMEResource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2249+ func (r * CNAMEResource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
22502250 return r .CNAME .pack (msg , compression , compressionOff )
22512251}
22522252
@@ -2274,7 +2274,7 @@ func (r *MXResource) realType() Type {
22742274}
22752275
22762276// pack appends the wire format of the MXResource to msg.
2277- func (r * MXResource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2277+ func (r * MXResource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
22782278 oldMsg := msg
22792279 msg = packUint16 (msg , r .Pref )
22802280 msg , err := r .MX .pack (msg , compression , compressionOff )
@@ -2313,7 +2313,7 @@ func (r *NSResource) realType() Type {
23132313}
23142314
23152315// pack appends the wire format of the NSResource to msg.
2316- func (r * NSResource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2316+ func (r * NSResource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
23172317 return r .NS .pack (msg , compression , compressionOff )
23182318}
23192319
@@ -2340,7 +2340,7 @@ func (r *PTRResource) realType() Type {
23402340}
23412341
23422342// pack appends the wire format of the PTRResource to msg.
2343- func (r * PTRResource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2343+ func (r * PTRResource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
23442344 return r .PTR .pack (msg , compression , compressionOff )
23452345}
23462346
@@ -2377,7 +2377,7 @@ func (r *SOAResource) realType() Type {
23772377}
23782378
23792379// pack appends the wire format of the SOAResource to msg.
2380- func (r * SOAResource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2380+ func (r * SOAResource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
23812381 oldMsg := msg
23822382 msg , err := r .NS .pack (msg , compression , compressionOff )
23832383 if err != nil {
@@ -2449,7 +2449,7 @@ func (r *TXTResource) realType() Type {
24492449}
24502450
24512451// pack appends the wire format of the TXTResource to msg.
2452- func (r * TXTResource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2452+ func (r * TXTResource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
24532453 oldMsg := msg
24542454 for _ , s := range r .TXT {
24552455 var err error
@@ -2505,7 +2505,7 @@ func (r *SRVResource) realType() Type {
25052505}
25062506
25072507// pack appends the wire format of the SRVResource to msg.
2508- func (r * SRVResource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2508+ func (r * SRVResource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
25092509 oldMsg := msg
25102510 msg = packUint16 (msg , r .Priority )
25112511 msg = packUint16 (msg , r .Weight )
@@ -2556,7 +2556,7 @@ func (r *AResource) realType() Type {
25562556}
25572557
25582558// pack appends the wire format of the AResource to msg.
2559- func (r * AResource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2559+ func (r * AResource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
25602560 return packBytes (msg , r .A [:]), nil
25612561}
25622562
@@ -2590,7 +2590,7 @@ func (r *AAAAResource) GoString() string {
25902590}
25912591
25922592// pack appends the wire format of the AAAAResource to msg.
2593- func (r * AAAAResource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2593+ func (r * AAAAResource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
25942594 return packBytes (msg , r .AAAA [:]), nil
25952595}
25962596
@@ -2630,7 +2630,7 @@ func (r *OPTResource) realType() Type {
26302630 return TypeOPT
26312631}
26322632
2633- func (r * OPTResource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2633+ func (r * OPTResource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
26342634 for _ , opt := range r .Options {
26352635 msg = packUint16 (msg , opt .Code )
26362636 l := uint16 (len (opt .Data ))
@@ -2688,7 +2688,7 @@ func (r *UnknownResource) realType() Type {
26882688}
26892689
26902690// pack appends the wire format of the UnknownResource to msg.
2691- func (r * UnknownResource ) pack (msg []byte , compression map [string ]int , compressionOff int ) ([]byte , error ) {
2691+ func (r * UnknownResource ) pack (msg []byte , compression map [string ]uint16 , compressionOff int ) ([]byte , error ) {
26922692 return packBytes (msg , r .Data [:]), nil
26932693}
26942694
0 commit comments