unexport unpackStruct
This commit is contained in:
parent
d2e0c31946
commit
d495831a86
10
msg.go
10
msg.go
|
@ -1010,7 +1010,7 @@ func unpackUint16(msg []byte, off int) (v uint16, off1 int) {
|
|||
return
|
||||
}
|
||||
|
||||
func UnpackStruct(any interface{}, msg []byte, off int) (off1 int, ok bool) {
|
||||
func unpackStruct(any interface{}, msg []byte, off int) (off1 int, ok bool) {
|
||||
off, ok = unpackStructValue(structValue(any), msg, off)
|
||||
return off, ok
|
||||
}
|
||||
|
@ -1074,7 +1074,7 @@ func unpackRR(msg []byte, off int) (rr RR, off1 int, ok bool) {
|
|||
// unpack just the header, to find the rr type and length
|
||||
var h RR_Header
|
||||
off0 := off
|
||||
if off, ok = UnpackStruct(&h, msg, off); !ok {
|
||||
if off, ok = unpackStruct(&h, msg, off); !ok {
|
||||
return nil, len(msg), false
|
||||
}
|
||||
end := off + int(h.Rdlength)
|
||||
|
@ -1085,7 +1085,7 @@ func unpackRR(msg []byte, off int) (rr RR, off1 int, ok bool) {
|
|||
} else {
|
||||
rr = mk()
|
||||
}
|
||||
off, ok = UnpackStruct(rr, msg, off0)
|
||||
off, ok = unpackStruct(rr, msg, off0)
|
||||
if off != end {
|
||||
return &h, end, true
|
||||
}
|
||||
|
@ -1239,7 +1239,7 @@ func (dns *Msg) Unpack(msg []byte) bool {
|
|||
var dh Header
|
||||
off := 0
|
||||
var ok bool
|
||||
if off, ok = UnpackStruct(&dh, msg, off); !ok {
|
||||
if off, ok = unpackStruct(&dh, msg, off); !ok {
|
||||
return false
|
||||
}
|
||||
dns.Id = dh.Id
|
||||
|
@ -1261,7 +1261,7 @@ func (dns *Msg) Unpack(msg []byte) bool {
|
|||
dns.Extra = make([]RR, dh.Arcount)
|
||||
|
||||
for i := 0; i < len(dns.Question); i++ {
|
||||
off, ok = UnpackStruct(&dns.Question[i], msg, off)
|
||||
off, ok = unpackStruct(&dns.Question[i], msg, off)
|
||||
}
|
||||
for i := 0; i < len(dns.Answer); i++ {
|
||||
dns.Answer[i], off, ok = unpackRR(msg, off)
|
||||
|
|
4
tsig.go
4
tsig.go
|
@ -302,7 +302,7 @@ func stripTsig(msg []byte) ([]byte, *RR_TSIG, error) {
|
|||
off := 0
|
||||
tsigoff := 0
|
||||
var ok bool
|
||||
if off, ok = UnpackStruct(&dh, msg, off); !ok {
|
||||
if off, ok = unpackStruct(&dh, msg, off); !ok {
|
||||
return nil, nil, ErrUnpack
|
||||
}
|
||||
if dh.Arcount == 0 {
|
||||
|
@ -320,7 +320,7 @@ func stripTsig(msg []byte) ([]byte, *RR_TSIG, error) {
|
|||
dns.Extra = make([]RR, dh.Arcount)
|
||||
|
||||
for i := 0; i < len(dns.Question); i++ {
|
||||
off, ok = UnpackStruct(&dns.Question[i], msg, off)
|
||||
off, ok = unpackStruct(&dns.Question[i], msg, off)
|
||||
}
|
||||
for i := 0; i < len(dns.Answer); i++ {
|
||||
dns.Answer[i], off, ok = unpackRR(msg, off)
|
||||
|
|
Loading…
Reference in New Issue