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 DefaultPathWatcher
- func (pw *DefaultPathWatcher) Close()
- func (pw *DefaultPathWatcher) HandleProbeReply(seq uint16)
- func (pw *DefaultPathWatcher) Path() snet.Path
- func (pw *DefaultPathWatcher) SendProbe(conn snet.PacketConn, localAddr snet.SCIONAddress)
- func (pw *DefaultPathWatcher) State() State
- func (pw *DefaultPathWatcher) UpdatePath(path snet.Path)
- type DefaultPathWatcherFactory
- type DefaultRemoteWatcher
- func (w *DefaultRemoteWatcher) Cleanup()
- func (w *DefaultRemoteWatcher) HandleProbeReply(id, seq uint16)
- func (w *DefaultRemoteWatcher) SendProbes(conn snet.PacketConn, localAddr snet.SCIONAddress)
- func (w *DefaultRemoteWatcher) UpdatePaths(router snet.Router)
- func (w *DefaultRemoteWatcher) Watchers() []PathWatcher
- type DefaultRemoteWatcherFactory
- type FilteringPathSelector
- type FingerprintSet
- type MemoryRevocationStore
- type Monitor
- 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 DefaultPathWatcher ¶
type DefaultPathWatcher struct {
// contains filtered or unexported fields
}
DefaultPathWatcher monitors a single SCION path.
func (*DefaultPathWatcher) Close ¶
func (pw *DefaultPathWatcher) Close()
Close stops the PathWatcher.
func (*DefaultPathWatcher) HandleProbeReply ¶
func (pw *DefaultPathWatcher) HandleProbeReply(seq uint16)
HandleProbeReply dispatches a single probe reply packet.
func (*DefaultPathWatcher) Path ¶
func (pw *DefaultPathWatcher) Path() snet.Path
Path returns a fresh copy of the monitored path.
func (*DefaultPathWatcher) SendProbe ¶
func (pw *DefaultPathWatcher) SendProbe(conn snet.PacketConn, localAddr snet.SCIONAddress)
SendProbe sends a probe along the monitored path.
func (*DefaultPathWatcher) State ¶
func (pw *DefaultPathWatcher) State() State
State returns the state of the monitored path.
func (*DefaultPathWatcher) UpdatePath ¶
func (pw *DefaultPathWatcher) UpdatePath(path snet.Path)
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.
type DefaultPathWatcherFactory ¶
type DefaultPathWatcherFactory struct { // Logger is the parent logger. If nil, the PathWatcher is constructed // without any logger. Logger log.Logger }
DefaultPathWatcherFactory creates PathWatchers.
func (*DefaultPathWatcherFactory) New ¶
func (f *DefaultPathWatcherFactory) New(remote addr.IA, path snet.Path, id uint16) PathWatcher
New creates a PathWatcher that monitors a specific path.
type DefaultRemoteWatcher ¶
type DefaultRemoteWatcher struct {
// contains filtered or unexported fields
}
DefaultRemoteWatcher monitors a remote IA.
func (*DefaultRemoteWatcher) Cleanup ¶
func (w *DefaultRemoteWatcher) Cleanup()
Cleanup stops monitoring paths that are not being used any more.
func (*DefaultRemoteWatcher) HandleProbeReply ¶
func (w *DefaultRemoteWatcher) HandleProbeReply(id, seq uint16)
HandleProbeReply dispatches a single probe reply packet.
func (*DefaultRemoteWatcher) SendProbes ¶
func (w *DefaultRemoteWatcher) SendProbes(conn snet.PacketConn, localAddr snet.SCIONAddress)
SendProbes sends probes via all the available paths to the monitored IA.
func (*DefaultRemoteWatcher) UpdatePaths ¶
func (w *DefaultRemoteWatcher) UpdatePaths(router snet.Router)
UpdatePaths gets new paths from the SCION daemon. This function may block for up to routerTimeout.
func (*DefaultRemoteWatcher) Watchers ¶
func (w *DefaultRemoteWatcher) Watchers() []PathWatcher
Watchers returns a list of all active PathWatchers.
type DefaultRemoteWatcherFactory ¶
type DefaultRemoteWatcherFactory struct { // PathWatcherFactory is used to construct PathWatchers. PathWatcherFactory PathWatcherFactory // Logger is the parent logger. If nil, the RemoteWatcher is constructed without // any logger. Logger log.Logger // PathsMonitored is a gauge counting the number of paths currently // monitored to a remote AS. PathsMonitored 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 ¶
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(rev *path_mgmt.RevInfo)
AddRevocation adds the revocation to the list of currently active revocations.
func (*MemoryRevocationStore) Cleanup ¶
func (s *MemoryRevocationStore) Cleanup()
Cleanup removes all expired revocations.
type Monitor ¶
type Monitor struct { // LocalIA is the ID of the local AS. LocalIA addr.IA // LocalIP is the IP address of the local host. LocalIP net.IP // Conn is the underlying conn for sending probes Conn net.PacketConn // RevocationHandler is the revocation handler. RevocationHandler snet.RevocationHandler // Router is the path manager connected to the SCION daemon. Router snet.Router // PathUpdateInterval specified how often the paths are retrieved from the daemon. PathUpdateInterval time.Duration // Probeinterval defines the interval at which probes are sent. If it is not // set a default is used. ProbeInterval time.Duration // RevocationStore keeps track of the revocations. RevocationStore RevocationStore // RemoteWatcherFactory creates a RemoteWatcher for the specified remote. RemoteWatcherFactory RemoteWatcherFactory // Logger is the logger. If nil, nothing is logged. Logger log.Logger // contains filtered or unexported fields }
Monitor monitors paths to a set of remote ASes.
func (*Monitor) Register ¶
func (m *Monitor) Register(remote addr.IA, selector PathSelector) *Registration
Register starts monitoring given AS under the specified selector.
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 { // 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) // SendProbe sends a probe along the monitored path. SendProbe(conn snet.PacketConn, localAddr snet.SCIONAddress) // HandleProbeReply dispatches a single probe reply packet. HandleProbeReply(seq uint16) // Path returns a fresh copy of the monitored path. Path() snet.Path // State returns the state of the monitored path. State() State // Close stops the PathWatcher. Close() }
PathWatcher monitors a specific path.
type PathWatcherFactory ¶
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 { // UpdatePaths gets new paths from the SCION daemon. This method may block. UpdatePaths(snet.Router) // SendProbes sends probes on all the monitored paths. SendProbes(conn snet.PacketConn, localAddr snet.SCIONAddress) // HandleProbeReply handles a single probe reply packet. HandleProbeReply(id, seq uint16) // Cleanup stops monitoring paths that are not being used anymore. Cleanup() // Watchers returns a list of all active PathWatchers Watchers() []PathWatcher }
RemoteWatcher watches multiple paths to a given remote.
type RemoteWatcherFactory ¶
type RemoteWatcherFactory interface {
New(remote addr.IA) RemoteWatcher
}
RemoteWatcherFactory creates RemoteWatchers.
type RevocationStore ¶
type RevocationStore interface { // AddRevocation adds a revocation. AddRevocation(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() }
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 // Info is an info string providing more info about why the path was selected. Info string // 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.