-
Notifications
You must be signed in to change notification settings - Fork 51
/
interfaces.go
47 lines (41 loc) · 2.05 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
package remoteenforcer
import (
"go.aporeto.io/enforcerd/trireme-lib/controller/internal/enforcer/utils/rpcwrapper"
)
const (
// InitEnforcer is string for invoking RPC
InitEnforcer = "RemoteEnforcer.InitEnforcer"
//Unenforce is string for invoking RPC
Unenforce = "RemoteEnforcer.Unenforce"
//Enforce is string for invoking RPC
Enforce = "RemoteEnforcer.Enforce"
// EnforcerExit is string for invoking RPC
EnforcerExit = "RemoteEnforcer.EnforcerExit"
// UpdateSecrets is string for invoking updatesecrets RPC
UpdateSecrets = "RemoteEnforcer.UpdateSecrets"
// SetTargetNetworks is string for invoking SetTargetNetworks RPC
SetTargetNetworks = "RemoteEnforcer.SetTargetNetworks"
// EnableIPTablesPacketTracing enable iptables trace mode
EnableIPTablesPacketTracing = "RemoteEnforcer.EnableIPTablesPacketTracing"
// EnableDatapathPacketTracing enable datapath packet tracing
EnableDatapathPacketTracing = "RemoteEnforcer.EnableDatapathPacketTracing"
// SetLogLevel is string for invoking set log level RPC
SetLogLevel = "RemoteEnforcer.SetLogLevel"
// Ping is the string for invoking ping RPC
Ping = "RemoteEnforcer.Ping"
// DebugCollect is the string for invoking DebugCollect RPC
DebugCollect = "RemoteEnforcer.DebugCollect"
)
// RemoteIntf is the interface implemented by the remote enforcer
type RemoteIntf interface {
// InitEnforcer is a function called from the controller using RPC.
// It intializes data structure required by the remote enforcer
InitEnforcer(req rpcwrapper.Request, resp *rpcwrapper.Response) error
//Unenforce this method calls the unenforce method on the enforcer created from initenforcer
Unenforce(req rpcwrapper.Request, resp *rpcwrapper.Response) error
//Enforce this method calls the enforce method on the enforcer created during initenforcer
Enforce(req rpcwrapper.Request, resp *rpcwrapper.Response) error
// EnforcerExit this method is called when we received a killrpocess message from the controller
// This allows a graceful exit of the enforcer
EnforcerExit(req rpcwrapper.Request, resp *rpcwrapper.Response) error
}