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 ¶
- Variables
- func GetSequence(path snet.Path) (string, error)
- type ACL
- type ACLAction
- type ACLEntry
- func (ae *ACLEntry) LoadFromString(str string) error
- func (ae *ACLEntry) MarshalJSON() ([]byte, error)
- func (ae *ACLEntry) MarshalYAML() (interface{}, error)
- func (ae *ACLEntry) String() string
- func (ae *ACLEntry) UnmarshalJSON(b []byte) error
- func (ae *ACLEntry) UnmarshalYAML(unmarshal func(interface{}) error) error
- type ExtPolicy
- type FilterOptions
- type HopPredicate
- type ISDASRule
- type LocalISDAS
- type Option
- type Policy
- type PolicyMap
- type RemoteISDAS
- type Sequence
- func (s *Sequence) Eval(paths []snet.Path) []snet.Path
- func (s *Sequence) MarshalJSON() ([]byte, error)
- func (s *Sequence) MarshalYAML() (interface{}, error)
- func (s *Sequence) String() string
- func (s *Sequence) UnmarshalJSON(b []byte) error
- func (s *Sequence) UnmarshalYAML(unmarshal func(interface{}) error) error
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") // ErrExtraEntries indicates that there extra entries after the default entry. ErrExtraEntries = errors.New("ACL has unused extra entries after a default entry") )
Functions ¶
Types ¶
type ACL ¶
type ACL struct {
Entries []*ACLEntry
}
func (*ACL) MarshalJSON ¶
func (*ACL) MarshalYAML ¶
func (*ACL) UnmarshalJSON ¶
func (*ACL) UnmarshalYAML ¶
type ACLEntry ¶
type ACLEntry struct { Action ACLAction Rule *HopPredicate }
func (*ACLEntry) LoadFromString ¶
func (*ACLEntry) MarshalJSON ¶
func (*ACLEntry) MarshalYAML ¶
func (*ACLEntry) UnmarshalJSON ¶
func (*ACLEntry) UnmarshalYAML ¶
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 LocalISDAS ¶
LocalISDAS is a path policy that checks whether the first hop in the path (local AS) belongs to the specified set.
func (*LocalISDAS) MarshalJSON ¶
func (li *LocalISDAS) MarshalJSON() ([]byte, error)
func (*LocalISDAS) UnmarshalJSON ¶
func (li *LocalISDAS) UnmarshalJSON(b []byte) error
type Policy ¶
type Policy struct { Name string `json:"-"` ACL *ACL `json:"acl,omitempty"` Sequence *Sequence `json:"sequence,omitempty"` LocalISDAS *LocalISDAS `json:"local_isd_ases,omitempty"` RemoteISDAS *RemoteISDAS `json:"remote_isd_ases,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 RemoteISDAS ¶
type RemoteISDAS struct {
Rules []ISDASRule
}
RemoteISDAS is a path policy that checks whether the last hop in the path (remote AS) satisfies the supplied rules. Rules are evaluated in order and first that matches the remote ISD-AS wins. If in the winnig rule Reject is set to true, then the path will rejected by the policy, otherwise it will be accepted. If no rule matches the path will be rejected.
func (*RemoteISDAS) MarshalJSON ¶
func (ri *RemoteISDAS) MarshalJSON() ([]byte, error)
func (*RemoteISDAS) UnmarshalJSON ¶
func (ri *RemoteISDAS) UnmarshalJSON(b []byte) error
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