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: 1 Imported by: 574



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

Package protocol provides core interfaces for protocol routing and negotiation in libp2p.



This section is empty.


This section is empty.


func ConvertToStrings

func ConvertToStrings(ids []ID) (res []string)

ConvertToStrings is a convenience function that takes a slice of protocol.ID and converts it to a slice of strings. Deprecated: use instead


type HandlerFunc

type HandlerFunc = protocol.HandlerFunc

HandlerFunc is a user-provided function used by the Router to handle a protocol/stream.

Will be invoked with the protocol ID string as the first argument, which may differ from the ID used for registration if the handler was registered using a match function. Deprecated: use instead

type ID

type ID = protocol.ID

ID is an identifier used to write protocol headers in streams. Deprecated: use instead

const (
	// Deprecated: use instead
	TestingID ID = protocol.TestingID

These are reserved protocol.IDs.

func ConvertFromStrings

func ConvertFromStrings(ids []string) (res []ID)

ConvertFromStrings is a convenience function that takes a slice of strings and converts it to a slice of protocol.ID. Deprecated: use instead

type Negotiator

type Negotiator = protocol.Negotiator

Negotiator is a component capable of reaching agreement over what protocols to use for inbound streams of communication. Deprecated: use instead

type Router

type Router = protocol.Router

Router is an interface that allows users to add and remove protocol handlers, which will be invoked when incoming stream requests for registered protocols are accepted.

Upon receiving an incoming stream request, the Router will check all registered protocol handlers to determine which (if any) is capable of handling the stream. The handlers are checked in order of registration; if multiple handlers are eligible, only the first to be registered will be invoked. Deprecated: use instead

type Switch

type Switch = protocol.Switch

Switch is the component responsible for "dispatching" incoming stream requests to their corresponding stream handlers. It is both a Negotiator and a Router. Deprecated: use instead

Jump to

Keyboard shortcuts

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