// NewIPTuple constructs an IPTuple from the information in the pkt.Packet
// headers.  This assumes that the packet is an IP packet.
NewIPTuple constructs an IPTuple from the information in the pkt.Packet
headers.  This assumes that the packet is an IP packet.
// NewIPTuple constructs an IPTuple from the information in the pkt . Packet // headers . This assumes that the packet is an IP packet .
func NewIPTuple(p *pkt.Packet) (*IPTuple, error) {
	ip := &IPTuple{}
	if p == nil {
		return ip, nil
	}
	ipHdr, ok := p.Headers[pkt.NetworkLayer].(pkt.InetProtoHdr)
	if !ok || ipHdr == nil {
		return ip, ErrNetworkLayerHeader
	}
	ip.Src = ipHdr.Src()
	ip.Dst = ipHdr.Dst()
	return ip, nil
}
func NewIPTuple ( p * pkt . Packet ) ( * IPTuple , error ) { ip := & IPTuple { } if p == nil { return ip , nil } ipHdr , ok := p . Headers [ pkt . NetworkLayer ] . ( pkt . InetProtoHdr ) if ! ok || ipHdr == nil { return ip , ErrNetworkLayerHeader } ip . Src = ipHdr . Src ( ) ip . Dst = ipHdr . Dst ( ) return ip , nil }
NewIPTuple constructs an IPTuple from the information in the pkt.Packet
headers.
NewIPTuple constructs an IPTuple from the information in the pkt . Packet headers .