Documentation
¶
Overview ¶
client is a tamed client that attaches itself to the running tailscale daemon. It receives events and maintains peer's membership (map) by sending & receiving heartbeat pings
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { sync.RWMutex // Lock to prevent concurrent modification, mainly peers map *Option // contains filtered or unexported fields }
Client is TailScale as Membership Discovery client client connected to the tailScale daemon running on the machine. In addition to the connection to tailScale client daemon, this also tracks the peerStatus by sending heartbeat pings to all peers and collecting their status periodically
func (*Client) ActivePeers ¶
func (c *Client) ActivePeers() []PeerStatus
ActivePeers returns a list of active peers from the current snapshot of peers
func (*Client) AllPeers ¶
func (c *Client) AllPeers() []PeerStatus
ActivePeers returns a list of current snapshot of peers
type LoggerFunc ¶
type LoggerFunc func(format string, args ...interface{})
LoggerFunc provides logging interface for tamed client
type Notify ¶
type Notify struct { ipn.Notify PingRequest *PingRequest PeerRemoved *PeerRemoved }
type Option ¶
type Option struct { InactivityTimeLimit time.Duration // Time after which a node is considered inactive HeartbeatInterval time.Duration // Interval between subsequent heartbeats InactivePeerHeartBeatInterval time.Duration // Time after which an inactive peer should be pinged TailScaleSocket string ListenerCh chan Notify Logger LoggerFunc StartServer bool }
Set of options, mainly targeted to membership
func DefaultOptions ¶
func DefaultOptions() *Option
type PeerRemoved ¶
type PeerRemoved struct {
*ipnstate.PeerStatus
}
type PeerStatus ¶
type PeerStatus struct { IpnPeerStatus ipnstate.PeerStatus IpnPingResult ipnstate.PingResult // Might be default if no ping response was ever received LastPingRequest time.Time LastPingResponse time.Time // contains filtered or unexported fields }
PeerStatus contains information about a single peer
func (*PeerStatus) HasBeenPinged ¶
func (ps *PeerStatus) HasBeenPinged() bool
Returns true if response from this Peer has ever been received
func (*PeerStatus) LatencyInSeconds ¶
func (ps *PeerStatus) LatencyInSeconds() float64
Latency to ping the Peer. If peer has been inactive then returns math.MaxFloat64
func (*PeerStatus) String ¶
func (ps *PeerStatus) String() string