72 lines
964 B
Go
72 lines
964 B
Go
|
package ape
|
||
|
|
||
|
type TargetType uint32
|
||
|
|
||
|
const (
|
||
|
TargetTypeUndefined TargetType = iota
|
||
|
TargetTypeNamespace
|
||
|
TargetTypeContainer
|
||
|
TargetTypeUser
|
||
|
TargetTypeGroup
|
||
|
)
|
||
|
|
||
|
type ChainTarget struct {
|
||
|
targeType TargetType
|
||
|
|
||
|
name string
|
||
|
}
|
||
|
|
||
|
func (ct *ChainTarget) SetTargetType(targeType TargetType) {
|
||
|
ct.targeType = targeType
|
||
|
}
|
||
|
|
||
|
func (ct *ChainTarget) SetName(name string) {
|
||
|
ct.name = name
|
||
|
}
|
||
|
|
||
|
func (ct *ChainTarget) GetTargetType() TargetType {
|
||
|
if ct != nil {
|
||
|
return ct.targeType
|
||
|
}
|
||
|
|
||
|
return 0
|
||
|
}
|
||
|
|
||
|
func (ct *ChainTarget) GetName() string {
|
||
|
if ct != nil {
|
||
|
return ct.name
|
||
|
}
|
||
|
|
||
|
return ""
|
||
|
}
|
||
|
|
||
|
type chainKind interface {
|
||
|
isChainKind()
|
||
|
}
|
||
|
|
||
|
type Chain struct {
|
||
|
kind chainKind
|
||
|
}
|
||
|
|
||
|
func (c *Chain) SetKind(kind chainKind) {
|
||
|
c.kind = kind
|
||
|
}
|
||
|
|
||
|
func (c *Chain) GetKind() chainKind {
|
||
|
return c.kind
|
||
|
}
|
||
|
|
||
|
type ChainRaw struct {
|
||
|
Raw []byte
|
||
|
}
|
||
|
|
||
|
func (*ChainRaw) isChainKind() {}
|
||
|
|
||
|
func (c *ChainRaw) SetRaw(raw []byte) {
|
||
|
c.Raw = raw
|
||
|
}
|
||
|
|
||
|
func (c *ChainRaw) GetRaw() []byte {
|
||
|
return c.Raw
|
||
|
}
|