v0.20.1 Latest Latest

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 4 Imported by: 313



Deprecated: This package has moved into go-libp2p as a sub-package:

Package routing provides interfaces for peer routing and content routing in libp2p.



View Source
const (
	// Sending a query to a peer.
	// Deprecated: use instead
	SendingQuery = routing.SendingQuery
	// Got a response from a peer.
	// Deprecated: use instead
	PeerResponse = routing.PeerResponse
	// Found a "closest" peer (not currently used).
	// Deprecated: use instead
	FinalPeer = routing.FinalPeer
	// Got an error when querying.
	// Deprecated: use instead
	QueryError = routing.QueryError
	// Found a provider.
	// Deprecated: use instead
	Provider = routing.Provider
	// Found a value.
	// Deprecated: use instead
	Value = routing.Value
	// Adding a peer to the query.
	// Deprecated: use instead
	AddingPeer = routing.AddingPeer
	// Dialing a peer.
	// Deprecated: use instead
	DialingPeer = routing.DialingPeer


View Source
var ErrNotFound = routing.ErrNotFound

ErrNotFound is returned when the router fails to find the requested record. Deprecated: use instead

View Source
var ErrNotSupported = routing.ErrNotSupported

ErrNotSupported is returned when the router doesn't support the given record type/operation. Deprecated: use instead

View Source
var Expired = routing.Expired

Expired is an option that tells the routing system to return expired records when no newer records are known. Deprecated: use instead

View Source
var Offline = routing.Offline

Offline is an option that tells the routing system to operate offline (i.e., rely on cached/local data only). Deprecated: use instead

View Source
var QueryEventBufferSize = routing.QueryEventBufferSize

Number of events to buffer. Deprecated: use instead


func GetPublicKey

func GetPublicKey(r ValueStore, ctx context.Context, p peer.ID) (ci.PubKey, error)

GetPublicKey retrieves the public key associated with the given peer ID from the value store.

If the ValueStore is also a PubKeyFetcher, this method will call GetPublicKey (which may be better optimized) instead of GetValue. Deprecated: use instead

func KeyForPublicKey

func KeyForPublicKey(id peer.ID) string

KeyForPublicKey returns the key used to retrieve public keys from a value store. Deprecated: use instead

func PublishQueryEvent

func PublishQueryEvent(ctx context.Context, ev *QueryEvent)

PublishQueryEvent publishes a query event to the query event channel associated with the given context, if any. Deprecated: use instead

func RegisterForQueryEvents

func RegisterForQueryEvents(ctx context.Context) (context.Context, <-chan *QueryEvent)

RegisterForQueryEvents registers a query event channel with the given context. The returned context can be passed to DHT queries to receive query events on the returned channels.

The passed context MUST be canceled when the caller is no longer interested in query events. Deprecated: use instead

func SubscribesToQueryEvents added in v0.5.3

func SubscribesToQueryEvents(ctx context.Context) bool

SubscribesToQueryEvents returns true if the context subscribes to query events. If this function returns falls, calling `PublishQueryEvent` on the context will be a no-op. Deprecated: use instead


type ContentRouting

type ContentRouting = routing.ContentRouting

ContentRouting is a value provider layer of indirection. It is used to find information about who has what content.

Content is identified by CID (content identifier), which encodes a hash of the identified content in a future-proof manner. Deprecated: use instead

type Option

type Option = routing.Option

Option is a single routing option. Deprecated: use instead

type Options

type Options = routing.Options

Options is a set of routing options Deprecated: use instead

type PeerRouting

type PeerRouting = routing.PeerRouting

PeerRouting is a way to find address information about certain peers. This can be implemented by a simple lookup table, a tracking server, or even a DHT. Deprecated: use instead

type PubKeyFetcher

type PubKeyFetcher = routing.PubKeyFetcher

PubKeyFetcher is an interfaces that should be implemented by value stores that can optimize retrieval of public keys.

TODO(steb): Consider removing, see Deprecated: use instead

type QueryEvent

type QueryEvent = routing.QueryEvent

QueryEvent is emitted for every notable event that happens during a DHT query. Deprecated: use instead

type QueryEventType

type QueryEventType = routing.QueryEventType

QueryEventType indicates the query event's type. Deprecated: use instead

type Routing

type Routing = routing.Routing

Routing is the combination of different routing types supported by libp2p. It can be satisfied by a single item (such as a DHT) or multiple different pieces that are more optimized to each task. Deprecated: use instead

type ValueStore

type ValueStore = routing.ValueStore

ValueStore is a basic Put/Get interface. Deprecated: use instead

Jump to

Keyboard shortcuts

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