routing

package
Version: v0.20.1 Latest Latest
Warning

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: 292

Documentation

Overview

Deprecated: This package has moved into go-libp2p as a sub-package: github.com/libp2p/go-libp2p/core/routing.

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

Index

Constants

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

Variables

View Source
var ErrNotFound = routing.ErrNotFound

ErrNotFound is returned when the router fails to find the requested record. Deprecated: use github.com/libp2p/go-libp2p/core/routing.ErrNotFound instead

View Source
var ErrNotSupported = routing.ErrNotSupported

ErrNotSupported is returned when the router doesn't support the given record type/operation. Deprecated: use github.com/libp2p/go-libp2p/core/routing.ErrNotSupported 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 github.com/libp2p/go-libp2p/core/routing.Expired 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 github.com/libp2p/go-libp2p/core/routing.Offline instead

View Source
var QueryEventBufferSize = routing.QueryEventBufferSize

Number of events to buffer. Deprecated: use github.com/libp2p/go-libp2p/core/routing.QueryEventBufferSize instead

Functions

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 github.com/libp2p/go-libp2p/core/routing.GetPublicKey instead

func KeyForPublicKey

func KeyForPublicKey(id peer.ID) string

KeyForPublicKey returns the key used to retrieve public keys from a value store. Deprecated: use github.com/libp2p/go-libp2p/core/routing.KeyForPublicKey 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 github.com/libp2p/go-libp2p/core/routing.PublishQueryEvent 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 github.com/libp2p/go-libp2p/core/routing.RegisterForQueryEvents 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 github.com/libp2p/go-libp2p/core/routing.SubscribesToQueryEvents instead

Types

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 github.com/libp2p/go-libp2p/core/routing.ContentRouting instead

type Option

type Option = routing.Option

Option is a single routing option. Deprecated: use github.com/libp2p/go-libp2p/core/routing.Option instead

type Options

type Options = routing.Options

Options is a set of routing options Deprecated: use github.com/libp2p/go-libp2p/core/routing.Options 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 github.com/libp2p/go-libp2p/core/routing.PeerRouting 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 https://github.com/libp2p/go-libp2p-routing/issues/22. Deprecated: use github.com/libp2p/go-libp2p/core/routing.PubkeyFetcher instead

type QueryEvent

type QueryEvent = routing.QueryEvent

QueryEvent is emitted for every notable event that happens during a DHT query. Deprecated: use github.com/libp2p/go-libp2p/core/routing.QueryEvent instead

type QueryEventType

type QueryEventType = routing.QueryEventType

QueryEventType indicates the query event's type. Deprecated: use github.com/libp2p/go-libp2p/core/routing.QueryEventType 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 github.com/libp2p/go-libp2p/core/routing.Routing instead

type ValueStore

type ValueStore = routing.ValueStore

ValueStore is a basic Put/Get interface. Deprecated: use github.com/libp2p/go-libp2p/core/routing.ValueStore instead

Jump to

Keyboard shortcuts

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