Documentation ¶
Overview ¶
Package track provides a simple interface for tracking known proxies by endpoint/name and correctly handling expiration and exclusivity. The provided Tracker type wraps a workpool.Pool, updating per-key counts as new proxies are discovered and/or old proxies are expired.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ProxyExpiry is the duration an entry will be held since the last // successful connection to, or message about, a given proxy. ProxyExpiry time.Duration // TickRate is the rate at which expired entries are cleared from // the cache of known proxies. TickRate time.Duration // ClusterName is the name of the tracked cluster. ClusterName string }
Config configures basic Tracker parameters.
func (*Config) CheckAndSetDefaults ¶
CheckAndSetDefaults set default values for Config.
type Tracker ¶
type Tracker struct { Config // contains filtered or unexported fields }
Tracker is a helper for tracking proxies located behind reverse tunnels and triggering agent spawning as needed. Tracker wraps a workpool.Pool instance and manages a cache of proxies which *may* exist. As proxies are discovered, or old proxies expire, the target counts are automatically updated for the associated address in the workpool. Agents can attempt to "claim" exclusivity for a given proxy, ensuring that multiple agents are not run against the same proxy.
func (*Tracker) Claim ¶
Claim attempts to claim a lease based on the given principals returning a function to unclaim and if the claim was successful.
func (*Tracker) Start ¶
func (t *Tracker) Start()
Start starts tracking for specified proxy address.
func (*Tracker) StopAll ¶
func (t *Tracker) StopAll()
StopAll permanently deactivates this tracker and cleans up all background goroutines.
func (*Tracker) TrackExpected ¶
TrackExpected starts/refreshes tracking for expected proxies. Called by agents when gossip messages are received.