Struct RelayConfig
#[non_exhaustive]pub struct RelayConfig {
pub url: Url,
pub tokens: Vec<Token>,
pub consume: bool,
}Expand description
How to attach to a media relay.
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.url: UrlThe media relay to dial: iroh://<endpoint-id>/<path> or https://host/<path>.
The path and query are the ones the session requests, such as a
ticket the media relay pulls. A jwt in the query is the connection
credential, ahead of tokens.
tokens: Vec<Token>The tokens the node presents to the media relay, the first as the connection credential.
Every dial presents them, in the MoQ SETUP and as ?jwt= in the URL,
since the SETUP of moq-lite-06 has no token field. Replace them on a
live link through RelayLink::tokens, before the old ones expire.
consume: boolWhether the media relay’s routes enter the node’s route table.
A node that only publishes through the media relay should turn this off.
Either way the media relay is offered every publication whose audience is
Granted, since a relay link’s grant
covers every path: publish to Peers to
keep a publication off it.
Implementations§
§impl RelayConfig
impl RelayConfig
pub fn new(url: Url) -> RelayConfig
pub fn new(url: Url) -> RelayConfig
Creates a config for the media relay at url, consuming what the media relay routes.
pub fn with_consume(self, consume: bool) -> RelayConfig
pub fn with_consume(self, consume: bool) -> RelayConfig
Returns this config with consume saying whether the media relay’s routes enter the route table.
See consume.
pub fn iroh(relay: PublicKey) -> RelayConfig
pub fn iroh(relay: PublicKey) -> RelayConfig
Creates a config for the media relay with endpoint id relay, dialed over iroh.
pub fn with_token(self, token: Token) -> RelayConfig
pub fn with_token(self, token: Token) -> RelayConfig
Presents token as the connection credential.
§Examples
use iroh_live_node::RelayConfig;
let relay = iroh::SecretKey::generate().public();
let token = "a.signed.jwt".parse().expect("not empty");
let config = RelayConfig::iroh(relay).with_token(token);
assert_eq!(config.tokens.len(), 1);Trait Implementations§
§impl Clone for RelayConfig
impl Clone for RelayConfig
§fn clone(&self) -> RelayConfig
fn clone(&self) -> RelayConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more