Documentation
¶
Overview ¶
Package transport exposes transport stream/connection abstractions and transport-layer error types shared across QUIC and WebTransport integrations.
This package is the canonical home for transport contracts and error aliases.
Index ¶
- type ApplicationError
- type ApplicationErrorCode
- type ConnErrorCode
- type ConnectionStats
- type DatagramTooLargeError
- type HandshakeTimeoutError
- type IdleTimeoutError
- type QUICListener
- type ReceiveStream
- type SendStream
- type StatelessResetError
- type Stream
- type StreamConn
- type StreamError
- type StreamErrorCode
- type StreamID
- type TransportError
- type TransportErrorCode
- type VersionNegotiationError
- type WebTransportSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationError ¶
type ApplicationError = quicgo.ApplicationError
ApplicationError represents an application-level error in QUIC.
type ApplicationErrorCode ¶
type ApplicationErrorCode = quicgo.ApplicationErrorCode
ApplicationErrorCode identifies application-defined errors.
type ConnErrorCode ¶
type ConnErrorCode = ApplicationErrorCode
type ConnectionStats ¶
type ConnectionStats = quicgo.ConnectionStats
type DatagramTooLargeError ¶
type DatagramTooLargeError = quicgo.DatagramTooLargeError
DatagramTooLargeError is returned from Connection.SendDatagram if the payload is too large to be sent.
type HandshakeTimeoutError ¶
type HandshakeTimeoutError = quicgo.HandshakeTimeoutError
HandshakeTimeoutError indicates that the handshake did not complete in time.
type IdleTimeoutError ¶
type IdleTimeoutError = quicgo.IdleTimeoutError
IdleTimeoutError indicates that the connection timed out due to inactivity.
type QUICListener ¶
type ReceiveStream ¶
type ReceiveStream interface {
io.Reader
// CancelRead cancels reading with the given error code.
CancelRead(StreamErrorCode)
// SetReadDeadline sets the deadline for read operations.
SetReadDeadline(time.Time) error
}
ReceiveStream is a unidirectional stream for receiving data.
type SendStream ¶
type SendStream interface {
io.Writer
io.Closer
// CancelWrite cancels writing with the given error code.
CancelWrite(StreamErrorCode)
// SetWriteDeadline sets the deadline for write operations.
SetWriteDeadline(time.Time) error
// Context returns the stream's context, canceled when the stream is closed.
Context() context.Context
}
SendStream is a unidirectional stream for sending data.
type StatelessResetError ¶
type StatelessResetError = quicgo.StatelessResetError
StatelessResetError indicates that a stateless reset was received.
type Stream ¶
type Stream interface {
SendStream
ReceiveStream
// SetDeadline sets the read and write deadlines.
SetDeadline(time.Time) error
}
Stream is a bidirectional stream that implements both SendStream and ReceiveStream.
type StreamConn ¶
type StreamConn interface {
// AcceptStream waits for and accepts the next incoming bidirectional stream.
AcceptStream(ctx context.Context) (Stream, error)
// AcceptUniStream waits for and accepts the next incoming unidirectional stream.
AcceptUniStream(ctx context.Context) (ReceiveStream, error)
// CloseWithError closes the connection with an error code and message.
CloseWithError(code ConnErrorCode, msg string) error
// Context returns the connection's context, which is canceled when the connection is closed.
Context() context.Context
// LocalAddr returns the local network address.
LocalAddr() net.Addr
// OpenStream opens a new bidirectional stream without blocking, returning a
// StreamLimitReachedError (wrapped by the transport) when the peer's
// MAX_STREAMS credit is exhausted.
//
// Deprecated: Use OpenStreamSync, which backpressures on the peer's
// stream-limit flow control instead of failing. All of gomoqt's outgoing
// streams use the Sync variant; this non-blocking form has no production
// callers and remains only for parity with quic-go.
OpenStream() (Stream, error)
// OpenStreamSync opens a new bidirectional stream, blocking until the peer's
// stream-limit flow control grants one (or ctx is canceled). Prefer this over
// OpenStream when opening a stream should backpressure rather than fail on a
// transient stream-limit condition — e.g. opening MoQ control streams
// (subscribe, fetch, announce, probe) and GOAWAY.
OpenStreamSync(ctx context.Context) (Stream, error)
// OpenUniStream opens a new unidirectional stream without blocking,
// returning a StreamLimitReachedError (wrapped by the transport) when the
// peer's MAX_STREAMS credit is exhausted.
//
// Deprecated: Use OpenUniStreamSync, which backpressures on the peer's
// stream-limit flow control instead of failing. gomoqt opens group streams
// via OpenUniStreamSync; this non-blocking form has no production callers
// and remains only for parity with quic-go.
OpenUniStream() (SendStream, error)
// OpenUniStreamSync opens a new unidirectional stream, blocking until the
// peer's stream-limit flow control grants one (or ctx is canceled). Prefer
// this when opening a stream should backpressure rather than fail — e.g.
// opening MoQ group streams in a publish loop, where a stream-limit error
// would otherwise abort the whole publisher.
OpenUniStreamSync(ctx context.Context) (SendStream, error)
// RemoteAddr returns the remote network address.
RemoteAddr() net.Addr
// TLS returns the TLS connection state if applicable, or nil if not using TLS.
TLS() *tls.ConnectionState
}
StreamConn represents a connection that can send and receive streams. It abstracts the underlying transport implementation and provides methods for creating bidirectional and unidirectional streams.
type StreamError ¶
type StreamError = quicgo.StreamError
StreamError is used for Stream.CancelRead and Stream.CancelWrite. It is also returned from Stream.Read and Stream.Write if the peer canceled reading or writing.
type StreamErrorCode ¶
type StreamErrorCode = quicgo.StreamErrorCode
StreamErrorCode identifies stream-specific errors.
type TransportError ¶
type TransportError = quicgo.TransportError
TransportError represents a QUIC transport layer error.
type TransportErrorCode ¶
type TransportErrorCode = quicgo.TransportErrorCode
TransportErrorCode identifies transport-layer protocol errors.
const ( NoError TransportErrorCode = quicgo.NoError InternalError TransportErrorCode = quicgo.InternalError ConnectionRefused TransportErrorCode = quicgo.ConnectionRefused FlowControlError TransportErrorCode = quicgo.FlowControlError StreamLimitError TransportErrorCode = quicgo.StreamLimitError StreamStateError TransportErrorCode = quicgo.StreamStateError FinalSizeError TransportErrorCode = quicgo.FinalSizeError FrameEncodingError TransportErrorCode = quicgo.FrameEncodingError TransportParameterError TransportErrorCode = quicgo.TransportParameterError ConnectionIDLimitError TransportErrorCode = quicgo.ConnectionIDLimitError ProtocolViolation TransportErrorCode = quicgo.ProtocolViolation InvalidToken TransportErrorCode = quicgo.InvalidToken ApplicationErrorErrorCode TransportErrorCode = quicgo.ApplicationErrorErrorCode CryptoBufferExceeded TransportErrorCode = quicgo.CryptoBufferExceeded KeyUpdateError TransportErrorCode = quicgo.KeyUpdateError AEADLimitReached TransportErrorCode = quicgo.AEADLimitReached NoViablePathError TransportErrorCode = quicgo.NoViablePathError )
type VersionNegotiationError ¶
type VersionNegotiationError = quicgo.VersionNegotiationError
VersionNegotiationError occurs when version negotiation fails.
type WebTransportSession ¶
type WebTransportSession interface {
StreamConn
Subprotocol() string
}
WebTransportSession represents a WebTransport session and its stream-oriented transport connection. It intentionally does not expose connection-level stats directly; transports that support stats may offer them through an optional stats-provider interface implemented by the concrete session type.