diff --git a/probe/endpoint/conntrack/conntrack.go b/probe/endpoint/conntrack/client.go similarity index 100% rename from probe/endpoint/conntrack/conntrack.go rename to probe/endpoint/conntrack/client.go index 6731d024e..9f9d8c295 100644 --- a/probe/endpoint/conntrack/conntrack.go +++ b/probe/endpoint/conntrack/client.go @@ -8,36 +8,6 @@ import ( "unsafe" ) -type Layer3 struct { - SrcIP net.IP - DstIP net.IP -} - -type Layer4 struct { - SrcPort uint16 - DstPort uint16 - Proto uint8 -} - -type Meta struct { - Layer3 - Layer4 -} - -type Flow struct { - MsgType NfConntrackMsg - Original Meta - Reply Meta - State TCPState - ID uint32 -} - -type nfgenmsg struct { - Family uint8 /* AF_xxx */ - Version uint8 /* nfnetlink version */ - ResID uint16 /* resource id */ -} - const ( sizeofGenmsg = uint32(unsafe.Sizeof(nfgenmsg{})) ) @@ -192,6 +162,36 @@ func readMsgs(s int, cb func(Flow)) error { } } +type Flow struct { + MsgType NfConntrackMsg + Original Meta + Reply Meta + State TCPState + ID uint32 +} + +type Layer3 struct { + SrcIP net.IP + DstIP net.IP +} + +type Layer4 struct { + SrcPort uint16 + DstPort uint16 + Proto uint8 +} + +type Meta struct { + Layer3 + Layer4 +} + +type nfgenmsg struct { + Family uint8 /* AF_xxx */ + Version uint8 /* nfnetlink version */ + ResID uint16 /* resource id */ +} + func parsePayload(b []byte) (*Flow, error) { // Adapted from libnetfilter_conntrack/src/conntrack/parse_mnl.c flow := &Flow{}