#[non_exhaustive]pub struct RtmpTarget {
pub host: Host<String>,
pub port: u16,
pub tls: bool,
pub app: String,
pub stream_key: String,
/* private fields */
}target only.Expand description
A parsed RTMP publish target.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.host: Host<String>Host, never a pre-formatted string. rtmp is a non-special URL scheme, so
the url crate reports an IPv4 literal as Host::Domain("127.0.0.1")
(resolve handles it, lookup_host accepts literals); only a bracketed IPv6
literal becomes Host::Ipv6.
port: u16TCP port; 1935 (rtmp) or 443 (rtmps) when the URL has none.
tls: boolWhether the scheme is rtmps: the connection must run over TLS, which
the caller supplies (the tokio adapter’s AsyncRtmpClient::connect
opens plain TCP and refuses a TLS target).
app: StringThe RTMP app, percent-decoded (RFC 3986 §2.1).
stream_key: StringThe path remainder, percent-decoded (RFC 3986 §2.1), plus ?query kept
as written: the query is an opaque string the origin parses itself.
Implementations§
Source§impl RtmpTarget
impl RtmpTarget
Sourcepub fn parse(url: &str) -> Result<Self, RtmpUrlError>
pub fn parse(url: &str) -> Result<Self, RtmpUrlError>
Parses rtmp[s]://host[:port]/app/stream-key[?query]. The app is the
first path segment; the stream key is the rest of the path, with the
query appended as written. Path text is percent-decoded (RFC 3986
§2.1: a%20b names a b); a key that is only a query is no key.
Sourcepub fn from_parts(
base: &str,
app: &str,
stream_key: &str,
) -> Result<Self, RtmpUrlError>
pub fn from_parts( base: &str, app: &str, stream_key: &str, ) -> Result<Self, RtmpUrlError>
Host and port from base (any path/query is ignored), app and
stream_key given separately.
Sourcepub fn tc_url(&self) -> &str
pub fn tc_url(&self) -> &str
The RTMP tcUrl to send in the connect command:
rtmp[s]://host[:port]/app, IPv6 bracketed, userinfo/query/fragment
removed. Derived from host/port/tls/app, so it can never
disagree with them.
Sourcepub async fn resolve(&self) -> Result<Vec<SocketAddr>>
Available on crate feature tokio only.
pub async fn resolve(&self) -> Result<Vec<SocketAddr>>
tokio only.Resolved socket addresses (DNS only for Host::Domain).
Trait Implementations§
Source§impl Clone for RtmpTarget
impl Clone for RtmpTarget
Source§impl Debug for RtmpTarget
Manual Debug: the stream key (path remainder plus query) is the publish
secret and never renders (issue #1142).
impl Debug for RtmpTarget
Manual Debug: the stream key (path remainder plus query) is the publish
secret and never renders (issue #1142).