Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTimeoutStream ¶
func NewTimeoutStream(s core.Stream) network.SyncStream
NewTimeoutStream returns a new instance of stream
Types ¶
type StreamController ¶
type StreamController interface { // Request sends a message to the given stream and returns the response Request(peerID peer.ID, protocol protocol.ID, msg *network.Message) (*network.Message, error) // HandleStream is called at the beginning of stream handlers to create a wrapper stream and read first message HandleStream(stream core.Stream) (*network.Message, network.SyncStream, error) // Respond responds to incoming message Respond(msg *network.Message) error }
StreamController simplifies the interaction with libp2p streams. it wraps and keeps a reference to the opened stream, then takes care of reading/writing when needed.
Click to show internal directories.
Click to hide internal directories.