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: SocketAddrWhere to bind.
sent_by: StringThe 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: TimersTransaction timer constants.
limits: LimitsParser limits.
capacity: usizeHow many events may queue for the application before new transactions are refused.
handshake_limit: usizeMost incomplete inbound TLS, WebSocket and secure-WebSocket handshakes at once.
handshake_timeout: DurationHow 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: CleartextTransportsWhich 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: DurationHow 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: DurationHow 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: PoolConfigHow 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: OverloadConfigHop-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: usizeMaximum 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
impl Config
Sourcepub fn new(bind: SocketAddr) -> Self
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§
Auto Trait Implementations§
impl Freeze for Config
impl !RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl !UnwindSafe for Config
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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