stream

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrGaterDisallowedConnection

func IsErrGaterDisallowedConnection(err error) bool

IsErrGaterDisallowedConnection returns whether an error is ErrGaterDisallowedConnection.

func IsErrProtocolNotSupported

func IsErrProtocolNotSupported(err error) bool

IsErrProtocolNotSupported returns whether an error is ErrProtocolNotSupported.

func IsErrSecurityProtocolNegotiationFailed

func IsErrSecurityProtocolNegotiationFailed(err error) bool

IsErrSecurityProtocolNegotiationFailed returns whether an error is ErrSecurityProtocolNegotiationFailed.

Types

type ErrGaterDisallowedConnection

type ErrGaterDisallowedConnection struct {
	// contains filtered or unexported fields
}

ErrGaterDisallowedConnection wrapper around github.com/libp2p/go-libp2p/p2p/net/swarm.ErrGaterDisallowedConnection.

func NewGaterDisallowedConnectionErr

func NewGaterDisallowedConnectionErr(err error) ErrGaterDisallowedConnection

NewGaterDisallowedConnectionErr returns a new ErrGaterDisallowedConnection.

func (ErrGaterDisallowedConnection) Error

type ErrProtocolNotSupported

type ErrProtocolNotSupported struct {
	// contains filtered or unexported fields
}

ErrProtocolNotSupported indicates node is running on a different spork.

func NewProtocolNotSupportedErr

func NewProtocolNotSupportedErr(peerID peer.ID, protocolIDS []protocol.ID, err error) ErrProtocolNotSupported

NewProtocolNotSupportedErr returns a new ErrSecurityProtocolNegotiationFailed.

func (ErrProtocolNotSupported) Error

func (e ErrProtocolNotSupported) Error() string

type ErrSecurityProtocolNegotiationFailed

type ErrSecurityProtocolNegotiationFailed struct {
	// contains filtered or unexported fields
}

ErrSecurityProtocolNegotiationFailed indicates security protocol negotiation failed during the stream factory connect attempt.

func NewSecurityProtocolNegotiationErr

func NewSecurityProtocolNegotiationErr(pid peer.ID, err error) ErrSecurityProtocolNegotiationFailed

NewSecurityProtocolNegotiationErr returns a new ErrSecurityProtocolNegotiationFailed.

func (ErrSecurityProtocolNegotiationFailed) Error

type Factory

type Factory interface {
	SetStreamHandler(protocol.ID, network.StreamHandler)
	DialAddress(peer.ID) []multiaddr.Multiaddr
	ClearBackoff(peer.ID)
	// Connect connects host to peer with peerID.
	// Expected errors during normal operations:
	//   - NewSecurityProtocolNegotiationErr this indicates there was an issue upgrading the connection.
	Connect(context.Context, peer.AddrInfo) error
	// NewStream creates a new stream on the libp2p host.
	// Expected errors during normal operations:
	//   - ErrProtocolNotSupported this indicates remote node is running on a different spork.
	NewStream(context.Context, peer.ID, ...protocol.ID) (network.Stream, error)
}

Factory is a wrapper around libp2p host.Host to provide abstraction and encapsulation for unicast stream manager so that it can create libp2p streams with finer granularity.

func NewLibP2PStreamFactory

func NewLibP2PStreamFactory(h host.Host) Factory

type LibP2PStreamFactory

type LibP2PStreamFactory struct {
	// contains filtered or unexported fields
}

func (*LibP2PStreamFactory) ClearBackoff

func (l *LibP2PStreamFactory) ClearBackoff(p peer.ID)

func (*LibP2PStreamFactory) Connect

func (l *LibP2PStreamFactory) Connect(ctx context.Context, peerAddrInfo peer.AddrInfo) error

Connect connects host to peer with peerAddrInfo. Expected errors during normal operations:

  • ErrSecurityProtocolNegotiationFailed this indicates there was an issue upgrading the connection.

func (*LibP2PStreamFactory) DialAddress

func (l *LibP2PStreamFactory) DialAddress(p peer.ID) []multiaddr.Multiaddr

func (*LibP2PStreamFactory) NewStream

func (l *LibP2PStreamFactory) NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID) (network.Stream, error)

NewStream creates a new stream on the libp2p host. Expected errors during normal operations:

  • ErrProtocolNotSupported this indicates remote node is running on a different spork.

func (*LibP2PStreamFactory) SetStreamHandler

func (l *LibP2PStreamFactory) SetStreamHandler(pid protocol.ID, handler network.StreamHandler)

Jump to

Keyboard shortcuts

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