Documentation ¶
Overview ¶
Package pathpol implements path policies, documentation in doc/PathPolicy.md Currently implemented: ACL, Sequence, Extends and Options.
A policy has Filter() method that takes a slice of paths and returns a filtered slice of paths.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoDefault indicates that there is no default acl entry. ErrNoDefault = errors.New("ACL does not have a default") )
Functions ¶
This section is empty.
Types ¶
type ACL ¶
type ACL struct {
Entries []*ACLEntry
}
func (*ACL) MarshalJSON ¶
func (*ACL) UnmarshalJSON ¶
type ACLEntry ¶
type ACLEntry struct { Action ACLAction Rule *HopPredicate }
func (*ACLEntry) LoadFromString ¶
func (*ACLEntry) MarshalJSON ¶
func (*ACLEntry) UnmarshalJSON ¶
type FilterOptions ¶
type FilterOptions struct { // IgnoreSequence can be used to ignore the sequence part of policies. IgnoreSequence bool }
FilterOptions contains options for filtering.
type HopPredicate ¶
A HopPredicate specifies a hop in the ACL or Sequence of the path policy, see docs/PathPolicy.md.
func HopPredicateFromString ¶
func HopPredicateFromString(str string) (*HopPredicate, error)
func NewHopPredicate ¶
func NewHopPredicate() *HopPredicate
func (*HopPredicate) MarshalJSON ¶
func (hp *HopPredicate) MarshalJSON() ([]byte, error)
func (HopPredicate) String ¶
func (hp HopPredicate) String() string
func (*HopPredicate) UnmarshalJSON ¶
func (hp *HopPredicate) UnmarshalJSON(b []byte) error
type Policy ¶
type Policy struct { Name string `json:"-"` ACL *ACL `json:"acl,omitempty"` Sequence *Sequence `json:"sequence,omitempty"` Options []Option `json:"options,omitempty"` }
Policy is a compiled path policy object, all extended policies have been merged.
func PolicyFromExtPolicy ¶
PolicyFromExtPolicy creates a Policy from an extending Policy and the extended policies
type PolicyMap ¶
PolicyMap is a container for Policies, keyed by their unique name. PolicyMap can be used to marshal Policies to JSON. Unmarshaling back to PolicyMap is guaranteed to yield an object that is identical to the initial one.
type Sequence ¶
type Sequence struct {
// contains filtered or unexported fields
}
func NewSequence ¶
NewSequence creates a new sequence from a string
func (*Sequence) Eval ¶
Eval evaluates the interface sequence list and returns the set of paths that match the list