func NewPacket(r io.Reader) (p Packet, err error) {
	h, err := NewHeader(r)
	if err != nil {
		return
	}
	p.Header = h

	if err = p.Header.Check(); err != nil {
		return
	}
	payloadLength := int(p.Header.TotalLength) - int(p.Header.IHL)*4
	p.Payload = make([]byte, payloadLength)
	_, err = r.Read(p.Payload)
	return
}
// NewPacket will read a packet from a reader.
//
// The header will be checked using the Check() function. Only valid packets
// will be returned, unless err is not nil.
NewPacket will read a packet from a reader.

The header will be checked using the Check() function. Only valid packets
will be returned, unless err is not nil.
// NewPacket will read a packet from a reader . // // The header will be checked using the Check () function . Only valid packets // will be returned unless err is not nil .
func NewPacket(r io.Reader) (p Packet, err error) {
	h, err := NewHeader(r)
	if err != nil {
		return
	}
	p.Header = h
	if err = p.Header.Check(); err != nil {
		return
	}
	payloadLength := int(p.Header.TotalLength) - int(p.Header.IHL)*4
	p.Payload = make([]byte, payloadLength)
	_, err = r.Read(p.Payload)
	return
}
func NewPacket ( r io . Reader ) ( p Packet , err error ) { h , err := NewHeader ( r ) if err != nil { return } p . Header = h if err = p . Header . Check ( ) ; err != nil { return } payloadLength := int ( p . Header . TotalLength ) - int ( p . Header . IHL ) * 4 p . Payload = make ( [ ] byte , payloadLength ) _ , err = r . Read ( p . Payload ) return }
NewPacket will read a packet from a reader.
NewPacket will read a packet from a reader .