package yamux

Import Path
	github.com/libp2p/go-yamux/v5 (on go.dev)

Dependency Relation
	imports 16 packages, and imported by one package


Package-Level Type Names (total 7)
/* sort by: | */
Config is used to tune the Yamux session AcceptBacklog is used to limit how many streams may be waiting an accept. ConnectionWriteTimeout is meant to be a "safety valve" timeout after we which will suspect a problem with the underlying connection and close it. This is only applied to writes, where's there's generally an expectation that things will move along quickly. EnableKeepalive is used to do a period keep alive messages using a ping. InitialStreamWindowSize is used to control the initial window size that we allow for a stream. KeepAliveInterval is how often to perform the keep alive LogOutput is used to control the log destination MaxIncomingStreams is maximum number of concurrent incoming streams that we accept. If the peer tries to open more streams, those will be reset immediately. MaxMessageSize is the maximum size of a message that we'll send on a stream. This ensures that a single stream doesn't hog a connection. MaxStreamWindowSize is used to control the maximum window size that we allow for a stream. MeasureRTTInterval is how often to re-measure the round trip time PingBacklog is used to limit how many ping acks we can queue. ReadBufSize controls the size of the read buffer. Set to 0 to disable it. WriteCoalesceDelay is the maximum amount of time we'll delay coalescing a packet before sending it. This should be on the order of micro-milliseconds. func DefaultConfig() *Config func github.com/libp2p/go-libp2p/p2p/muxer/yamux.(*Transport).Config() *Config func Client(conn net.Conn, config *Config, mm func() (MemoryManager, error)) (*Session, error) func Server(conn net.Conn, config *Config, mm func() (MemoryManager, error)) (*Session, error) func VerifyConfig(config *Config) error
(*Error) Error() string (*Error) Temporary() bool (*Error) Timeout() bool *Error : github.com/jbenet/go-temp-err-catcher.Temporary *Error : error *Error : net.Error var ErrConnectionWriteTimeout *Error var ErrDuplicateStream *Error var ErrInvalidMsgType *Error var ErrInvalidVersion *Error var ErrKeepAliveTimeout *Error var ErrRecvWindowExceeded *Error var ErrStreamClosed *Error var ErrStreamReset *Error var ErrStreamsExhausted *Error var ErrTimeout *Error var ErrUnexpectedFlag *Error
ErrorCode uint32 Remote bool (*GoAwayError) Error() string (*GoAwayError) Is(target error) bool (*GoAwayError) Temporary() bool (*GoAwayError) Timeout() bool *GoAwayError : github.com/jbenet/go-temp-err-catcher.Temporary *GoAwayError : error *GoAwayError : net.Error var ErrRemoteGoAway *GoAwayError var ErrSessionShutdown *GoAwayError
The MemoryManager allows management of memory allocations. Memory is allocated: 1. When opening / accepting a new stream. This uses the highest priority. 2. When trying to increase the stream receive window. This uses a lower priority. This is a subset of the libp2p's resource manager ResourceScopeSpan interface. Done ends the span and releases associated resources. ReleaseMemory explicitly releases memory previously reserved with ReserveMemory ( MemoryManager) ReserveMemory(size int, prio uint8) error github.com/libp2p/go-libp2p/core/network.ConnManagementScope (interface) *github.com/libp2p/go-libp2p/core/network.NullScope github.com/libp2p/go-libp2p/core/network.ResourceScopeSpan (interface) github.com/libp2p/go-libp2p/core/network.StreamManagementScope (interface)
Session is used to wrap a reliable ordered connection and to multiplex it into multiple streams. Accept is used to block until the next available stream is ready to be accepted. AcceptStream is used to block until the next available stream is ready to be accepted. Addr is used to get the address of the listener. Close is used to close the session and all streams. It doesn't send a GoAway before closing the connection. CloseChan returns a read-only channel which is closed as soon as the session is closed. CloseWithError is used to close the session and all streams after sending a GoAway message with errCode. Blocks for ConnectionWriteTimeout to write the GoAway message. The GoAway may not actually be sent depending on the semantics of the underlying net.Conn. For TCP connections, it may be dropped depending on LINGER value or if there's unread data in the kernel receive buffer. GoAway can be used to prevent accepting further connections. It does not close the underlying conn. IsClosed does a safe check to see if we have shutdown LocalAddr is used to get the local address of the underlying connection. NumStreams returns the number of currently open streams Open is used to create a new stream as a net.Conn OpenStream is used to create a new stream Ping is used to measure the RTT response time RemoteAddr is used to get the address of remote end of the underlying connection *Session : github.com/prometheus/common/expfmt.Closer *Session : io.Closer *Session : net.Listener func Client(conn net.Conn, config *Config, mm func() (MemoryManager, error)) (*Session, error) func Server(conn net.Conn, config *Config, mm func() (MemoryManager, error)) (*Session, error) func (*Stream).Session() *Session func github.com/libp2p/go-libp2p/p2p/muxer/yamux.NewMuxedConn(m *Session) network.MuxedConn
Stream is used to represent a logical stream within a session. Close is used to close the stream. CloseRead is used to close the stream for reading. Note: Remote is not notified. CloseWrite is used to close the stream for writing. LocalAddr returns the local address Read is used to read from the stream RemoteAddr returns the remote address Reset resets the stream (forcibly closes the stream) (*Stream) ResetWithError(errCode uint32) error Session returns the associated stream session SetDeadline sets the read and write deadlines SetReadDeadline sets the deadline for future Read calls. SetWriteDeadline sets the deadline for future Write calls StreamID returns the ID of this stream Write is used to write to the stream *Stream : github.com/miekg/dns.Writer *Stream : github.com/pion/datachannel.ReadDeadliner *Stream : github.com/pion/datachannel.WriteDeadliner *Stream : github.com/pion/stun.Connection *Stream : github.com/pion/stun/v3.Connection *Stream : github.com/prometheus/common/expfmt.Closer *Stream : internal/bisect.Writer *Stream : io.Closer *Stream : io.ReadCloser *Stream : io.Reader *Stream : io.ReadWriteCloser *Stream : io.ReadWriter *Stream : io.WriteCloser *Stream : io.Writer *Stream : net.Conn func (*Session).AcceptStream() (*Stream, error) func (*Session).OpenStream(ctx context.Context) (*Stream, error)
A StreamError is used for errors returned from Read and Write calls after the stream is Reset ErrorCode uint32 Remote bool (*StreamError) Error() string (*StreamError) Is(target error) bool *StreamError : error
Package-Level Functions (total 4)
Client is used to initialize a new client-side connection. There must be at most one client-side connection.
DefaultConfig is used to return a default configuration
Server is used to initialize a new server-side connection. There must be at most one server-side connection. If a nil config is provided, the DefaultConfiguration will be used.
VerifyConfig is used to verify the sanity of configuration
Package-Level Variables (total 13)
ErrConnectionWriteTimeout indicates that we hit the "safety valve" timeout writing to the underlying stream connection.
ErrDuplicateStream is used if a duplicate stream is opened inbound
ErrInvalidMsgType means we received a frame with an invalid message type
ErrInvalidVersion means we received a frame with an invalid version
ErrKeepAliveTimeout is sent if a missed keepalive caused the stream close
ErrReceiveWindowExceeded indicates the window was exceeded
ErrRemoteGoAway is used when we get a go away from the other side with error code goAwayNormal(0).
ErrSessionShutdown is used if there is a shutdown during an operation
ErrStreamClosed is returned when using a closed stream
ErrStreamReset is sent if a stream is reset. This can happen if the backlog is exceeded, or if there was a remote GoAway.
ErrStreamsExhausted is returned if we have no more stream ids to issue
ErrTimeout is used when we reach an IO deadline
ErrUnexpectedFlag is set when we get an unexpected flag