netlink

package
v5.0.0-preview.1+incom... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SizeofCnMsg           = 0x14
	SizeofProcCnMcastOp   = 0x04
	SizeofProcEventHeader = 0x10
	SizeofProcEventData   = 0x18
)
View Source
const (
	CN_IDX_PROC = 0x1
	CN_VAL_PROC = 0x1
)
View Source
const (
	PROC_EVENT_NONE     = 0x00000000
	PROC_EVENT_FORK     = 0x00000001
	PROC_EVENT_EXEC     = 0x00000002
	PROC_EVENT_UID      = 0x00000004
	PROC_EVENT_GID      = 0x00000040
	PROC_EVENT_SID      = 0x00000080
	PROC_EVENT_PTRACE   = 0x00000100
	PROC_EVENT_COMM     = 0x00000200
	PROC_EVENT_COREDUMP = 0x40000000
	PROC_EVENT_EXIT     = 0x80000000
)
View Source
const (
	TCP_ESTABLISHED = iota
	TCP_SYN_SENT
	TCP_SYN_RECV
	TCP_FIN_WAIT1
	TCP_FIN_WAIT2
	TCP_TIME_WAIT
	TCP_CLOSE
	TCP_CLOSE_WAIT
	TCP_LAST_ACK
	TCP_LISTEN
	TCP_CLOSING
)

netinet/tcp.h

View Source
const (
	SOCK_DIAG_BY_FAMILY = 20 // linux/sock_diag.h
)
View Source
const (
	SizeofInetDiagReqV2 = 0x38
)
View Source
const (
	TCP_ALL = 0xFFF
)

Variables

View Source
var DiagFamilyMap = map[uint8]string{
	syscall.AF_INET:  "tcp",
	syscall.AF_INET6: "tcp6",
}
View Source
var TcpStatesMap = map[uint8]string{
	TCP_ESTABLISHED: "established",
	TCP_SYN_SENT:    "syn_sent",
	TCP_SYN_RECV:    "syn_recv",
	TCP_FIN_WAIT1:   "fin_wait1",
	TCP_FIN_WAIT2:   "fin_wait2",
	TCP_TIME_WAIT:   "time_wait",
	TCP_CLOSE:       "close",
	TCP_CLOSE_WAIT:  "close_wait",
	TCP_LAST_ACK:    "last_ack",
	TCP_LISTEN:      "listen",
	TCP_CLOSING:     "closing",
}

Functions

This section is empty.

Types

type CbId

type CbId struct {
	// contains filtered or unexported fields
}

linux/connector.h

type CnMsg

type CnMsg struct {
	// contains filtered or unexported fields
}

func NewCnMsg

func NewCnMsg() *CnMsg

func (*CnMsg) Len

func (cm *CnMsg) Len() int

func (*CnMsg) Serialize

func (cm *CnMsg) Serialize() []byte

type InetDiagMsg

type InetDiagMsg struct {
	IDiagFamily  uint8
	IDiagState   uint8
	IDiagTimer   uint8
	IDiagRetrans uint8
	Id           InetDiagSockId
	IDiagExpires uint32
	IDiagRqueue  uint32
	IDiagWqueue  uint32
	IDiagUid     uint32
	IDiagInode   uint32
}

func ParseInetDiagMsg

func ParseInetDiagMsg(data []byte) *InetDiagMsg

func (*InetDiagMsg) String

func (msg *InetDiagMsg) String() string

type InetDiagReqV2

type InetDiagReqV2 struct {
	SDiagFamily   uint8
	SDiagProtocol uint8
	IDiagExt      uint8
	Pad           uint8
	IDiagStates   uint32
	Id            InetDiagSockId
}

func NewInetDiagReqV2

func NewInetDiagReqV2(family, protocol uint8, states uint32) *InetDiagReqV2

func (*InetDiagReqV2) Len

func (req *InetDiagReqV2) Len() int

func (*InetDiagReqV2) Serialize

func (req *InetDiagReqV2) Serialize() []byte

type InetDiagSockId

type InetDiagSockId struct {
	IDiagSPort  be16
	IDiagDPort  be16
	IDiagSrc    [4]be32
	IDiagDst    [4]be32
	IDiagIf     uint32
	IDiagCookie [2]uint32
}

linux/inet_diag.h

func (*InetDiagSockId) DstIP

func (id *InetDiagSockId) DstIP() net.IP

func (*InetDiagSockId) DstIPv4

func (id *InetDiagSockId) DstIPv4() net.IP

func (*InetDiagSockId) DstIPv6

func (id *InetDiagSockId) DstIPv6() net.IP

func (*InetDiagSockId) SrcIP

func (id *InetDiagSockId) SrcIP() net.IP

