Documentation
¶
Overview ¶
Package netflow collects eBPF-network netflow metrics
Index ¶
- Constants
- Variables
- func AddK8sTags2Map(k8sNetInfo *k8sinfo.K8sNetInfo, basekey *BaseKey, mTags map[string]string) map[string]string
- func ConnAddrIsIPv4(meta uint32) bool
- func ConnCmpNoPid(expected, actual ConnectionInfo) bool
- func ConnCmpNoSPort(expected, actual ConnectionInfo) bool
- func ConnDirection2Str(direction uint8) string
- func ConnIPv4Type(addr uint32) string
- func ConnIPv6Type(addr [4]uint32) string
- func ConnNotNeedToFilter(conn *ConnectionInfo, connStats *ConnFullStats) bool
- func ConnProtocolIsTCP(meta uint32) bool
- func ConvConn2M(k ConnectionInfo, v ConnFullStats, name string, gTags map[string]string, ...) (*client.Point, error)
- func IPPortFilterIn(conn *ConnectionInfo) bool
- func IsEphemeralPort(port uint32) bool
- func IsIncomingFromK8s(k8sNetInfo *k8sinfo.K8sNetInfo, srcIP string, srcPort uint32, transport string) bool
- func NewNetFlowManger(constEditor []manager.ConstantEditor, ctMap map[string]*ebpf.Map, ...) (*manager.Manager, error)
- func SetDNSRecord(r dnsRecorder)
- func SetEphemeralPortMin(val int32)
- func SetK8sNetInfo(n *k8sinfo.K8sNetInfo)
- func SetLogger(nl *logger.Logger)
- func SwapU16(v uint16) uint16
- func U32BEToIP(addr [4]uint32, isIPv6 bool) net.IP
- func U32BEToIPv4Array(addr uint32) [4]uint8
- func U32BEToIPv6Array(addr [4]uint32) [8]uint16
- type BaseKey
- type ConnFullStats
- type ConnResult
- type ConnStatsRecord
- type ConncetionClosedInfo
- type ConncetionClosedInfoC
- type ConnectionInfo
- type ConnectionInfoC
- type ConnectionStats
- type ConnectionStatsC
- type ConnectionTCPStats
- type ConnectionTCPStatsC
- type FlowAgg
- type IPPortRecord
- type NetFlowTracer
Constants ¶
View Source
const ( ConnL3Mask uint32 = 0xFF ConnL3IPv4 uint32 = 0x00 // 0x00 ConnL3IPv6 uint32 = 0x01 // 0x01 ConnL4Mask uint32 = 0xFF00 ConnL4TCP uint32 = 0x0000 // 0x00 << 8 ConnL4UDP uint32 = 0x0100 // 0x01 << 8 )
View Source
const ( ConnDirectionAuto = iota ConnDirectionIncoming ConnDirectionOutgoing ConnDirectionUnknown )
View Source
const ( TCP_ESTABLISHED = iota + 1 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 TCP_NEW_SYN_RECV TCP_MAX_STATES )
View Source
const ( NoValue = "N/A" DirectionOutgoing = "outgoing" DirectionIncoming = "incoming" )
View Source
const ( EphemeralPortMin = 32768 EphemeralPortMax = 60999 )
View Source
const KernelTaskCommLen = 16
Variables ¶
View Source
var SrcIPPortRecorder = func() *srcIPPortRecorder { ptr := &srcIPPortRecorder{ Record: map[[4]uint32]IPPortRecord{}, } go ptr.AutoClean() return ptr }()
Functions ¶
func AddK8sTags2Map ¶
func ConnAddrIsIPv4 ¶
func ConnCmpNoPid ¶
func ConnCmpNoPid(expected, actual ConnectionInfo) bool
func ConnCmpNoSPort ¶
func ConnCmpNoSPort(expected, actual ConnectionInfo) bool
func ConnDirection2Str ¶
func ConnIPv4Type ¶
func ConnIPv6Type ¶
func ConnNotNeedToFilter ¶
func ConnNotNeedToFilter(conn *ConnectionInfo, connStats *ConnFullStats) bool
ConnNotNeedToFilter rules: 1. Filter connections with the same source IP and destination IP; 2. Filter the connection of loopback ip; 3. Filter connections without data sending and receiving within a collection cycle; 4. Filter connections with port 0 or ip address :: or 0.0.0.0; Need to filter, the function returns False.
func ConnProtocolIsTCP ¶
func ConvConn2M ¶
func IPPortFilterIn ¶
func IPPortFilterIn(conn *ConnectionInfo) bool
func IsEphemeralPort ¶
func IsIncomingFromK8s ¶
func NewNetFlowManger ¶
func SetDNSRecord ¶
func SetDNSRecord(r dnsRecorder)
func SetEphemeralPortMin ¶
func SetEphemeralPortMin(val int32)
func SetK8sNetInfo ¶
func SetK8sNetInfo(n *k8sinfo.K8sNetInfo)
func U32BEToIPv4Array ¶
func U32BEToIPv6Array ¶
Types ¶
type ConnFullStats ¶
type ConnFullStats struct { Stats ConnectionStats TCPStats ConnectionTCPStats TotalClosed int64 TotalEstablished int64 }
func StatsOp ¶
func StatsOp(op string, fullConn ConnFullStats, connStats ConnectionStats) ConnFullStats
StatsOp fullConn = connStats op("+", "-", ...) fullConn.
func StatsTCPOp ¶
func StatsTCPOp(op string, fullConn ConnFullStats, connStats ConnectionStats, tcpstats ConnectionTCPStats) ConnFullStats
StatsTCPOp op: operator; fullConn: a saved connection statistics; connStat: new connection statistics; tcpstats: TCP statistics.
type ConnResult ¶
type ConnResult struct {
// contains filtered or unexported fields
}
type ConnStatsRecord ¶
type ConncetionClosedInfo ¶
type ConncetionClosedInfo struct { Info ConnectionInfo Stats ConnectionStats TCPStats ConnectionTCPStats }
type ConncetionClosedInfoC ¶
type ConncetionClosedInfoC C.struct_connection_closed_info
type ConnectionInfo ¶
type ConnectionInfo struct { Saddr [4]uint32 Daddr [4]uint32 Sport uint32 Dport uint32 Pid uint32 Netns uint32 Meta uint32 NATDaddr [4]uint32 NATDport uint32 ProcessName string }
func (ConnectionInfo) String ¶
func (conn ConnectionInfo) String() string
type ConnectionInfoC ¶
type ConnectionInfoC C.struct_connection_info
type ConnectionStats ¶
type ConnectionStatsC ¶
type ConnectionStatsC C.struct_connection_stats
type ConnectionTCPStats ¶
type ConnectionTCPStatsC ¶
type ConnectionTCPStatsC C.struct_connection_tcp_stats
type FlowAgg ¶
type FlowAgg struct {
// contains filtered or unexported fields
}
func (*FlowAgg) Append ¶
func (agg *FlowAgg) Append(info ConnectionInfo, stats ConnFullStats) error
type IPPortRecord ¶
type NetFlowTracer ¶
type NetFlowTracer struct {
// contains filtered or unexported fields
}
func NewNetFlowTracer ¶
func NewNetFlowTracer(procFilter *tracing.ProcessFilter) *NetFlowTracer
func (*NetFlowTracer) ClosedEventHandler ¶
Click to show internal directories.
Click to hide internal directories.