func (rd *WKS) Decode(b []byte, pos *int, sniffer dns.WireDecodeSniffer) (err error) {
	p0 := &b[*pos]
	if err = (*ip4)(&rd.Address).Decode(b, pos, sniffer); err != nil {
		return
	}

	if err = (*dns.Octet)(&rd.Protocol).Decode(b, pos, sniffer); err != nil {
		return
	}

	rd.Ports = map[IP_Port]struct{}{}
	n := len(b) - *pos
	if n == 0 {
		if sniffer != nil {
			sniffer(p0, &b[*pos-1], dns.SniffRDataWKS, rd)
		}
		return
	}

	b = b[*pos:]
	for i, v := range b {
		for bit := 0; v != 0; bit, v = bit+1, v>>1 {
			if v&1 != 0 {
				rd.Ports[IP_Port(i<<3+bit)] = struct{}{}
			}
		}
	}
	*pos += n
	if sniffer != nil {
		sniffer(p0, &b[*pos-1], dns.SniffRDataWKS, rd)
	}
	return
}
// Implementation of dns.Wirer
Implementation of dns.Wirer
// Implementation of dns . Wirer
func (rd *WKS) Decode(b []byte, pos *int, sniffer dns.WireDecodeSniffer) (err error) {
	p0 := &b[*pos]
	if err = (*ip4)(&rd.Address).Decode(b, pos, sniffer); err != nil {
		return
	}
	if err = (*dns.Octet)(&rd.Protocol).Decode(b, pos, sniffer); err != nil {
		return
	}
	rd.Ports = map[IP_Port]struct{}{}
	n := len(b) - *pos
	if n == 0 {
		if sniffer != nil {
			sniffer(p0, &b[*pos-1], dns.SniffRDataWKS, rd)
		}
		return
	}
	b = b[*pos:]
	for i, v := range b {
		for bit := 0; v != 0; bit, v = bit+1, v>>1 {
			if v&1 != 0 {
				rd.Ports[IP_Port(i<<3+bit)] = struct{}{}
			}
		}
	}
	*pos += n
	if sniffer != nil {
		sniffer(p0, &b[*pos-1], dns.SniffRDataWKS, rd)
	}
	return
}
func ( rd * WKS ) Decode ( b [ ] byte , pos * int , sniffer dns . WireDecodeSniffer ) ( err error ) { p0 := & b [ * pos ] if err = ( * ip4 ) ( & rd . Address ) . Decode ( b , pos , sniffer ) ; err != nil { return } if err = ( * dns . Octet ) ( & rd . Protocol ) . Decode ( b , pos , sniffer ) ; err != nil { return } rd . Ports = map [ IP_Port ] struct { } { } n := len ( b ) - * pos if n == 0 { if sniffer != nil { sniffer ( p0 , & b [ * pos - 1 ] , dns . SniffRDataWKS , rd ) } return } b = b [ * pos : ] for i , v := range b { for bit := 0 ; v != 0 ; bit , v = bit + 1 , v >> 1 { if v & 1 != 0 { rd . Ports [ IP_Port ( i << 3 + bit ) ] = struct { } { } } } } * pos += n if sniffer != nil { sniffer ( p0 , & b [ * pos - 1 ] , dns . SniffRDataWKS , rd ) } return }
Implementation of dns.Wirer
Implementation of dns . Wirer