peerlastseen

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2020 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerLastSeen

type PeerLastSeen struct {
	// contains filtered or unexported fields
}

TODO: Merge PeerLastSeen code into common/p2putil? Similar to libp2p's 'identify' package's ObservedAddr, but for IDs rather than specific multiaddresses

func NewPeerLastSeen

func NewPeerLastSeen(dur time.Duration, cb PeerLastSeenCB) (*PeerLastSeen, error)

func (*PeerLastSeen) LastSeen

func (pls *PeerLastSeen) LastSeen(id peer.ID) (time.Time, error)

Returns timestamp of when peer with given 'id' was last seen Use absolute time rather than duration in case 'id' is not in the map and we return the default 0-value

func (*PeerLastSeen) UpdateLastSeen

func (pls *PeerLastSeen) UpdateLastSeen(id peer.ID) error

type PeerLastSeenCB

type PeerLastSeenCB func(peer.ID)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL