Struct trust_dns_server::ServerFuture
source · [−]pub struct ServerFuture<T: RequestHandler> { /* private fields */ }
Expand description
A Futures based implementation of a DNS server
Implementations
sourceimpl<T: RequestHandler> ServerFuture<T>
impl<T: RequestHandler> ServerFuture<T>
sourcepub fn new(handler: T) -> ServerFuture<T>
pub fn new(handler: T) -> ServerFuture<T>
Creates a new ServerFuture with the specified Handler.
sourcepub fn register_socket(&mut self, socket: UdpSocket)
pub fn register_socket(&mut self, socket: UdpSocket)
Register a UDP socket. Should be bound before calling this function.
sourcepub fn register_socket_std(&mut self, socket: UdpSocket) -> Result<()>
pub fn register_socket_std(&mut self, socket: UdpSocket) -> Result<()>
Register a UDP socket. Should be bound before calling this function.
sourcepub fn register_listener(&mut self, listener: TcpListener, timeout: Duration)
pub fn register_listener(&mut self, listener: TcpListener, timeout: Duration)
Register a TcpListener to the Server. This should already be bound to either an IPv6 or an IPv4 address.
To make the server more resilient to DOS issues, there is a timeout. Care should be taken to not make this too low depending on use cases.
Arguments
listener
- a bound TCP sockettimeout
- timeout duration of incoming requests, any connection that does not send requests within this time period will be closed. In the future it should be possible to create long-lived queries, but these should be from trusted sources only, this would require some type of whitelisting.
sourcepub fn register_listener_std(
&mut self,
listener: TcpListener,
timeout: Duration
) -> Result<()>
pub fn register_listener_std(
&mut self,
listener: TcpListener,
timeout: Duration
) -> Result<()>
Register a TcpListener to the Server. This should already be bound to either an IPv6 or an IPv4 address.
To make the server more resilient to DOS issues, there is a timeout. Care should be taken to not make this too low depending on use cases.
Arguments
listener
- a bound TCP sockettimeout
- timeout duration of incoming requests, any connection that does not send requests within this time period will be closed. In the future it should be possible to create long-lived queries, but these should be from trusted sources only, this would require some type of whitelisting.
sourcepub fn register_tls_listener(
&mut self,
listener: TcpListener,
timeout: Duration,
certificate_and_key: (Vec<Certificate>, PrivateKey)
) -> Result<()>
This is supported on crate feature dns-over-rustls
only.
pub fn register_tls_listener(
&mut self,
listener: TcpListener,
timeout: Duration,
certificate_and_key: (Vec<Certificate>, PrivateKey)
) -> Result<()>
dns-over-rustls
only.Register a TlsListener to the Server. The TlsListener should already be bound to either an IPv6 or an IPv4 address.
To make the server more resilient to DOS issues, there is a timeout. Care should be taken to not make this too low depending on use cases.
Arguments
listener
- a bound TCP (needs to be on a different port from standard TCP connections) sockettimeout
- timeout duration of incoming requests, any connection that does not send requests within this time period will be closed. In the future it should be possible to create long-lived queries, but these should be from trusted sources only, this would require some type of whitelisting.pkcs12
- certificate used to announce to clients
sourcepub fn register_https_listener(
&mut self,
listener: TcpListener,
_timeout: Duration,
certificate_and_key: (Vec<Certificate>, PrivateKey),
dns_hostname: String
) -> Result<()>
This is supported on crate feature dns-over-https-rustls
only.
pub fn register_https_listener(
&mut self,
listener: TcpListener,
_timeout: Duration,
certificate_and_key: (Vec<Certificate>, PrivateKey),
dns_hostname: String
) -> Result<()>
dns-over-https-rustls
only.Register a TlsListener to the Server. The TlsListener should already be bound to either an IPv6 or an IPv4 address.
To make the server more resilient to DOS issues, there is a timeout. Care should be taken to not make this too low depending on use cases.
Arguments
listener
- a bound TCP (needs to be on a different port from standard TCP connections) sockettimeout
- timeout duration of incoming requests, any connection that does not send requests within this time period will be closed. In the future it should be possible to create long-lived queries, but these should be from trusted sources only, this would require some type of whitelisting.pkcs12
- certificate used to announce to clients
sourcepub async fn block_until_done(self) -> Result<(), ProtoError>
pub async fn block_until_done(self) -> Result<(), ProtoError>
This will run until all background tasks of the trust_dns_server end.
Auto Trait Implementations
impl<T> !RefUnwindSafe for ServerFuture<T>
impl<T> Send for ServerFuture<T>
impl<T> Sync for ServerFuture<T>
impl<T> Unpin for ServerFuture<T>
impl<T> !UnwindSafe for ServerFuture<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more