-
Notifications
You must be signed in to change notification settings - Fork 51
/
interfaces.go
35 lines (29 loc) · 982 Bytes
/
interfaces.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
33
34
35
package nfqdatapath
import (
"net"
"github.com/ghedo/go.pkt/packet"
)
// ContextProcessor is an interface to provide context checks
type ContextProcessor interface {
DoesContextExist(contextID string) bool
IsContextServer(contextID string, backendip string) bool
}
// RuleProcessor is an interface to access rules
type RuleProcessor interface {
CheckRejectRecvRules(contextID string) (int, bool)
CheckAcceptRecvRules(contextID string) (int, bool)
CheckRejectTxRules(contextID string) (int, bool)
CheckAcceptTxRules(contextID string) (int, bool)
}
// Accessor is an interface for datapth to access contexts/rules/tokens
type Accessor interface {
ContextProcessor
RuleProcessor
}
// PingConn is an interface to send ping packets/data to network.
// Also implements io.Writer interface.
type PingConn interface {
ConstructWirePacket(srcIP, dstIP net.IP, transport packet.Packet, payload packet.Packet) ([]byte, error)
Write(data []byte) (int, error)
Close() error
}