-
Notifications
You must be signed in to change notification settings - Fork 51
/
interfaces.go
60 lines (42 loc) · 1.98 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
48
49
50
51
52
53
54
55
56
57
58
59
60
package supervisor
import (
"context"
"time"
provider "go.aporeto.io/enforcerd/trireme-lib/controller/pkg/aclprovider"
"go.aporeto.io/enforcerd/trireme-lib/controller/runtime"
"go.aporeto.io/enforcerd/trireme-lib/policy"
)
// A Supervisor is implementing the node control plane that captures the packets.
type Supervisor interface {
// Supervise adds a new supervised processing unit.
Supervise(contextID string, puInfo *policy.PUInfo) error
// Unsupervise unsupervises the given PU
Unsupervise(contextID string) error
// Start starts the Supervisor.
Run(ctx context.Context) error
// SetTargetNetworks sets the target networks of the supervisor
SetTargetNetworks(cfg *runtime.Configuration) error
// CleanUp requests the supervisor to clean up all ACLs
CleanUp() error
// EnableIPTablesPacketTracing enables ip tables packet tracing
EnableIPTablesPacketTracing(ctx context.Context, contextID string, interval time.Duration) error
}
// Implementor is the interface of the implementation based on iptables, ipsets, remote etc
type Implementor interface {
// ConfigureRules configures the rules in the ACLs and datapath
ConfigureRules(version int, contextID string, containerInfo *policy.PUInfo) error
// UpdateRules updates the rules with a new version
UpdateRules(version int, contextID string, containerInfo *policy.PUInfo, oldContainerInfo *policy.PUInfo) error
// DeleteRules
DeleteRules(version int, context string, tcpPorts, udpPorts string, mark string, uid string, containerInfo *policy.PUInfo) error
// SetTargetNetworks sets the target networks of the supervisor
SetTargetNetworks(cfg *runtime.Configuration) error
// Start initializes any defaults
Run(ctx context.Context) error
// CleanUp requests the implementor to clean up all ACLs
CleanUp() error
// ACLProvider returns the ACL provider used by the implementor
ACLProvider() []provider.IptablesProvider
// CreateCustomRulesChain creates a custom rules chain if it doesnt exist
CreateCustomRulesChain() error
}