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.
- 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
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 )
ErrNotFound is returned when the router fails to find the requested record. Deprecated: use github.com/libp2p/go-libp2p/core/routing.ErrNotFound instead
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
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
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
Number of events to buffer. Deprecated: use github.com/libp2p/go-libp2p/core/routing.QueryEventBufferSize instead
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 ¶
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 ¶
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
type 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
Option is a single routing option. Deprecated: use github.com/libp2p/go-libp2p/core/routing.Option instead
Options is a set of routing options Deprecated: use github.com/libp2p/go-libp2p/core/routing.Options instead
type 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 ¶
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 ¶
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 ¶
QueryEventType indicates the query event's type. Deprecated: use github.com/libp2p/go-libp2p/core/routing.QueryEventType instead
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