-
Notifications
You must be signed in to change notification settings - Fork 14
/
rule_action.go
76 lines (65 loc) · 1.63 KB
/
rule_action.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package pf
import (
"fmt"
)
// #include <net/if.h>
// #include <net/pfvar.h>
import "C"
// Action that should be performed by pf
type Action uint8
const (
// ActionPass Filter rule action to pass the traffic
ActionPass Action = C.PF_PASS
// ActionDrop Filter rule action to drop the traffic
ActionDrop Action = C.PF_DROP
// ActionScrub Scrub rule action to do scrubbing
ActionScrub Action = C.PF_SCRUB
// ActionNoScrub Srub rule action to not do scrubbing
ActionNoScrub Action = C.PF_NOSCRUB
// ActionNAT NAT rule action to to NAT
ActionNAT Action = C.PF_NAT
// ActionNoNAT NAT rule action to not do NAT
ActionNoNAT Action = C.PF_NONAT
// ActionBINAT NAT rule action to to BINAT
ActionBINAT Action = C.PF_BINAT
// ActionNoBINAT NAT rule action to not do BINAT
ActionNoBINAT Action = C.PF_NOBINAT
// ActionRDR RDR rule action to to RDR
ActionRDR Action = C.PF_RDR
// ActionNoRDR RDR rule action to not do RDR
ActionNoRDR Action = C.PF_NORDR
// ActionSynProxyDrop TODO
ActionSynProxyDrop Action = C.PF_SYNPROXY_DROP
// ActionDefer TODO is this divert?
ActionDefer Action = C.PF_DEFER
)
func (a Action) String() string {
switch a {
case ActionPass:
return "pass"
case ActionDrop:
return "drop"
case ActionScrub:
return "scrub"
case ActionNoScrub:
return "no scrub"
case ActionNAT:
return "nat"
case ActionNoNAT:
return "no nat"
case ActionBINAT:
return "binat"
case ActionNoBINAT:
return "no binat"
case ActionRDR:
return "rdr"
case ActionNoRDR:
return "no rdr"
case ActionSynProxyDrop:
return "synproxy drop"
case ActionDefer:
return "defer"
default:
return fmt.Sprintf("Action(%d)", a)
}
}