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
- Variables
- func GetPublicKey(r ValueStore, ctx context.Context, p peer.ID) (ci.PubKey, error)
- func KeyForPublicKey(id peer.ID) string
- func PublishQueryEvent(ctx context.Context, ev *QueryEvent)
- func RegisterForQueryEvents(ctx context.Context) (context.Context, <-chan *QueryEvent)
- func SubscribesToQueryEvents(ctx context.Context) bool
- type ContentRouting
- type Option
- type Options
- type PeerRouting
- type PubKeyFetcher
- type QueryEvent
- type QueryEventType
- type Routing
- type ValueStore
Constants ¶
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 ¶
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
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
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
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
var QueryEventBufferSize = routing.QueryEventBufferSize
Number of events to buffer. Deprecated: use github.com/libp2p/go-libp2p/core/routing.QueryEventBufferSize instead
Functions ¶
func GetPublicKey ¶
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 ¶
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
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 ¶
Option is a single routing option. Deprecated: use github.com/libp2p/go-libp2p/core/routing.Option instead
type 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 ¶
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