code: func (p *Packet) UnmarshalBinary(q []byte) error {
  	b := buffer.New(q)
  	// Packet must contain at least a message type and transaction ID
  	if b.Len() < 4 {
  		return ErrInvalidPacket
  	}
  
  	p.MessageType = MessageType(b.Read8())
  	b.ReadBytes(p.TransactionID[:])
  
  	if err := (&p.Options).UnmarshalBinary(b.Remaining()); err != nil {
  		return ErrInvalidPacket
  	}
  	return nil
  }
docs: // UnmarshalBinary unmarshals a raw byte slice into a Packet.
  //
  // If the byte slice does not contain enough data to form a valid Packet,
  // ErrInvalidPacket is returned.