Struct domain::net::server::ConnectionConfig

source ·
pub struct ConnectionConfig<RequestOctets, Target> { /* private fields */ }
Available on crate features net and unstable-server-transport only.
Expand description

Configuration for a stream server connection.

Implementations§

source§

impl<RequestOctets, Target> Config<RequestOctets, Target>
where RequestOctets: Octets, Target: Composer + Default,

source

pub fn new() -> Self

Creates a new, default config.

source

pub fn set_idle_timeout(&mut self, value: Duration)

Set the limit on the amount of time to allow between client requests.

According to RFC 7766:

  • “A timeout of at least a few seconds is advisable for normal operations”.
  • “Servers MAY use zero timeouts when they are experiencing heavy load or are under attack”.
  • “Servers MAY allow idle connections to remain open for longer periods as resources permit”.

The value has to be between zero and 30 days with a default of 30 seconds. The default and minimum values are the same as those of the Unbound 1.19.2 tcp-idle-timeout configuration setting. The upper bound is a guess at something reasonable.

§Reconfigure

On StreamServer::reconfigure the current idle period will NOT be affected. Subsequent idle periods (after the next message is received or response is sent, assuming that happens within the current idle period) will use the new timeout value.

source

pub fn set_response_write_timeout(&mut self, value: Duration)

Set the limit on the amount of time to wait for writing a response to complete.

The value has to be between 1 millisecond and 1 hour with a default of 30 seconds. These values are guesses at something reasonable. The default is based on the Unbound 1.19.2 default value for its tcp-idle-timeout setting.

§Reconfigure

On StreamServer::reconfigure any responses currently being written will NOT use the new timeout, it will only apply to responses that start being sent after the timeout is changed.

source

pub fn set_max_queued_responses(&mut self, value: usize)

Set the limit on the number of DNS responses queued for writing to the client.

The value has to be between zero and 1,024. The default value is 10. These numbers are just a guess at something reasonable.

DNS response messages will be discarded if they cannot be queued for sending because the queue is full.

§Reconfigure

On StreamServer::reconfigure only new connections created after this setting is changed will use the new value, existing connections will continue to use their exisitng queue at its existing size.

source

pub fn set_middleware_chain( &mut self, value: MiddlewareChain<RequestOctets, Target> )

Set the middleware chain used to pre-process requests and post-process responses.

§Reconfigure

On StreamServer::reconfigure only new connections created after this setting is changed will use the new value, existing connections and in-flight requests (and their responses) will continue to use their current middleware chain.

Trait Implementations§

source§

impl<RequestOctets, Target> Clone for Config<RequestOctets, Target>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<RequestOctets, Target> Default for Config<RequestOctets, Target>
where RequestOctets: Octets, Target: Composer + Default,

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<RequestOctets, Target> Freeze for Config<RequestOctets, Target>

§

impl<RequestOctets, Target> !RefUnwindSafe for Config<RequestOctets, Target>

§

impl<RequestOctets, Target> Send for Config<RequestOctets, Target>

§

impl<RequestOctets, Target> Sync for Config<RequestOctets, Target>

§

impl<RequestOctets, Target> Unpin for Config<RequestOctets, Target>

§

impl<RequestOctets, Target> !UnwindSafe for Config<RequestOctets, Target>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<Source, Target> OctetsInto<Target> for Source
where Target: OctetsFrom<Source>,

§

type Error = <Target as OctetsFrom<Source>>::Error

source§

fn try_octets_into( self ) -> Result<Target, <Source as OctetsInto<Target>>::Error>

Performs the conversion.
source§

fn octets_into(self) -> Target
where Self::Error: Into<Infallible>,

Performs an infallible conversion.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more