79 lines
1 KiB
Go
79 lines
1 KiB
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 {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
|
|
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 {
|
|
if c == nil {
|
|
return nil
|
|
}
|
|
|
|
return c.Raw
|
|
}
|