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

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

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

	switch rd.GatewayType {
	default:
		return fmt.Errorf("(*IPSECKEY.Decode(): Unknown GatewayType %d", rd.GatewayType)
	case GatewayNone:
		// nop
	case GatewayIPV4:
		if *pos+4 > len(b)+1 {
			return errors.New("(*IPSECKEY.Decode(): Buffer undeflow")
		}

		rd.Gateway = net.IP(append([]byte{}, b[*pos:*pos+4]...))
		*pos += 4
	case GatewayIPV6:
		if *pos+16 > len(b)+1 {
			return errors.New("(*IPSECKEY.Decode(): Buffer undeflow")
		}

		rd.Gateway = net.IP(append([]byte{}, b[*pos:*pos+16]...))
		*pos += 16
	case GatewayDomain:
		var n dns.DomainName
		if err = (*dns.DomainName)(&n).Decode(b, pos, sniffer); err != nil {
			return
		}

		rd.Gateway = string(n)
	}

	n := len(b) - *pos
	if n <= 0 {
		return fmt.Errorf("(*IPSECKEY).Decode: no key data")
	}

	rd.PublicKey = make([]byte, n)
	copy(rd.PublicKey, b[*pos:])
	*pos += n
	if sniffer != nil {
		sniffer(p0, &b[*pos-1], dns.SniffRDataIPSECKEY, rd)
	}
	return
}
// Implementation of dns.Wirer
Implementation of dns.Wirer
// Implementation of dns . Wirer
func (rd *IPSECKEY) Decode(b []byte, pos *int, sniffer dns.WireDecodeSniffer) (err error) {
	p0 := &b[*pos]
	if err = (*dns.Octet)(&rd.Precedence).Decode(b, pos, sniffer); err != nil {
		return
	}
	if err = (*dns.Octet)(&rd.GatewayType).Decode(b, pos, sniffer); err != nil {
		return
	}
	if err = (*dns.Octet)(&rd.Algorithm).Decode(b, pos, sniffer); err != nil {
		return
	}
	switch rd.GatewayType {
	default:
		return fmt.Errorf("(*IPSECKEY.Decode(): Unknown GatewayType %d", rd.GatewayType)
	case GatewayNone:
	case GatewayIPV4:
		if *pos+4 > len(b)+1 {
			return errors.New("(*IPSECKEY.Decode(): Buffer undeflow")
		}
		rd.Gateway = net.IP(append([]byte{}, b[*pos:*pos+4]...))
		*pos += 4
	case GatewayIPV6:
		if *pos+16 > len(b)+1 {
			return errors.New("(*IPSECKEY.Decode(): Buffer undeflow")
		}
		rd.Gateway = net.IP(append([]byte{}, b[*pos:*pos+16]...))
		*pos += 16
	case GatewayDomain:
		var n dns.DomainName
		if err = (*dns.DomainName)(&n).Decode(b, pos, sniffer); err != nil {
			return
		}
		rd.Gateway = string(n)
	}
	n := len(b) - *pos
	if n <= 0 {
		return fmt.Errorf("(*IPSECKEY).Decode: no key data")
	}
	rd.PublicKey = make([]byte, n)
	copy(rd.PublicKey, b[*pos:])
	*pos += n
	if sniffer != nil {
		sniffer(p0, &b[*pos-1], dns.SniffRDataIPSECKEY, rd)
	}
	return
}
func ( rd * IPSECKEY ) Decode ( b [ ] byte , pos * int , sniffer dns . WireDecodeSniffer ) ( err error ) { p0 := & b [ * pos ] if err = ( * dns . Octet ) ( & rd . Precedence ) . Decode ( b , pos , sniffer ) ; err != nil { return } if err = ( * dns . Octet ) ( & rd . GatewayType ) . Decode ( b , pos , sniffer ) ; err != nil { return } if err = ( * dns . Octet ) ( & rd . Algorithm ) . Decode ( b , pos , sniffer ) ; err != nil { return } switch rd . GatewayType { default : return fmt . Errorf ( " " , rd . GatewayType ) case GatewayNone : case GatewayIPV4 : if * pos + 4 > len ( b ) + 1 { return errors . New ( " " ) } rd . Gateway = net . IP ( append ( [ ] byte { } , b [ * pos : * pos + 4 ] ... ) ) * pos += 4 case GatewayIPV6 : if * pos + 16 > len ( b ) + 1 { return errors . New ( " " ) } rd . Gateway = net . IP ( append ( [ ] byte { } , b [ * pos : * pos + 16 ] ... ) ) * pos += 16 case GatewayDomain : var n dns . DomainName if err = ( * dns . DomainName ) ( & n ) . Decode ( b , pos , sniffer ) ; err != nil { return } rd . Gateway = string ( n ) } n := len ( b ) - * pos if n <= 0 { return fmt . Errorf ( " " ) } rd . PublicKey = make ( [ ] byte , n ) copy ( rd . PublicKey , b [ * pos : ] ) * pos += n if sniffer != nil { sniffer ( p0 , & b [ * pos - 1 ] , dns . SniffRDataIPSECKEY , rd ) } return }
Implementation of dns.Wirer
Implementation of dns . Wirer
// nop