Documentation ¶
Index ¶
- Constants
- func Follow(flags uint32) (<-chan Conn, func(), error)
- func FollowSize(bufferSize int, flags uint32) (<-chan Conn, func(), error)
- func StreamAllConnections() chan Conn
- type Attr
- type CntlMsgTypes
- type Conn
- type ConnTCP
- type ConnTrack
- type ConntrackListReq
- type CtStatus
- type CtattrCounters
- type CtattrIp
- type CtattrL4proto
- type CtattrProtoinfo
- type CtattrProtoinfoTcp
- type CtattrTuple
- type CtattrType
- type NfConntrackAttrGrp
- type NfConntrackMsg
- type NfConntrackQuery
- type Tuple
Constants ¶
View Source
const ( // #defined in libnfnetlink/include/libnfnetlink/linux_nfnetlink.h NFNL_SUBSYS_CTNETLINK = 1 NFNETLINK_V0 = 0 // #defined in libnfnetlink/include/libnfnetlink/linux_nfnetlink_compat.h NF_NETLINK_CONNTRACK_NEW = 0x00000001 NF_NETLINK_CONNTRACK_UPDATE = 0x00000002 NF_NETLINK_CONNTRACK_DESTROY = 0x00000004 NF_NETLINK_CONNTRACK_EXP_NEW = 0x00000008 NF_NETLINK_CONNTRACK_EXP_UPDATE = 0x00000010 NF_NETLINK_CONNTRACK_EXP_DESTROY = 0x00000020 // #defined in libnfnetlink/include/libnfnetlink/libnfnetlink.h NLA_F_NESTED = uint16(1 << 15) NLA_F_NET_BYTEORDER = uint16(1 << 14) NLA_TYPE_MASK = ^(NLA_F_NESTED | NLA_F_NET_BYTEORDER) )
Variables ¶
This section is empty.
Functions ¶
func FollowSize ¶
Follow gives a channel with all changes, , using specified netlink buffer size.
func StreamAllConnections ¶
func StreamAllConnections() chan Conn
Stream all connections instead of query for all of them at once.
Types ¶
type CntlMsgTypes ¶
type CntlMsgTypes int
const ( IpctnlMsgCtNew CntlMsgTypes = 0 IpctnlMsgCtGet CntlMsgTypes = 1 IpctnlMsgCtDelete CntlMsgTypes = 2 IpctnlMsgCtGetCtrzero CntlMsgTypes = 3 IpctnlMsgCtGetStatsCpu CntlMsgTypes = 4 IpctnlMsgCtGetStats CntlMsgTypes = 5 IpctnlMsgCtGetDying CntlMsgTypes = 6 IpctnlMsgCtGetUnconfirmed CntlMsgTypes = 7 IpctnlMsgMax CntlMsgTypes = 8 )
type Conn ¶
type Conn struct { MsgType NfConntrackMsg TCPState string Status CtStatus Orig Tuple Reply Tuple // ct.mark, used to set permission type of the flow. CtMark uint32 // ct.id, used to identify connections. CtId uint32 // For multitenancy. Zone uint16 // Flow stats. ReplyPktLen uint64 ReplyPktCount uint64 OrigPktLen uint64 OrigPktCount uint64 // Error, if any. Err error Pid uint32 }
func Connections ¶
Lists all the connections that conntrack is tracking.
func ConnectionsSize ¶
Lists all the connections that conntrack is tracking, using specified netlink buffer size.
type ConnTCP ¶
type ConnTCP struct { Local string // net.IP LocalPort string // int Remote string // net.IP RemotePort string // int }
ConnTCP is a connection
func Established ¶
Established lists all established TCP connections.
type ConnTrack ¶
type ConnTrack struct {
// contains filtered or unexported fields
}
ConnTrack monitors the connections. It is build with Established() and Follow().
func (*ConnTrack) Connections ¶
Connections returns the list of all connections seen since last time you called it.
type CtStatus ¶
type CtStatus uint32
Taken from include/uapi/linux/netfilter/nf_conntrack_common.h
const ( IPS_EXPECTED CtStatus = 1 << iota IPS_SEEN_REPLY IPS_ASSURED IPS_CONFIRMED IPS_SRC_NAT IPS_DST_NAT IPS_SEQ_ADJUST IPS_SRC_NAT_DONE IPS_DST_NAT_DONE IPS_DYING IPS_FIXED_TIMEOUT IPS_TEMPLATE IPS_UNTRACKED IPS_HELPER IPS_OFFLOAD IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT) IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE) )
type CtattrCounters ¶
type CtattrCounters int
const ( CtaCountersUnspec CtattrCounters = 0 CtaCountersPackets CtattrCounters = 1 /* 64bit counters */ CtaCountersBytes CtattrCounters = 2 /* 64bit counters */ CtaCounters32Packets CtattrCounters = 3 /* old 32bit counters, unused */ CtaCounters32Bytes CtattrCounters = 4 /* old 32bit counters, unused */ CtaCountersMax CtattrCounters = 5 )
type CtattrL4proto ¶
type CtattrL4proto int
const ( CtaProtoUnspec CtattrL4proto = 0 CtaProtoNum CtattrL4proto = 1 CtaProtoSrcPort CtattrL4proto = 2 CtaProtoDstPort CtattrL4proto = 3 CtaProtoIcmpId CtattrL4proto = 4 CtaProtoIcmpType CtattrL4proto = 5 CtaProtoIcmpCode CtattrL4proto = 6 CtaProtoIcmpv6Id CtattrL4proto = 7 CtaProtoIcmpv6Type CtattrL4proto = 8 CtaProtoIcmpv6Code CtattrL4proto = 9 CtaProtoMax CtattrL4proto = 10 )
type CtattrProtoinfo ¶
type CtattrProtoinfo int
const ( CtaProtoinfoUnspec CtattrProtoinfo = 0 CtaProtoinfoTcp CtattrProtoinfo = 1 CtaProtoinfoDccp CtattrProtoinfo = 2 CtaProtoinfoSctp CtattrProtoinfo = 3 CtaProtoinfoMax CtattrProtoinfo = 4 )
type CtattrProtoinfoTcp ¶
type CtattrProtoinfoTcp int
const ( CtaProtoinfoTcpUnspec CtattrProtoinfoTcp = 0 CtaProtoinfoTcpState CtattrProtoinfoTcp = 1 CtaProtoinfoTcpWscaleOriginal CtattrProtoinfoTcp = 2 CtaProtoinfoTcpWscaleReply CtattrProtoinfoTcp = 3 CtaProtoinfoTcpFlagsOriginal CtattrProtoinfoTcp = 4 CtaProtoinfoTcpFlagsReply CtattrProtoinfoTcp = 5 CtaProtoinfoTcpMax CtattrProtoinfoTcp = 6 )
type CtattrTuple ¶
type CtattrTuple int
const ( CtaTupleUnspec CtattrTuple = 0 CtaTupleIp CtattrTuple = 1 CtaTupleProto CtattrTuple = 2 CtaTupleMax CtattrTuple = 3 )
type CtattrType ¶
type CtattrType int
const ( CtaUnspec CtattrType = 0 CtaTupleOrig CtattrType = 1 CtaTupleReply CtattrType = 2 CtaStatus CtattrType = 3 CtaProtoinfo CtattrType = 4 CtaHelp CtattrType = 5 CtaNatSrc CtattrType = 6 CtaTimeout CtattrType = 7 CtaMark CtattrType = 8 CtaCountersOrig CtattrType = 9 CtaCountersReply CtattrType = 10 CtaUse CtattrType = 11 CtaId CtattrType = 12 CtaNatDst CtattrType = 13 CtaTupleMaster CtattrType = 14 CtaNatSeqAdjOrig CtattrType = 15 CtaNatSeqAdjReply CtattrType = 16 CtaSecmark CtattrType = 17 CtaZone CtattrType = 18 CtaSecctx CtattrType = 19 CtaTimestamp CtattrType = 20 CtaMarkMask CtattrType = 21 CtaLabels CtattrType = 22 CtaLabelsMask CtattrType = 23 CtaMax CtattrType = 24 )
type NfConntrackAttrGrp ¶
type NfConntrackAttrGrp int
const ( AttrGrpOrigIpv4 NfConntrackAttrGrp = 0 AttrGrpReplIpv4 NfConntrackAttrGrp = 1 AttrGrpOrigIpv6 NfConntrackAttrGrp = 2 AttrGrpReplIpv6 NfConntrackAttrGrp = 3 AttrGrpOrigPort NfConntrackAttrGrp = 4 AttrGrpReplPort NfConntrackAttrGrp = 5 AttrGrpIcmp NfConntrackAttrGrp = 6 AttrGrpMasterIpv4 NfConntrackAttrGrp = 7 AttrGrpMasterIpv6 NfConntrackAttrGrp = 8 AttrGrpMasterPort NfConntrackAttrGrp = 9 AttrGrpOrigCounters NfConntrackAttrGrp = 10 AttrGrpReplCounters NfConntrackAttrGrp = 11 AttrGrpOrigAddrSrc NfConntrackAttrGrp = 12 AttrGrpOrigAddrDst NfConntrackAttrGrp = 13 AttrGrpReplAddrSrc NfConntrackAttrGrp = 14 AttrGrpReplAddrDst NfConntrackAttrGrp = 15 AttrGrpMax NfConntrackAttrGrp = 16 )
type NfConntrackMsg ¶
type NfConntrackMsg int
const ( NfctMsgUnknown NfConntrackMsg = 0 NfctMsgNew NfConntrackMsg = 1 << 0 NfctMsgUpdate NfConntrackMsg = 1 << 1 NfctMsgDestroy NfConntrackMsg = 1 << 2 )
type NfConntrackQuery ¶
type NfConntrackQuery int
const ( NfctQCreate NfConntrackQuery = 0 NfctQUpdate NfConntrackQuery = 1 NfctQDestroy NfConntrackQuery = 2 NfctQGet NfConntrackQuery = 3 NfctQFlush NfConntrackQuery = 4 NfctQDump NfConntrackQuery = 5 NfctQDumpReset NfConntrackQuery = 6 NfctQCreateUpdate NfConntrackQuery = 7 NfctQDumpFilter NfConntrackQuery = 8 NfctQDumpFilterReset NfConntrackQuery = 9 )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.