-
Notifications
You must be signed in to change notification settings - Fork 51
/
enforcer.go
59 lines (55 loc) · 1.36 KB
/
enforcer.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
package enforcer
import (
"time"
"github.com/aporeto-inc/trireme-lib/collector"
"github.com/aporeto-inc/trireme-lib/constants"
"github.com/aporeto-inc/trireme-lib/enforcer/datapath"
"github.com/aporeto-inc/trireme-lib/enforcer/packetprocessor"
"github.com/aporeto-inc/trireme-lib/enforcer/policyenforcer"
"github.com/aporeto-inc/trireme-lib/enforcer/utils/fqconfig"
"github.com/aporeto-inc/trireme-lib/enforcer/utils/secrets"
)
// New returns a new policy enforcer
func New(
mutualAuthorization bool,
fqConfig *fqconfig.FilterQueue,
collector collector.EventCollector,
service packetprocessor.PacketProcessor,
secrets secrets.Secrets,
serverID string,
validity time.Duration,
mode constants.ModeType,
procMountPoint string,
externalIPCacheTimeout time.Duration,
) policyenforcer.Enforcer {
return datapath.New(
mutualAuthorization,
fqConfig,
collector,
serverID,
validity,
service,
secrets,
mode,
procMountPoint,
externalIPCacheTimeout,
)
}
// NewWithDefaults create a new data path with most things used by default
func NewWithDefaults(
serverID string,
collector collector.EventCollector,
service packetprocessor.PacketProcessor,
secrets secrets.Secrets,
mode constants.ModeType,
procMountPoint string,
) policyenforcer.Enforcer {
return datapath.NewWithDefaults(
serverID,
collector,
service,
secrets,
mode,
procMountPoint,
)
}