Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 23 fields pub bind: SocketAddr, pub sent_by: String, pub sent_by_port: Option<u16>, pub timers: Timers, pub limits: Limits, pub capacity: usize, pub handshake_limit: usize, pub handshake_timeout: Duration, pub path_mtu: Option<usize>, pub cleartext: CleartextTransports, pub tls_client: Option<ClientTls>, pub tls_server: Option<(ServerTls, u16)>, pub quic_client: Option<ClientTls>, pub quic_server: Option<(ServerTls, u16)>, pub ws_server: Option<u16>, pub wss_server: Option<(ServerTls, u16)>, pub ws_keepalive: Duration, pub unanswered_limit: Duration, pub pool: PoolConfig, pub capture: Option<CaptureConfig>, pub overload: OverloadConfig, pub request_policy: Option<RequestPolicyRef>, pub source_admission_limit: usize,
}
Expand description

How an endpoint is configured.

Fields§

§bind: SocketAddr

Where to bind.

§sent_by: String

The host to put in Via sent-by.

Deliberately separate from the bind address: behind a NAT or a load balancer the two differ, and the socket’s view is the wrong one to advertise.

§sent_by_port: Option<u16>

The port to put in Via sent-by.

None — and Some(0), which means the same thing — is filled in with the port the socket actually got. Binding to port 0 asks the OS to choose one, and advertising the literal zero would tell peers to send responses to port 0.

§timers: Timers

Transaction timer constants.

§limits: Limits

Parser limits.

§capacity: usize

How many events may queue for the application before new transactions are refused.

§handshake_limit: usize

Most incomplete inbound TLS, WebSocket and secure-WebSocket handshakes at once.

§handshake_timeout: Duration

How long an inbound handshake may remain incomplete.

§path_mtu: Option<usize>

The known path MTU for outbound SIP, if one is available.

RFC 3261 §18.1.1 derives the unreliable-request limit as 200 bytes below this value. None uses the RFC’s 1300-byte unknown-path cutoff. This is a path property, not the already-derived limit, so there is only one implementation of the subtraction.

§cleartext: CleartextTransports

Which cleartext signalling listeners to expose.

§tls_client: Option<ClientTls>

How sipx behaves as a TLS client, if TLS is to be used at all.

§tls_server: Option<(ServerTls, u16)>

The identity sipx presents as a TLS server, and the port to listen on.

A separate port from the cleartext one, because RFC 3261 §19.1.2 gives sips its own default (5061) and a peer connecting to 5060 does not expect a handshake.

§quic_client: Option<ClientTls>

How sipx verifies an outbound QUIC peer.

§quic_server: Option<(ServerTls, u16)>

The identity and UDP port for the experimental QUIC listener.

§ws_server: Option<u16>

The port to listen for WebSocket connections on, if any.

Its own port for the same reason TLS has one: a peer connecting to 5060 expects SIP on the wire, not an HTTP upgrade request.

§wss_server: Option<(ServerTls, u16)>

The identity sipx presents on the secure WebSocket port, and the port.

§ws_keepalive: Duration

How often to ping an otherwise idle WebSocket.

Well under the idle timeout of the intermediaries that sit in front of browsers — most close a silent connection somewhere between 30 and 120 seconds, and a registration whose connection died silently is a phone that rings nowhere.

§unanswered_limit: Duration

How long a server transaction may receive no new application response before it is abandoned.

RFC 3261 §17.2 gives a server transaction in Trying or Proceeding no timer at all, because its model is that the transaction user always responds. Real applications do not, and a transaction nobody ever answers is held for the life of the process.

Configurable because three minutes is not long for a telephone. Each successfully sent provisional response starts a fresh interval; a final response removes the guard while the RFC transaction completes its own absorption lifetime.

§pool: PoolConfig

How the connection pool behaves.

§capture: Option<CaptureConfig>

Record the signalling this endpoint exchanges to a file (§13).

None — the default — costs one Option check per message and opens nothing. A capture contains call content and identities even after redaction; see CaptureConfig.

§overload: OverloadConfig

Hop-by-hop overload feedback, client advertisement, rate tolerance, prioritization, and randomness. Client advertisement is off by default; see OverloadConfig::advertise.

§request_policy: Option<RequestPolicyRef>

Optional immutable pre-transaction request policy.

§source_admission_limit: usize

Maximum number of IP/CIDR entries in one live source-admission generation.

Every admission check is a linear scan, so this is a work bound as well as a memory bound.

Implementations§

Source§

impl Config

Source

pub fn new(bind: SocketAddr) -> Self

A configuration bound to an address, advertising that same address.

If the bind address names port 0, the advertised port is the one the socket is actually given. Note that binding to an unspecified address (0.0.0.0) leaves nothing sensible to advertise; set Config::sent_by explicitly in that case.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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>,

Source§

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

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,