forked from v2fly/geoip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.go
61 lines (46 loc) · 864 Bytes
/
lib.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
package lib
const (
ActionAdd Action = "add"
ActionRemove Action = "remove"
ActionOutput Action = "output"
IPv4 IPType = "ipv4"
IPv6 IPType = "ipv6"
CaseRemovePrefix CaseRemove = 0
CaseRemoveEntry CaseRemove = 1
)
var ActionsRegistry = map[Action]bool{
ActionAdd: true,
ActionRemove: true,
ActionOutput: true,
}
type Action string
type IPType string
type CaseRemove int
type Typer interface {
GetType() string
}
type Actioner interface {
GetAction() Action
}
type Descriptioner interface {
GetDescription() string
}
type InputConverter interface {
Typer
Actioner
Descriptioner
Input(Container) (Container, error)
}
type OutputConverter interface {
Typer
Actioner
Descriptioner
Output(Container) error
}
type IgnoreIPOption func() IPType
func IgnoreIPv4() IPType {
return IPv4
}
func IgnoreIPv6() IPType {
return IPv6
}