func (id *LinuxSockID) Cookie() uint64 {
	return binary.LittleEndian.Uint64(id.IDiagCookie[:])
}
Cookie returns the LinuxSockID's 64 bit unsigned cookie.
package inetdiag
import (
	"encoding/binary"
	"errors"
	"fmt"
	"log"
	"net"
	"runtime"
	"unsafe"
	"github.com/m-lab/go/anonymize"
)
const (
	SOCK_DIAG_BY_FAMILY = 20  
)
var (
	ErrBadPid = errors.New("bad PID, can't listen to NL socket")
	ErrBadSequence = errors.New("bad sequence number, can't interpret NetLink response")
	ErrBadMsgData = errors.New("bad message data from netlink message")
)
type ReqV2 struct {
	SDiagFamily   uint8
	SDiagProtocol uint8
	IDiagExt      uint8
	Pad           uint8
	IDiagStates   uint32
	ID            LinuxSockID
}
const SizeofReqV2 = int(unsafe.Sizeof(ReqV2{}))  
func (req *ReqV2) Serialize() []byte {
	return (*(*[SizeofReqV2]byte)(unsafe.Pointer(req)))[:]
}
func (req *ReqV2) Len() int {
	return SizeofReqV2
}
func NewReqV2(family, protocol uint8, states uint32) *ReqV2 {
	return &ReqV2{
		SDiagFamily:   family,
		SDiagProtocol: protocol,
		IDiagStates:   states,
	}
}
type cookieType [8]byte
func (c *cookieType) MarshalCSV() (string, error) {
	value := binary.LittleEndian.Uint64(c[:])
	return fmt.Sprintf("%X", value), nil
}
type ipType [16]byte
func (ipAddr *ipType) MarshalCSV() (string, error) {
	netIP := ip(*ipAddr)
	return netIP.String(), nil
}
type Port [2]byte
func (p *Port) MarshalCSV() (string, error) {
	value := binary.BigEndian.Uint16(p[:])
	return fmt.Sprintf("%d", value), nil
}
type netIF [4]byte
func (nif *netIF) MarshalCSV() (string, error) {
	value := binary.BigEndian.Uint32(nif[:])
	return fmt.Sprintf("%d", value), nil
}
type LinuxSockID struct {
	IDiagSPort  Port       `csv:"IDM.SockID.SPort" bigquery:"-"`
	IDiagDPort  Port       `csv:"IDM.SockID.DPort" bigquery:"-"`
	IDiagSrc    ipType     `csv:"IDM.SockID.Src" bigquery:"-"`
	IDiagDst    ipType     `csv:"IDM.SockID.Dst" bigquery:"-"`
	IDiagIf     netIF      `csv:"IDM.SockID.Interface" bigquery:"-"`
	IDiagCookie cookieType `csv:"IDM.SockID.Cookie" bigquery:"-"`
}
type SockID struct {
	SPort     uint16
	DPort     uint16
	SrcIP     string
	DstIP     string
	Interface uint32
	Cookie    int64  
}
func (sid *SockID) CookieUint64() uint64 {
	return *(*uint64)(unsafe.Pointer(&sid.Cookie))
}
func (id *LinuxSockID) GetSockID() SockID {
	sid := SockID{
		SrcIP:     id.SrcIP().String(),
		SPort:     id.SPort(),
		DstIP:     id.DstIP().String(),
		DPort:     id.DPort(),
		Interface: id.Interface(),
		Cookie:    int64(id.Cookie()),
	}
	return sid
}
func (id *LinuxSockID) Interface() uint32 {
	return binary.BigEndian.Uint32(id.IDiagIf[:])
}
func (id *LinuxSockID) SrcIP() net.IP {
	return ip(id.IDiagSrc)
}
func (id *LinuxSockID) DstIP() net.IP {
	return ip(id.IDiagDst)
}
func (id *LinuxSockID) SPort() uint16 {
	return binary.BigEndian.Uint16(id.IDiagSPort[:])
}
func (id *LinuxSockID) DPort() uint16 {
	return binary.BigEndian.Uint16(id.IDiagDPort[:])
}