dht

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrPeerNotFound

func NewErrPeerNotFound(peerID protocol.PeerID) error

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.Iterable, 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

type ErrPeerNotFound struct {
	protocol.PeerID
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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