moqt.Dialer manages client-side operations for the MoQ protocol. It establishes sessions with MoQ servers over WebTransport, native QUIC, and QMux over WebSocket.
Overview
Overview
Initialize a Dialer
There is no dedicated function (such as a constructor) for initializing a dialer. Users define the struct directly and assign values to its fields as needed.Configuration
The following table describes the public fields of themoqt.Dialer struct:
- Using Default QUIC
- Using Custom QUIC
quic-go/quic-go is used internally as the default QUIC implementation when relevant fields which is set for customization are not set or nil.quic-go/quic-go- Using Default WebTransport
- Using Custom WebTransport
okdaichi/webtransport-go — a fork of quic-go/webtransport-go carrying a custom upgrader — is used internally as the default WebTransport implementation when the relevant customization fields are not set or are nil.okdaichi/webtransport-goDial and Establish Session
Dial is the only way to establish a session. It selects the transport from the URL scheme:
https://— WebTransport (HTTP/3)moqt://— Native QUICwss://— QMux over WebSocket, the binding for clients that cannot use WebTransport (ws://does without TLS)
Dialer.QUICConfig configures a WebSocket session too, with the settings QMux shares with QUIC (stream limits, receive windows, keep-alive, idle and handshake timeouts, datagrams), and Dialer.DialWebSocketFunc replaces the dial. Like the other two dial functions it receives QUICConfig as it is: what the default dials do with it (turning on what WebTransport needs, and refusing a negative keep-alive) is left to the function.
Session.RequestURI. A URL with no path is dialed as /.
On native QUIC the path travels as the SETUP Path parameter, since that binding
has no request URI of its own.
Note: QueriesA query reaches the server on both bindings, and
Session.RequestURI carries it after ? on both
sides. On https:// it is part of the HTTP request URI; on moqt:// it is
appended to the SETUP Path parameter after ?, as draft-ietf-moq-transport and
the moq-lite reference implementation do. That is how a credential such as ?jwt= reaches a server over native QUIC.
A fragment is client-side only and is never sent on either binding.DialQUICFunc or
DialWebTransportFunc on the Dialer — see the Using Custom QUIC tab under
Initialize a Dialer. These replace the handshake Dial
performs; Dial still parses the URL and selects the transport from it, so they
are not a way to bypass URL handling.
Note: Nil TrackMuxWhen
mux is set to nil, the moqt.DefaultMux will be used by default.
Ensure that the mux is properly configured for your use case to avoid unexpected behavior.Note: ALPN NegotiationFor native QUIC connections, the dialer automatically sets the ALPN token to
moq-lite-05 (moqt.NextProtoMOQ) if TLSConfig.NextProtos is not configured.