func (*InetDiagSockId) SrcIPv4

func (id *InetDiagSockId) SrcIPv4() net.IP

func (*InetDiagSockId) SrcIPv6

func (id *InetDiagSockId) SrcIPv6() net.IP

func (*InetDiagSockId) String

func (id *InetDiagSockId) String() string

type NetlinkProtocol

type NetlinkProtocol int

type NetlinkRequest

type NetlinkRequest struct {
	syscall.NlMsghdr
	Data []NetlinkRequestData
}

linux/netlink.h

func NewNetlinkRequest

func NewNetlinkRequest(nlmsg, flags int) *NetlinkRequest

func (*NetlinkRequest) AddData

func (req *NetlinkRequest) AddData(data NetlinkRequestData)

func (*NetlinkRequest) Serialize

func (req *NetlinkRequest) Serialize() []byte

type NetlinkRequestData

type NetlinkRequestData interface {
	Len() int
	Serialize() []byte
}

type NetlinkSocket

type NetlinkSocket struct {
	// contains filtered or unexported fields
}

func NewNetlinkSocket

func NewNetlinkSocket(protocol NetlinkProtocol, bufSize uint, groups ...uint) (*NetlinkSocket, error)

func (*NetlinkSocket) Close

func (ns *NetlinkSocket) Close()

func (*NetlinkSocket) EPollReceive

func (ns *NetlinkSocket) EPollReceive(tv *syscall.Timeval) ([]syscall.NetlinkMessage, error)

/////

func (*NetlinkSocket) EPollReceiveFrom

func (ns *NetlinkSocket) EPollReceiveFrom(tv *syscall.Timeval) ([]syscall.NetlinkMessage, syscall.Sockaddr, error)

/////

func (*NetlinkSocket) Receive

func (ns *NetlinkSocket) Receive() ([]syscall.NetlinkMessage, error)

func (*NetlinkSocket) ReceiveFrom

func (ns *NetlinkSocket) ReceiveFrom() ([]syscall.NetlinkMessage, syscall.Sockaddr, error)

func (*NetlinkSocket) Send

func (ns *NetlinkSocket) Send(request *NetlinkRequest) error

func (*NetlinkSocket) SetFilter

func (ns *NetlinkSocket) SetFilter(filters []bpf.Instruction) error

func (*NetlinkSocket) SetTimeout

func (ns *NetlinkSocket) SetTimeout(timeout time.Duration) error

func (*NetlinkSocket) Write

func (ns *NetlinkSocket) Write(request *NetlinkRequest) error

type ProcCnMcastOp

type ProcCnMcastOp int
const (
	PROC_CN_MCAST_LISTEN ProcCnMcastOp
	PROC_CN_MCAST_IGNORE
)

func (*ProcCnMcastOp) Len

func (op *ProcCnMcastOp) Len() int

func (*ProcCnMcastOp) Serialize

func (op *ProcCnMcastOp) Serialize() []byte

type ProcEvent

type ProcEvent struct {
	What      ProcEventType
	Cpu       uint32
	Timestamp uint64
	Data      ProcEventData
}

linux/cn_proc.h

func ParseProcEvent

func ParseProcEvent(data []byte) *ProcEvent

type ProcEventAck

type ProcEventAck struct {
	Err uint32
}

type ProcEventComm

type ProcEventComm struct {
	ProcessPid  int32
	ProcessTgid int32
	Comm        [16]byte
}

type ProcEventCoreDump

type ProcEventCoreDump struct {
	ProcessPid  int32
	ProcessTgid int32
}

type ProcEventData

type ProcEventData interface {
}

type ProcEventExec

type ProcEventExec struct {
	ProcessPid  int32
	ProcessTgid int32
}

type ProcEventExit

type ProcEventExit struct {
	ProcessPid  int32
	ProcessTgid int32
	ExitCode    uint32
}

type ProcEventFork

type ProcEventFork struct {
	ParentPid  int32
	ParentTgid int32
	ChildPid   int32
	ChildTgid  int32
}

type ProcEventGid

type ProcEventGid struct {
	ProcessPid  int32
	ProcessTgid int32
	RGid        uint32
	EGid        uint32
}

type ProcEventNone

type ProcEventNone struct{}

type ProcEventPtrace

type ProcEventPtrace struct {
	ProcessPid  int32
	ProcessTgid int32
	TracerPid   int32
	TracerTgid  int32
}

type ProcEventSid

type ProcEventSid struct {
	ProcessPid  int32
	ProcessTgid int32
}

type ProcEventType

type ProcEventType uint32

type ProcEventUid

type ProcEventUid struct {
	ProcessPid  int32
	ProcessTgid int32
	RUid        uint32
	EUid        uint32
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL