github.com/aporeto-inc/trireme-lib@v10.358.0+incompatible/controller/internal/enforcer/nfqdatapath/interfaces.go (about)

     1  package nfqdatapath
     2  
     3  import (
     4  	"net"
     5  
     6  	"github.com/ghedo/go.pkt/packet"
     7  )
     8  
     9  // ContextProcessor is an interface to provide context checks
    10  type ContextProcessor interface {
    11  	DoesContextExist(contextID string) bool
    12  	IsContextServer(contextID string, backendip string) bool
    13  }
    14  
    15  // RuleProcessor is an interface to access rules
    16  type RuleProcessor interface {
    17  	CheckRejectRecvRules(contextID string) (int, bool)
    18  	CheckAcceptRecvRules(contextID string) (int, bool)
    19  	CheckRejectTxRules(contextID string) (int, bool)
    20  	CheckAcceptTxRules(contextID string) (int, bool)
    21  }
    22  
    23  // Accessor is an interface for datapth to access contexts/rules/tokens
    24  type Accessor interface {
    25  	ContextProcessor
    26  	RuleProcessor
    27  }
    28  
    29  // PingConn is an interface to send ping packets/data to network.
    30  // Also implements io.Writer interface.
    31  type PingConn interface {
    32  	ConstructWirePacket(srcIP, dstIP net.IP, transport packet.Packet, payload packet.Packet) ([]byte, error)
    33  	Write(data []byte) (int, error)
    34  	Close() error
    35  }