pub struct Peering { /* private fields */ }Expand description
Our short-term credentials and the peer’s, and the two usernames they make (spec §11.2).
This type exists for one reason: the direction. A check sipx sends carries
<peer-ufrag>:<our-ufrag> and is keyed with the peer’s password; a check sipx
receives carries <our-ufrag>:<peer-ufrag> and is keyed with ours, as is the response
sipx sends back to it. Reverse the two and every check sipx sends is rejected for a bad
credential and every check it receives goes unanswered — which on the wire is
indistinguishable from a blocked path, so it gets diagnosed as a network fault and not as the
four transposed characters it is. Naming the four values rather than formatting a username at
each call site is what makes the mistake reviewable.
Implementations§
Source§impl Peering
impl Peering
Sourcepub const fn new(local: Credentials, remote: Credentials) -> Self
pub const fn new(local: Credentials, remote: Credentials) -> Self
Pair our credentials with the peer’s.
Sourcepub const fn local(&self) -> &Credentials
pub const fn local(&self) -> &Credentials
Our a=ice-ufrag and a=ice-pwd.
Sourcepub const fn remote(&self) -> &Credentials
pub const fn remote(&self) -> &Credentials
The peer’s.
Sourcepub fn outbound_username(&self) -> String
pub fn outbound_username(&self) -> String
The USERNAME on a check sipx sends: <peer-ufrag>:<our-ufrag>.
Sourcepub fn outbound_key(&self) -> &str
pub fn outbound_key(&self) -> &str
The key for a check sipx sends, and for the response it expects back: the peer’s password.
Sourcepub fn inbound_username(&self) -> String
pub fn inbound_username(&self) -> String
The USERNAME a check sipx receives must carry: <our-ufrag>:<peer-ufrag>.
Sourcepub fn inbound_key(&self) -> &str
pub fn inbound_key(&self) -> &str
The key for a check sipx receives, and for the response sipx sends to it: our password.
Trait Implementations§
impl Eq for Peering
impl StructuralPartialEq for Peering
Auto Trait Implementations§
impl Freeze for Peering
impl RefUnwindSafe for Peering
impl Send for Peering
impl Sync for Peering
impl Unpin for Peering
impl UnsafeUnpin for Peering
impl UnwindSafe for Peering
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