1
0
mirror of https://github.com/libp2p/go-libp2p-core.git synced 2025-04-17 15:40:37 +08:00
go-libp2p-core/network/stream.go
Raúl Kripalani 47396eb0b7 reorg code; see below.
* flatten out slim packages in routing.
* simplify naming in discovery.
* break up big monolithic files into constituents (network, pnet).
* renames for consistency.
2019-04-17 17:21:49 +01:00

25 lines
602 B
Go

package network
import (
"github.com/libp2p/go-libp2p-core/mux"
"github.com/libp2p/go-libp2p-core/protocol"
)
// Stream represents a bidirectional channel between two agents in
// a libp2p network. "agent" is as granular as desired, potentially
// being a "request -> reply" pair, or whole protocols.
//
// Streams are backed by a multiplexer underneath the hood.
type Stream interface {
mux.MuxedStream
Protocol() protocol.ID
SetProtocol(id protocol.ID)
// Stat returns metadata pertaining to this stream.
Stat() Stat
// Conn returns the connection this stream is part of.
Conn() Conn
}