Skip to main content

Module url

Module url 

Source
Available on crate feature std only.
Expand description

The srt:// URL a caller dials (draft-sharabayko-srt-01 §3.2.1.3 Stream ID; the scheme itself is SRT’s registered URL form).

An SRT endpoint is a host:port plus the query overrides the Stream ID handshake extension carries: streamid (opaque, passed through to the handshake), latency, mode and passphrase. This module parses that form into a typed SrtUrl; which values an endpoint accepts is policy and belongs to the caller (the multimux push, for one, dials only in Caller mode and rejects a passphrase).

std only: the authority and query are parsed with the url crate and streamid values are percent-decoded with percent_encoding.

§Accepted shapes

Both srt://host:port?… and a scheme-less host:port?… are accepted (an operator’s configured remote is often just host:port). An authority may be host, host:port, [v6] or [v6]:port; a userinfo prefix is rejected rather than silently dropped, because an SRT authority has no credentials and a stream key written after @ must not vanish into a bare host:port. A bare, unbracketed IPv6 literal is rejected: ::1:9000 is ambiguous (is 9000 a port or the last group?), so the operator brackets it.

The query is split off the raw text rather than read through Url::query_pairs, a documented exception to the workspace’s de-hand-roll rule (spec §9): a Haivision streamid=#!::r=… value contains a # that a Url treats as a fragment delimiter, which would cut the value short unless it were percent-encoded. Splitting first keeps the whole value.

Structs§

SrtUrl
A parsed srt:// URL: the endpoint to dial and its Stream ID overrides.

Enums§

SrtMode
Which side opens the SRT handshake (draft-sharabayko-srt-01 §4.3).
UrlRejection
Why an srt:// URL was rejected: the failing part of the grammar, so a caller can word its own error while the grammar stays in one place.

Constants§

DEFAULT_PORT
SRT’s registered default port, so a URL that omits the port still names a dialable endpoint.
MAX_LATENCY_MS
The largest latency the draft treats as practical (draft-sharabayko-srt-01 §3.2.1.1), in milliseconds. A larger value is rejected rather than clamped: a wrong latency is a real misconfiguration.