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

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

	var pkLength dns.Octets2
	if err = pkLength.Decode(b, pos, sniffer); err != nil {
		return
	}

	if *pos+int(hitLength) > len(b)+1 {
		return fmt.Errorf("(*rr.HIP).Decode() - buffer underflow")
	}

	rd.HIT = make([]byte, int(hitLength))
	copy(rd.HIT, b[*pos:*pos+int(hitLength)])
	*pos += int(hitLength)

	if *pos+int(pkLength) > len(b)+1 {
		return fmt.Errorf("(*rr.HIP).Decode() - buffer underflow")
	}

	rd.PublicKey = make([]byte, int(pkLength))
	copy(rd.PublicKey, b[*pos:*pos+int(pkLength)])
	*pos += int(pkLength)

	rd.RendezvousServers = nil
	for *pos < len(b) {
		var s dns.DomainName
		if err = s.Decode(b, pos, sniffer); err != nil {
			return
		}

		rd.RendezvousServers = append(rd.RendezvousServers, string(s))
	}

	if sniffer != nil {
		sniffer(p0, &b[*pos-1], dns.SniffRDataHIP, rd)
	}
	return
}
// Implementation of dns.Wirer
Implementation of dns.Wirer
// Implementation of dns . Wirer
func (rd *HIP) Decode(b []byte, pos *int, sniffer dns.WireDecodeSniffer) (err error) {
	p0 := &b[*pos]
	var hitLength dns.Octet
	if err = hitLength.Decode(b, pos, sniffer); err != nil {
		return
	}
	if err = (*dns.Octet)(&rd.PKAlgorithm).Decode(b, pos, sniffer); err != nil {
		return
	}
	var pkLength dns.Octets2
	if err = pkLength.Decode(b, pos, sniffer); err != nil {
		return
	}
	if *pos+int(hitLength) > len(b)+1 {
		return fmt.Errorf("(*rr.HIP).Decode() - buffer underflow")
	}
	rd.HIT = make([]byte, int(hitLength))
	copy(rd.HIT, b[*pos:*pos+int(hitLength)])
	*pos += int(hitLength)
	if *pos+int(pkLength) > len(b)+1 {
		return fmt.Errorf("(*rr.HIP).Decode() - buffer underflow")
	}
	rd.PublicKey = make([]byte, int(pkLength))
	copy(rd.PublicKey, b[*pos:*pos+int(pkLength)])
	*pos += int(pkLength)
	rd.RendezvousServers = nil
	for *pos < len(b) {
		var s dns.DomainName
		if err = s.Decode(b, pos, sniffer); err != nil {
			return
		}
		rd.RendezvousServers = append(rd.RendezvousServers, string(s))
	}
	if sniffer != nil {
		sniffer(p0, &b[*pos-1], dns.SniffRDataHIP, rd)
	}
	return
}
func ( rd * HIP ) Decode ( b [ ] byte , pos * int , sniffer dns . WireDecodeSniffer ) ( err error ) { p0 := & b [ * pos ] var hitLength dns . Octet if err = hitLength . Decode ( b , pos , sniffer ) ; err != nil { return } if err = ( * dns . Octet ) ( & rd . PKAlgorithm ) . Decode ( b , pos , sniffer ) ; err != nil { return } var pkLength dns . Octets2 if err = pkLength . Decode ( b , pos , sniffer ) ; err != nil { return } if * pos + int ( hitLength ) > len ( b ) + 1 { return fmt . Errorf ( " " ) } rd . HIT = make ( [ ] byte , int ( hitLength ) ) copy ( rd . HIT , b [ * pos : * pos + int ( hitLength ) ] ) * pos += int ( hitLength ) if * pos + int ( pkLength ) > len ( b ) + 1 { return fmt . Errorf ( " " ) } rd . PublicKey = make ( [ ] byte , int ( pkLength ) ) copy ( rd . PublicKey , b [ * pos : * pos + int ( pkLength ) ] ) * pos += int ( pkLength ) rd . RendezvousServers = nil for * pos < len ( b ) { var s dns . DomainName if err = s . Decode ( b , pos , sniffer ) ; err != nil { return } rd . RendezvousServers = append ( rd . RendezvousServers , string ( s ) ) } if sniffer != nil { sniffer ( p0 , & b [ * pos - 1 ] , dns . SniffRDataHIP , rd ) } return }
Implementation of dns.Wirer
Implementation of dns . Wirer