Documentation ¶
Index ¶
- func IsErrGaterDisallowedConnection(err error) bool
- func IsErrProtocolNotSupported(err error) bool
- func IsErrSecurityProtocolNegotiationFailed(err error) bool
- func NewLibP2PStreamFactory(h host.Host) p2p.StreamFactory
- type ErrGaterDisallowedConnection
- type ErrProtocolNotSupported
- type ErrSecurityProtocolNegotiationFailed
- type LibP2PStreamFactory
- func (l *LibP2PStreamFactory) Connect(ctx context.Context, peerAddrInfo peer.AddrInfo) error
- func (l *LibP2PStreamFactory) NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID) (network.Stream, error)
- func (l *LibP2PStreamFactory) SetStreamHandler(pid protocol.ID, handler network.StreamHandler)
- type PlainStream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrGaterDisallowedConnection ¶
IsErrGaterDisallowedConnection returns whether an error is ErrGaterDisallowedConnection.
func IsErrProtocolNotSupported ¶
IsErrProtocolNotSupported returns whether an error is ErrProtocolNotSupported.
func IsErrSecurityProtocolNegotiationFailed ¶
IsErrSecurityProtocolNegotiationFailed returns whether an error is ErrSecurityProtocolNegotiationFailed.
func NewLibP2PStreamFactory ¶
func NewLibP2PStreamFactory(h host.Host) p2p.StreamFactory
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 ¶
func (e ErrGaterDisallowedConnection) Error() string
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 ¶
func (e ErrSecurityProtocolNegotiationFailed) Error() string
type LibP2PStreamFactory ¶
type LibP2PStreamFactory struct {
// contains filtered or unexported fields
}
func (*LibP2PStreamFactory) Connect ¶
Connect connects host to peer with peerAddrInfo. All errors returned from this function can be considered benign. We expect the following errors during normal operations:
- ErrSecurityProtocolNegotiationFailed this indicates there was an issue upgrading the connection.
- ErrGaterDisallowedConnection this indicates the connection was disallowed by the gater.
- There may be other unexpected errors from libp2p but they should be considered benign.
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)
type PlainStream ¶ added in v0.32.2
type PlainStream struct {
// contains filtered or unexported fields
}
PlainStream is a stream factory that reflects the same input stream without any modification.
func NewPlainStream ¶ added in v0.32.2
func NewPlainStream(handler libp2pnet.StreamHandler, protocolId protocol.ID) PlainStream
NewPlainStream creates a new PlainStream. Args: - handler: the stream handler that handles the input stream. - protocolId: the protocol id of the stream. Returns:
- PlainStream instance.
func (PlainStream) Handler ¶ added in v0.32.2
func (p PlainStream) Handler(s libp2pnet.Stream)
func (PlainStream) ProtocolId ¶ added in v0.32.2
func (p PlainStream) ProtocolId() protocol.ID
func (PlainStream) UpgradeRawStream ¶ added in v0.32.2
UpgradeRawStream implements protocol interface and returns the input stream without any modification.