pub struct Server { /* private fields */ }Expand description
A running iroh-dns server.
Combines a DNS listener and an HTTP/HTTPS listener into a single handle.
Construct with Self::bind and drive to completion with Self::join, or
stop the tasks with Self::shutdown.
Implementations§
Source§impl Server
impl Server
Sourcepub async fn bind(config: Config) -> Result<Self>
pub async fn bind(config: Config) -> Result<Self>
Binds and spawns the server from a Config.
Opens the persistent signed-packet store, enables the mainline DHT fallback when configured, and spawns the DNS, HTTP(S), and metrics tasks. Returns once all listeners are bound.
Sourcepub async fn shutdown(self) -> Result<()>
pub async fn shutdown(self) -> Result<()>
Cancels the server tasks and waits for them to complete.
Sourcepub async fn join(self) -> Result<()>
pub async fn join(self) -> Result<()>
Waits for the server tasks to complete.
Returns when a listener task finishes, either with success or an error.
Sourcepub fn dns_addr(&self) -> SocketAddr
pub fn dns_addr(&self) -> SocketAddr
Returns the local address that the DNS listener is bound to.
Sourcepub fn http_addr(&self) -> Option<SocketAddr>
pub fn http_addr(&self) -> Option<SocketAddr>
Returns the local address of the HTTP listener, or None if no HTTP
listener was configured.
Sourcepub fn https_addr(&self) -> Option<SocketAddr>
pub fn https_addr(&self) -> Option<SocketAddr>
Returns the local address of the HTTPS listener, or None if no HTTPS
listener was configured.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Server
impl !UnwindSafe for Server
impl Freeze for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnsafeUnpin for Server
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more