pub struct ConnectionKey {
pub peer: SocketAddr,
pub transport: TransportKind,
pub identity: Option<Arc<str>>,
pub path: Option<Arc<str>>,
}Expand description
What makes two connections the same connection.
Not the address alone, and each of the other two fields earns its place.
The transport, because TCP, TLS and QUIC to one address are not interchangeable: a sips:
request riding a cleartext socket has silently become what it asked not to be. With
WebSocket in the mix the case stops being theoretical — WS and TCP can and do share a port.
The URI authority/verified identity, because two names resolving to one address are still
distinct TLS identities and distinct WebSocket HTTP authorities. Reusing one for another either
throws away certificate verification or sends traffic on an upgrade granted to a different
virtual host. None on a connection a peer opened: sipx selected no outbound authority.
The WebSocket resource, for the same reason one step down: a socket upgraded at /ws was
accepted by whatever serves /ws, and handing it traffic that asked for /other ignores the
only thing the target said about where it wanted to go. None everywhere the question does
not arise — every other transport, and every connection a peer opened.
Fields§
§peer: SocketAddrThe far end.
transport: TransportKindWhich transport it speaks.
identity: Option<Arc<str>>Original URI host: verified for TLS/WSS and used as authority for WS/WSS.
path: Option<Arc<str>>The resource the upgrade asked for, for WebSocket connections sipx opened.
Implementations§
Source§impl ConnectionKey
impl ConnectionKey
Sourcepub fn new(peer: SocketAddr, transport: TransportKind) -> Self
pub fn new(peer: SocketAddr, transport: TransportKind) -> Self
A connection with nothing verified about it and no resource named — anything a peer opened, and every cleartext transport.
Trait Implementations§
Source§impl Clone for ConnectionKey
impl Clone for ConnectionKey
Source§fn clone(&self) -> ConnectionKey
fn clone(&self) -> ConnectionKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConnectionKey
impl Debug for ConnectionKey
Source§impl Hash for ConnectionKey
impl Hash for ConnectionKey
Source§impl PartialEq for ConnectionKey
impl PartialEq for ConnectionKey
Source§fn eq(&self, other: &ConnectionKey) -> bool
fn eq(&self, other: &ConnectionKey) -> bool
self and other values to be equal, and is used by ==.impl Eq for ConnectionKey
impl StructuralPartialEq for ConnectionKey
Auto Trait Implementations§
impl Freeze for ConnectionKey
impl RefUnwindSafe for ConnectionKey
impl Send for ConnectionKey
impl Sync for ConnectionKey
impl Unpin for ConnectionKey
impl UnsafeUnpin for ConnectionKey
impl UnwindSafe for ConnectionKey
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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