-
Notifications
You must be signed in to change notification settings - Fork 51
/
packettracing.go
32 lines (26 loc) · 923 Bytes
/
packettracing.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package packettracing
// TracingDirection is used to configure the direction for which we want to trace packets
type TracingDirection int
// TracingDirection enum all possible states
const (
Disabled TracingDirection = 0
NetworkOnly TracingDirection = 1
ApplicationOnly TracingDirection = 2
Invalid TracingDirection = 4
)
// PacketEvent is string for our packet decision
type PacketEvent string
// Enum for all packetevents
const (
PacketDropped PacketEvent = "Dropped"
PacketReceived PacketEvent = "Received"
PacketSent PacketEvent = "Transmitted"
)
// IsNetworkPacketTraced checks if network mode packet tracign is enabled
func IsNetworkPacketTraced(direction TracingDirection) bool {
return (direction&NetworkOnly != 0)
}
// IsApplicationPacketTraced checks if application
func IsApplicationPacketTraced(direction TracingDirection) bool {
return (direction&ApplicationOnly != 0)
}