Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewErrPeerNotFound ¶
Types ¶
type DHT ¶
type DHT interface { Me() protocol.PeerAddress NumPeers() (int, error) PeerAddress(protocol.PeerID) (protocol.PeerAddress, error) PeerAddresses() (protocol.PeerAddresses, error) AddPeerAddress(protocol.PeerAddress) error AddPeerAddresses(protocol.PeerAddresses) error UpdatePeerAddress(peerAddr protocol.PeerAddress) (bool, error) RemovePeerAddress(protocol.PeerID) error }
A DHT is a distributed hash table. It is used for storing peer addresses. A DHT is not required to be persistent and will often purge stale peer addresses.
func New ¶
func New(me protocol.PeerAddress, codec protocol.PeerAddressCodec, store kv.Table, bootstrapAddrs ...protocol.PeerAddress) (DHT, error)
New DHT that stores peer addresses in the given store. It will cache all peer addresses in memory for fast access. It is safe for concurrent use, regardless of the underlying store.
type ErrPeerNotFound ¶
Click to show internal directories.
Click to hide internal directories.