github.com/aporeto-inc/trireme-lib@v10.358.0+incompatible/controller/pkg/packettracing/packettracing.go (about)

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