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

	var ts int64
	var bt dns.Octet
	for i := 0; i < 6; i++ {
		if err = bt.Decode(b, pos, sniffer); err != nil {
			return
		}

		ts = ts<<8 | int64(bt)
	}
	rd.TimeSigned = time.Unix(ts, 0)

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

	rd.Fudge = time.Duration(u16) * time.Second

	if err = u16.Decode(b, pos, sniffer); err != nil {
		return
	}

	n := int(u16)
	if *pos+n > len(b)+1 {
		return fmt.Errorf("(*rr.TSIG).Decode() - buffer underflow")
	}

	rd.MAC = make([]byte, n)
	copy(rd.MAC, b[*pos:])
	*pos += n

	if err = u16.Decode(b, pos, sniffer); err != nil {
		return
	}

	rd.OriginalID = uint16(u16)

	if err = u16.Decode(b, pos, sniffer); err != nil {
		return
	}

	rd.Error = TSIGRCODE(u16)

	if err = u16.Decode(b, pos, sniffer); err != nil {
		return
	}

	n = int(u16)
	if *pos+n > len(b)+1 {
		return fmt.Errorf("(*rr.TSIG).Decode() - buffer underflow")
	}

	rd.OtherData = make([]byte, n)
	copy(rd.OtherData, b[*pos:])
	*pos += n

	if sniffer != nil {
		sniffer(p0, &b[*pos-1], dns.SniffRDataTSIG, rd)
	}
	return
}
// Implementation of dns.Wirer
Implementation of dns.Wirer
// Implementation of dns . Wirer
func (rd *TSIG) Decode(b []byte, pos *int, sniffer dns.WireDecodeSniffer) (err error) {
	p0 := &b[*pos]
	if err = (*dns.DomainName)(&rd.AlgorithmName).Decode(b, pos, sniffer); err != nil {
		return
	}
	var ts int64
	var bt dns.Octet
	for i := 0; i < 6; i++ {
		if err = bt.Decode(b, pos, sniffer); err != nil {
			return
		}
		ts = ts<<8 | int64(bt)
	}
	rd.TimeSigned = time.Unix(ts, 0)
	var u16 dns.Octets2
	if err = u16.Decode(b, pos, sniffer); err != nil {
		return
	}
	rd.Fudge = time.Duration(u16) * time.Second
	if err = u16.Decode(b, pos, sniffer); err != nil {
		return
	}
	n := int(u16)
	if *pos+n > len(b)+1 {
		return fmt.Errorf("(*rr.TSIG).Decode() - buffer underflow")
	}
	rd.MAC = make([]byte, n)
	copy(rd.MAC, b[*pos:])
	*pos += n
	if err = u16.Decode(b, pos, sniffer); err != nil {
		return
	}
	rd.OriginalID = uint16(u16)
	if err = u16.Decode(b, pos, sniffer); err != nil {
		return
	}
	rd.Error = TSIGRCODE(u16)
	if err = u16.Decode(b, pos, sniffer); err != nil {
		return
	}
	n = int(u16)
	if *pos+n > len(b)+1 {
		return fmt.Errorf("(*rr.TSIG).Decode() - buffer underflow")
	}
	rd.OtherData = make([]byte, n)
	copy(rd.OtherData, b[*pos:])
	*pos += n
	if sniffer != nil {
		sniffer(p0, &b[*pos-1], dns.SniffRDataTSIG, rd)
	}
	return
}
func ( rd * TSIG ) Decode ( b [ ] byte , pos * int , sniffer dns . WireDecodeSniffer ) ( err error ) { p0 := & b [ * pos ] if err = ( * dns . DomainName ) ( & rd . AlgorithmName ) . Decode ( b , pos , sniffer ) ; err != nil { return } var ts int64 var bt dns . Octet for i := 0 ; i < 6 ; i ++ { if err = bt . Decode ( b , pos , sniffer ) ; err != nil { return } ts = ts << 8 | int64 ( bt ) } rd . TimeSigned = time . Unix ( ts , 0 ) var u16 dns . Octets2 if err = u16 . Decode ( b , pos , sniffer ) ; err != nil { return } rd . Fudge = time . Duration ( u16 ) * time . Second if err = u16 . Decode ( b , pos , sniffer ) ; err != nil { return } n := int ( u16 ) if * pos + n > len ( b ) + 1 { return fmt . Errorf ( " " ) } rd . MAC = make ( [ ] byte , n ) copy ( rd . MAC , b [ * pos : ] ) * pos += n if err = u16 . Decode ( b , pos , sniffer ) ; err != nil { return } rd . OriginalID = uint16 ( u16 ) if err = u16 . Decode ( b , pos , sniffer ) ; err != nil { return } rd . Error = TSIGRCODE ( u16 ) if err = u16 . Decode ( b , pos , sniffer ) ; err != nil { return } n = int ( u16 ) if * pos + n > len ( b ) + 1 { return fmt . Errorf ( " " ) } rd . OtherData = make ( [ ] byte , n ) copy ( rd . OtherData , b [ * pos : ] ) * pos += n if sniffer != nil { sniffer ( p0 , & b [ * pos - 1 ] , dns . SniffRDataTSIG , rd ) } return }
Implementation of dns.Wirer
Implementation of dns . Wirer