change comments
This commit is contained in:
parent
b2f459b7fa
commit
fb0623fbb2
2
edns.go
2
edns.go
|
@ -39,7 +39,7 @@ const (
|
|||
|
||||
type RR_OPT struct {
|
||||
Hdr RR_Header
|
||||
Option []EDNS0 `dns:"opt"` // tag is used in Pack and Unpack
|
||||
Option []EDNS0 `dns:"opt"`
|
||||
}
|
||||
|
||||
func (rr *RR_OPT) Header() *RR_Header {
|
||||
|
|
28
msg.go
28
msg.go
|
@ -456,6 +456,22 @@ func packStructValue(val reflect.Value, msg []byte, off int, compression map[str
|
|||
msg[off] = byte(fv.Index(j).Uint())
|
||||
off++
|
||||
}
|
||||
case "wks":
|
||||
if val.Field(i).Len() == 0 {
|
||||
break
|
||||
}
|
||||
var bitmapbyte uint16
|
||||
for j := 0; j < val.Field(i).Len(); j++ {
|
||||
serv := uint16((fv.Index(j).Uint()))
|
||||
bitmapbyte = uint16(serv / 8)
|
||||
if int(bitmapbyte) > lenmsg {
|
||||
println("dns: overflow packing WKS")
|
||||
return lenmsg, false
|
||||
}
|
||||
bit := uint16(serv) - bitmapbyte*8
|
||||
msg[bitmapbyte] = byte(1 << (7 - bit))
|
||||
}
|
||||
off += int(bitmapbyte)
|
||||
case "nsec": // NSEC/NSEC3
|
||||
// This is the uint16 type bitmap
|
||||
if val.Field(i).Len() == 0 {
|
||||
|
@ -731,8 +747,18 @@ func unpackStructValue(val reflect.Value, msg []byte, off int) (off1 int, ok boo
|
|||
msg[off+5], msg[off+6], msg[off+7], msg[off+8], msg[off+9], msg[off+10],
|
||||
msg[off+11], msg[off+12], msg[off+13], msg[off+14], msg[off+15]}))
|
||||
off += net.IPv6len
|
||||
case "wks":
|
||||
// Rest of the record is the bitmap
|
||||
rdlength := int(val.FieldByName("Hdr").FieldByName("Rdlength").Uint())
|
||||
endrr := rdstart + rdlength
|
||||
serv := make([]uint16, 0)
|
||||
for off < endrr {
|
||||
|
||||
}
|
||||
|
||||
|
||||
case "nsec": // NSEC/NSEC3
|
||||
// Rest of the Record is the type bitmap
|
||||
// Rest of the record is the type bitmap
|
||||
rdlength := int(val.FieldByName("Hdr").FieldByName("Rdlength").Uint())
|
||||
endrr := rdstart + rdlength
|
||||
|
||||
|
|
18
types.go
18
types.go
|
@ -1151,10 +1151,10 @@ func (rr *RR_HIP) Len() int {
|
|||
}
|
||||
|
||||
type RR_WKS struct {
|
||||
Hdr RR_Header
|
||||
Address net.IP `dns:"a"`
|
||||
Protocol uint8
|
||||
Bitmap []uint16 `dns:"wks"`
|
||||
Hdr RR_Header
|
||||
Address net.IP `dns:"a"`
|
||||
Protocol uint8
|
||||
Bitmap []uint16 `dns:"wks"`
|
||||
}
|
||||
|
||||
func (rr *RR_WKS) Header() *RR_Header {
|
||||
|
@ -1162,8 +1162,12 @@ func (rr *RR_WKS) Header() *RR_Header {
|
|||
}
|
||||
|
||||
func (rr *RR_WKS) String() string {
|
||||
return rr.Hdr.String() +
|
||||
" " + rr.Address.String()
|
||||
s := rr.Hdr.String() + " " + rr.Address.String()
|
||||
for i := 0; i < len(rr.Bitmap); i++ {
|
||||
// lookup the port
|
||||
s += " " + strconv.Itoa(int(rr.Bitmap[i]))
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func (rr *RR_WKS) Len() int {
|
||||
|
@ -1244,7 +1248,7 @@ var rr_mk = map[uint16]func() RR{
|
|||
TypeNAPTR: func() RR { return new(RR_NAPTR) },
|
||||
TypeDNAME: func() RR { return new(RR_DNAME) },
|
||||
TypeA: func() RR { return new(RR_A) },
|
||||
TypeWKS: func() RR { return new(RR_WKS) },
|
||||
TypeWKS: func() RR { return new(RR_WKS) },
|
||||
TypeAAAA: func() RR { return new(RR_AAAA) },
|
||||
TypeLOC: func() RR { return new(RR_LOC) },
|
||||
TypeOPT: func() RR { return new(RR_OPT) },
|
||||
|
|
Loading…
Reference in New Issue