mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 01:31:17 +00:00
Move conntrack code out to client.go to match upstream
This commit is contained in:
@@ -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{}
|
||||
Reference in New Issue
Block a user