@@ -492,7 +492,7 @@ func (r *Resource) GoString() string {
492
492
// A ResourceBody is a DNS resource record minus the header.
493
493
type ResourceBody interface {
494
494
// 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 )
496
496
497
497
// realType returns the actual type of the Resource. This is used to
498
498
// fill in the header Type field.
@@ -503,7 +503,7 @@ type ResourceBody interface {
503
503
}
504
504
505
505
// 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 ) {
507
507
if r .Body == nil {
508
508
return msg , errNilResouceBody
509
509
}
@@ -1129,7 +1129,7 @@ func (m *Message) AppendPack(b []byte) ([]byte, error) {
1129
1129
// DNS messages can be a maximum of 512 bytes long. Without compression,
1130
1130
// many DNS response messages are over this limit, so enabling
1131
1131
// compression will help ensure compliance.
1132
- compression := map [string ]int {}
1132
+ compression := map [string ]uint16 {}
1133
1133
1134
1134
for i := range m .Questions {
1135
1135
var err error
@@ -1220,7 +1220,7 @@ type Builder struct {
1220
1220
1221
1221
// compression is a mapping from name suffixes to their starting index
1222
1222
// in msg.
1223
- compression map [string ]int
1223
+ compression map [string ]uint16
1224
1224
}
1225
1225
1226
1226
// NewBuilder creates a new builder with compression disabled.
@@ -1257,7 +1257,7 @@ func NewBuilder(buf []byte, h Header) Builder {
1257
1257
//
1258
1258
// Compression should be enabled before any sections are added for best results.
1259
1259
func (b * Builder ) EnableCompression () {
1260
- b .compression = map [string ]int {}
1260
+ b .compression = map [string ]uint16 {}
1261
1261
}
1262
1262
1263
1263
func (b * Builder ) startCheck (s section ) error {
@@ -1673,7 +1673,7 @@ func (h *ResourceHeader) GoString() string {
1673
1673
// pack appends the wire format of the ResourceHeader to oldMsg.
1674
1674
//
1675
1675
// 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 ) {
1677
1677
msg = oldMsg
1678
1678
if msg , err = h .Name .pack (msg , compression , compressionOff ); err != nil {
1679
1679
return oldMsg , 0 , & nestedError {"Name" , err }
@@ -1946,7 +1946,7 @@ func (n *Name) GoString() string {
1946
1946
//
1947
1947
// The compression map will be updated with new domain suffixes. If compression
1948
1948
// 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 ) {
1950
1950
oldMsg := msg
1951
1951
1952
1952
if n .Length > nonEncodedNameMax {
@@ -2010,7 +2010,7 @@ func (n *Name) pack(msg []byte, compression map[string]int, compressionOff int)
2010
2010
// multiple times (for next labels).
2011
2011
nameAsStr = string (n .Data [:n .Length ])
2012
2012
}
2013
- compression [nameAsStr [i :]] = newPtr
2013
+ compression [nameAsStr [i :]] = uint16 ( newPtr )
2014
2014
}
2015
2015
}
2016
2016
}
@@ -2150,7 +2150,7 @@ type Question struct {
2150
2150
}
2151
2151
2152
2152
// 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 ) {
2154
2154
msg , err := q .Name .pack (msg , compression , compressionOff )
2155
2155
if err != nil {
2156
2156
return msg , & nestedError {"Name" , err }
@@ -2246,7 +2246,7 @@ func (r *CNAMEResource) realType() Type {
2246
2246
}
2247
2247
2248
2248
// 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 ) {
2250
2250
return r .CNAME .pack (msg , compression , compressionOff )
2251
2251
}
2252
2252
@@ -2274,7 +2274,7 @@ func (r *MXResource) realType() Type {
2274
2274
}
2275
2275
2276
2276
// 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 ) {
2278
2278
oldMsg := msg
2279
2279
msg = packUint16 (msg , r .Pref )
2280
2280
msg , err := r .MX .pack (msg , compression , compressionOff )
@@ -2313,7 +2313,7 @@ func (r *NSResource) realType() Type {
2313
2313
}
2314
2314
2315
2315
// 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 ) {
2317
2317
return r .NS .pack (msg , compression , compressionOff )
2318
2318
}
2319
2319
@@ -2340,7 +2340,7 @@ func (r *PTRResource) realType() Type {
2340
2340
}
2341
2341
2342
2342
// 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 ) {
2344
2344
return r .PTR .pack (msg , compression , compressionOff )
2345
2345
}
2346
2346
@@ -2377,7 +2377,7 @@ func (r *SOAResource) realType() Type {
2377
2377
}
2378
2378
2379
2379
// 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 ) {
2381
2381
oldMsg := msg
2382
2382
msg , err := r .NS .pack (msg , compression , compressionOff )
2383
2383
if err != nil {
@@ -2449,7 +2449,7 @@ func (r *TXTResource) realType() Type {
2449
2449
}
2450
2450
2451
2451
// 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 ) {
2453
2453
oldMsg := msg
2454
2454
for _ , s := range r .TXT {
2455
2455
var err error
@@ -2505,7 +2505,7 @@ func (r *SRVResource) realType() Type {
2505
2505
}
2506
2506
2507
2507
// 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 ) {
2509
2509
oldMsg := msg
2510
2510
msg = packUint16 (msg , r .Priority )
2511
2511
msg = packUint16 (msg , r .Weight )
@@ -2556,7 +2556,7 @@ func (r *AResource) realType() Type {
2556
2556
}
2557
2557
2558
2558
// 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 ) {
2560
2560
return packBytes (msg , r .A [:]), nil
2561
2561
}
2562
2562
@@ -2590,7 +2590,7 @@ func (r *AAAAResource) GoString() string {
2590
2590
}
2591
2591
2592
2592
// 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 ) {
2594
2594
return packBytes (msg , r .AAAA [:]), nil
2595
2595
}
2596
2596
@@ -2630,7 +2630,7 @@ func (r *OPTResource) realType() Type {
2630
2630
return TypeOPT
2631
2631
}
2632
2632
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 ) {
2634
2634
for _ , opt := range r .Options {
2635
2635
msg = packUint16 (msg , opt .Code )
2636
2636
l := uint16 (len (opt .Data ))
@@ -2688,7 +2688,7 @@ func (r *UnknownResource) realType() Type {
2688
2688
}
2689
2689
2690
2690
// 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 ) {
2692
2692
return packBytes (msg , r .Data [:]), nil
2693
2693
}
2694
2694
0 commit comments