-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
118 lines (104 loc) · 1.95 KB
/
types.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package gocapng
// Act enum to update the stored capabilities settings
type Act int
// Type is the type of operations to perform
type Type int
// Select capabilities
type Select int
// Result flag if a capabilities exists
type Result int
// Print flag for type of output to make
type Print int
// Flags bitmap flags for tailored needs
type Flags int
// Capability is type to use for capabilities both POSIX and Linux as a single
// variable that hold them under
type Capability uint
// UserCapData holds libcap user data
type UserCapData struct {
Effective uint32
Permitted uint32
Inheritable uint32
}
func (a Act) String() string {
switch a {
case ActDrop:
return "drop"
case ActAdd:
return "add"
default:
return ""
}
}
func (t Type) String() string {
switch t {
case TypeEffective:
return "effective"
case TypePermitted:
return "permitted"
case TypeInheritable:
return "inheritable"
case TypeBoundingSet:
return "bounding_set"
case TypeAmbient:
return "ambient"
default:
return ""
}
}
func (s Select) String() string {
switch s {
case SelectCaps:
return "select_caps"
case SelectBounds:
return "select_bounds"
case SelectBoth:
return "select_both"
case SelectAmbient:
return "select_ambient"
case SelectAll:
return "select_all"
default:
return ""
}
}
func (r Result) String() string {
switch r {
case ResultFail:
return "fail"
case ResultNone:
return "none"
case ResultPartial:
return "partial"
case ResultFull:
return "full"
default:
return ""
}
}
func (p Print) String() string {
switch p {
case PrintStdOut:
return "stdout"
case PrintBuffer:
return "buffer"
default:
return ""
}
}
func (f Flags) String() string {
switch f {
case FlagsNoFlag:
return "no_flag"
case FlagsDropSuppGrp:
return "drop_supp_grp"
case FlagsClearBounding:
return "clear_bounding"
case FlagsInitSuppGrp:
return "init_supp_grp"
case FlagsClearAmbient:
return "clear_ambient"
default:
return ""
}
}