2024-05-28 08:04:07 +00:00
|
|
|
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 {
|
2024-09-06 08:39:23 +00:00
|
|
|
if c == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2024-05-28 08:04:07 +00:00
|
|
|
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 {
|
2024-09-06 08:39:23 +00:00
|
|
|
if c == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2024-05-28 08:04:07 +00:00
|
|
|
return c.Raw
|
|
|
|
}
|