pub struct RelayConfig {
pub bind: SocketAddr,
pub enroll_token: String,
pub public_base: Option<String>,
}Expand description
Relay server settings.
Fields§
§bind: SocketAddrAddress to listen on.
enroll_token: StringSecret a device must present to attach.
public_base: Option<String>Public base URL of this relay, when the operator states it explicitly.
Left unset, the relay derives it from each connection’s Host (and
X-Forwarded-*) headers, so a relay behind TLS termination still tells
devices an address that actually works.
Implementations§
Source§impl RelayConfig
impl RelayConfig
Sourcepub fn new(bind: SocketAddr, enroll_token: impl Into<String>) -> Self
pub fn new(bind: SocketAddr, enroll_token: impl Into<String>) -> Self
Create a configuration with the given bind address and token.
Sourcepub fn with_public_base(self, base: impl Into<String>) -> Self
pub fn with_public_base(self, base: impl Into<String>) -> Self
Set the public base URL advertised to devices.
Sourcepub fn public_base_or(&self, observed: Option<String>) -> String
pub fn public_base_or(&self, observed: Option<String>) -> String
The base URL to advertise, preferring what the operator configured.
observed is what the connection itself says this relay is reachable at.
Falling back to the bind address is a last resort — it is right only when
nothing is in front of the relay.
Trait Implementations§
Source§impl Clone for RelayConfig
impl Clone for RelayConfig
Source§fn clone(&self) -> RelayConfig
fn clone(&self) -> RelayConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RelayConfig
impl RefUnwindSafe for RelayConfig
impl Send for RelayConfig
impl Sync for RelayConfig
impl Unpin for RelayConfig
impl UnsafeUnpin for RelayConfig
impl UnwindSafe for RelayConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.