protocol

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

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

Types

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

type ID

type ID = protocol.ID

ID is an identifier used to write protocol headers in streams. Deprecated: use github.com/libp2p/go-libp2p/core/protocol.ID instead

const (
	// Deprecated: use github.com/libp2p/go-libp2p/core/protocol.TestingID 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 github.com/libp2p/go-libp2p/core/protocol.ConvertFromStrings 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 github.com/libp2p/go-libp2p/core/protocol.Negotiator 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 github.com/libp2p/go-libp2p/core/protocol.Router 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 github.com/libp2p/go-libp2p/core/protocol.Switch instead

Jump to

Keyboard shortcuts

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