Documentation
¶
Overview ¶
Package pathhealth monitors paths to different ASes. Call Monitor.Register() to start monitoring paths to a remote AS using a chosen path policy. The call returns a registration object which can be used to obtain the best path.
Index ¶
- type DefaultPathWatcherFactory
- type DefaultRemoteWatcherFactory
- type FilteringPathSelector
- type FingerprintSet
- type MemoryRevocationStore
- type Monitor
- type PathInfo
- type PathInfoEntry
- type PathPolicy
- type PathSelector
- type PathWatcher
- type PathWatcherFactory
- type Registration
- type RemoteWatcher
- type RemoteWatcherFactory
- type RevocationStore
- type Selectable
- type Selection
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultPathWatcherFactory ¶
type DefaultPathWatcherFactory struct { // LocalIA is the ID of the local AS. LocalIA addr.IA // Topology is the helper class to get control-plane information for the // local AS. Topology snet.Topology // LocalIP is the IP address of the local host. LocalIP netip.Addr // RevocationHandler is the revocation handler. RevocationHandler snet.RevocationHandler // Probeinterval defines the interval at which probes are sent. If it is not // set a default is used. ProbeInterval time.Duration // ProbesSent keeps track of how many path probes have been sent per remote // AS. ProbesSent func(remote addr.IA) metrics.Counter // ProbesReceived keeps track of how many path probes have been received per // remote AS. ProbesReceived func(remote addr.IA) metrics.Counter // ProbesSendErrors keeps track of how many time sending probes failed per // remote. ProbesSendErrors func(remote addr.IA) metrics.Counter SCMPErrors metrics2.Counter SCIONPacketConnMetrics snet.SCIONPacketConnMetrics }
DefaultPathWatcherFactory creates PathWatchers.
type DefaultRemoteWatcherFactory ¶
type DefaultRemoteWatcherFactory struct { // Router is used to find paths to remote ASes. Router interface { AllRoutes(ctx context.Context, dst addr.IA) ([]snet.Path, error) } // PathWatcherFactory is used to construct PathWatchers. PathWatcherFactory PathWatcherFactory // PathUpdateInterval specified how often the paths are retrieved from the // daemon. If not specified a default is used. PathUpdateInterval time.Duration // PathFetchTimeout is the timeout for the path fetch operation. If not set // a default value is used. PathFetchTimeout time.Duration // PathsMonitored is a gauge counting the number of paths currently // monitored to a remote AS. PathsMonitored func(remote addr.IA) metrics.Gauge }
DefaultRemoteWatcherFactory is a default factory for creating RemoteWatchers.
func (*DefaultRemoteWatcherFactory) New ¶
func (f *DefaultRemoteWatcherFactory) New(remote addr.IA) RemoteWatcher
New creates an RemoteWatcher that keeps track of all the paths for a given remote, and spawns/kills PathWatchers appropriately.
type FilteringPathSelector ¶
type FilteringPathSelector struct { // PathPolicy is used to determine which paths are eligible and which are not. PathPolicy PathPolicy // RevocationStore keeps track of the revocations. RevocationStore // PathCount is the max number of paths to return to the user. Defaults to 1. PathCount int }
FilteringPathSelector selects the best paths from a filtered set of paths.
func (*FilteringPathSelector) Select ¶
func (f *FilteringPathSelector) Select(selectables []Selectable, current FingerprintSet) Selection
Select selects the best paths.
type FingerprintSet ¶
type FingerprintSet map[snet.PathFingerprint]struct{}
FingerprintSet is a set of path fingerprints.
type MemoryRevocationStore ¶
type MemoryRevocationStore struct {
// contains filtered or unexported fields
}
MemoryRevocationStore holds a list of current revocations. It can be used to determine whether a path goes through interfaces which are revoked.
func (*MemoryRevocationStore) AddRevocation ¶
func (s *MemoryRevocationStore) AddRevocation(ctx context.Context, rev *path_mgmt.RevInfo)
AddRevocation adds the revocation to the list of currently active revocations.
func (*MemoryRevocationStore) Cleanup ¶
func (s *MemoryRevocationStore) Cleanup(ctx context.Context)
Cleanup removes all expired revocations.
type Monitor ¶
type Monitor struct { // RemoteWatcherFactory creates a RemoteWatcher for the specified remote. RemoteWatcherFactory RemoteWatcherFactory // contains filtered or unexported fields }
func (*Monitor) Register ¶
func (m *Monitor) Register(remote addr.IA, selector PathSelector) *Registration
Register starts monitoring given AS under the specified selector.
type PathInfo ¶
type PathInfo []PathInfoEntry
PathInfo contains debug info about onging path monitoring.
type PathInfoEntry ¶
type PathPolicy ¶
PathPolicy filters the set of paths.
type PathSelector ¶
type PathSelector interface {
Select(selectable []Selectable, current FingerprintSet) Selection
}
PathSelector selects the best paths from all the available path watchers.
type PathWatcher ¶
type PathWatcher interface { // Run runs the path watcher until the context is cancelled. Run(context.Context) // UpdatePath changes a path to be monitored. While actual path, as in // "sequence of SCION interfaces", must never change for a single // PathWatcher object, some elements of the path structure (e.g. expiration) // do change and should be updated accordingly. UpdatePath(path snet.Path) // Path returns a fresh copy of the monitored path. Path() snet.Path // State returns the state of the monitored path. State() State }
PathWatcher monitors a specific path.
type PathWatcherFactory ¶
type PathWatcherFactory interface {
New(ctx context.Context, remote addr.IA, path snet.Path) (PathWatcher, error)
}
PathWatcherFactory constructs a PathWatcher.
type Registration ¶
type Registration struct {
// contains filtered or unexported fields
}
Registration represents a single remote IA monitoring registration
func (*Registration) Get ¶
func (r *Registration) Get() Selection
Get returns your own copy of the best available path.
type RemoteWatcher ¶
type RemoteWatcher interface { Run(context.Context) PathWatchers() []PathWatcher }
type RemoteWatcherFactory ¶
type RemoteWatcherFactory interface {
New(remote addr.IA) RemoteWatcher
}
RemoteWatcherFactory creates RemoteWatchers.
type RevocationStore ¶
type RevocationStore interface { // AddRevocation adds a revocation. AddRevocation(ctx context.Context, rev *path_mgmt.RevInfo) // IsRevoked returns true if there is at least one revoked interface on the path. IsRevoked(path snet.Path) bool // Cleanup removes all expired revocations. Cleanup(ctx context.Context) }
RevocationStore keeps track of revocations.
type Selectable ¶
Selectable is a subset of the PathWatcher that is used for path selection.
type Selection ¶
type Selection struct { // Path is the list of selected paths. The list is sorted from best to worst // according to the scoring function used by the selector. Paths []snet.Path // PathInfo provides more info about why the path was selected. PathInfo PathInfo // PathsAlive is the number of active paths available. PathsAlive int // PathsDead is the number of dead paths. PathsDead int // PathsRejected is the number of paths that are rejected by the policy. PathsRejected int }
Selection contains the set of selected paths with metadata.