iroh_net::stun

Enum StunAttribute

Source
pub enum StunAttribute {
Show 16 variants Unknown(Unknown), AlternateServer(AlternateServer), ErrorCode(ErrorCode), Fingerprint(Fingerprint), MappedAddress(MappedAddress), MessageIntegrity(MessageIntegrity), MessageIntegritySha256(MessageIntegritySha256), Nonce(Nonce), PasswordAlgorithm(PasswordAlgorithm), PasswordAlgorithms(PasswordAlgorithms), Realm(Realm), Software(Software), UnknownAttributes(UnknownAttributes), UserHash(UserHash), UserName(UserName), XorMappedAddress(XorMappedAddress),
}
Expand description

STUN Attributes that can be attached to a StunMessage

Variants§

§

Unknown(Unknown)

The Unknownatribute

§

AlternateServer(AlternateServer)

The AlternateServeratribute

§

ErrorCode(ErrorCode)

The ErrorCodeatribute

§

Fingerprint(Fingerprint)

The Fingerprintatribute

§

MappedAddress(MappedAddress)

The MappedAddressatribute

§

MessageIntegrity(MessageIntegrity)

The MessageIntegrityatribute

§

MessageIntegritySha256(MessageIntegritySha256)

The MessageIntegritySha256atribute

§

Nonce(Nonce)

The Nonceatribute

§

PasswordAlgorithm(PasswordAlgorithm)

The PasswordAlgorithmatribute

§

PasswordAlgorithms(PasswordAlgorithms)

The PasswordAlgorithmsatribute

§

Realm(Realm)

The Realmatribute

§

Software(Software)

The Softwareatribute

§

UnknownAttributes(UnknownAttributes)

The UnknownAttributesatribute

§

UserHash(UserHash)

The UserHashatribute

§

UserName(UserName)

The UserNameatribute

§

XorMappedAddress(XorMappedAddress)

The XorMappedAddressatribute

Implementations§

Source§

impl StunAttribute

Source

pub fn attribute_type(&self) -> AttributeType

Returns the STUN attribute type of this instance.

Source

pub fn is_unknown(&self) -> bool

Returns true if this StunAttribute is Unknown

Source

pub fn as_unknown(&self) -> Result<&Unknown, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not Unknown

Source

pub fn expect_unknown(&self) -> &Unknown

Returns a reference to the Unknown attribute.

§Panics

Panics if the attribute is not an Unknown

Source

pub fn is_alternate_server(&self) -> bool

Returns true if this StunAttribute is AlternateServer

Source

pub fn as_alternate_server(&self) -> Result<&AlternateServer, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not AlternateServer

Source

pub fn expect_alternate_server(&self) -> &AlternateServer

Returns a reference to the AlternateServer attribute.

§Panics

Panics if the attribute is not an AlternateServer

Source

pub fn is_error_code(&self) -> bool

Returns true if this StunAttribute is ErrorCode

Source

pub fn as_error_code(&self) -> Result<&ErrorCode, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not ErrorCode

Source

pub fn expect_error_code(&self) -> &ErrorCode

Returns a reference to the ErrorCode attribute.

§Panics

Panics if the attribute is not an ErrorCode

Source

pub fn is_fingerprint(&self) -> bool

Returns true if this StunAttribute is Fingerprint

Source

pub fn as_fingerprint(&self) -> Result<&Fingerprint, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not Fingerprint

Source

pub fn expect_fingerprint(&self) -> &Fingerprint

Returns a reference to the Fingerprint attribute.

§Panics

Panics if the attribute is not an Fingerprint

Source

pub fn is_mapped_address(&self) -> bool

Returns true if this StunAttribute is MappedAddress

Source

pub fn as_mapped_address(&self) -> Result<&MappedAddress, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not MappedAddress

Source

pub fn expect_mapped_address(&self) -> &MappedAddress

Returns a reference to the MappedAddress attribute.

§Panics

Panics if the attribute is not an MappedAddress

Source

pub fn is_message_integrity(&self) -> bool

Returns true if this StunAttribute is MessageIntegrity

Source

pub fn as_message_integrity(&self) -> Result<&MessageIntegrity, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not MessageIntegrity

Source

pub fn expect_message_integrity(&self) -> &MessageIntegrity

Returns a reference to the MessageIntegrity attribute.

§Panics

Panics if the attribute is not an MessageIntegrity

Source

pub fn is_message_integrity_sha256(&self) -> bool

Returns true if this StunAttribute is MessageIntegritySha256

Source

pub fn as_message_integrity_sha256( &self, ) -> Result<&MessageIntegritySha256, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not MessageIntegritySha256

Source

pub fn expect_message_integrity_sha256(&self) -> &MessageIntegritySha256

Returns a reference to the MessageIntegritySha256 attribute.

§Panics

Panics if the attribute is not an MessageIntegritySha256

Source

pub fn is_nonce(&self) -> bool

Returns true if this StunAttribute is Nonce

Source

pub fn as_nonce(&self) -> Result<&Nonce, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not Nonce

Source

pub fn expect_nonce(&self) -> &Nonce

Returns a reference to the Nonce attribute.

§Panics

Panics if the attribute is not an Nonce

Source

pub fn is_password_algorithm(&self) -> bool

Returns true if this StunAttribute is PasswordAlgorithm

Source

pub fn as_password_algorithm(&self) -> Result<&PasswordAlgorithm, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not PasswordAlgorithm

Source

pub fn expect_password_algorithm(&self) -> &PasswordAlgorithm

Returns a reference to the PasswordAlgorithm attribute.

§Panics

Panics if the attribute is not an PasswordAlgorithm

Source

pub fn is_password_algorithms(&self) -> bool

Returns true if this StunAttribute is PasswordAlgorithms

Source

pub fn as_password_algorithms(&self) -> Result<&PasswordAlgorithms, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not PasswordAlgorithms

Source

pub fn expect_password_algorithms(&self) -> &PasswordAlgorithms

Returns a reference to the PasswordAlgorithms attribute.

§Panics

Panics if the attribute is not an PasswordAlgorithms

Source

pub fn is_realm(&self) -> bool

Returns true if this StunAttribute is Realm

Source

pub fn as_realm(&self) -> Result<&Realm, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not Realm

Source

pub fn expect_realm(&self) -> &Realm

Returns a reference to the Realm attribute.

§Panics

Panics if the attribute is not an Realm

Source

pub fn is_software(&self) -> bool

Returns true if this StunAttribute is Software

Source

pub fn as_software(&self) -> Result<&Software, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not Software

Source

pub fn expect_software(&self) -> &Software

Returns a reference to the Software attribute.

§Panics

Panics if the attribute is not an Software

Source

pub fn is_unknown_attributes(&self) -> bool

Returns true if this StunAttribute is UnknownAttributes

Source

pub fn as_unknown_attributes(&self) -> Result<&UnknownAttributes, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not UnknownAttributes

Source

pub fn expect_unknown_attributes(&self) -> &UnknownAttributes

Returns a reference to the UnknownAttributes attribute.

§Panics

Panics if the attribute is not an UnknownAttributes

Source

pub fn is_user_hash(&self) -> bool

Returns true if this StunAttribute is UserHash

Source

pub fn as_user_hash(&self) -> Result<&UserHash, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not UserHash

Source

pub fn expect_user_hash(&self) -> &UserHash

Returns a reference to the UserHash attribute.

§Panics

Panics if the attribute is not an UserHash

Source

pub fn is_user_name(&self) -> bool

Returns true if this StunAttribute is UserName

Source

pub fn as_user_name(&self) -> Result<&UserName, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not UserName

Source

pub fn expect_user_name(&self) -> &UserName

Returns a reference to the UserName attribute.

§Panics

Panics if the attribute is not an UserName

Source

pub fn is_xor_mapped_address(&self) -> bool

Returns true if this StunAttribute is XorMappedAddress

Source

pub fn as_xor_mapped_address(&self) -> Result<&XorMappedAddress, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not XorMappedAddress

Source

pub fn expect_xor_mapped_address(&self) -> &XorMappedAddress

Returns a reference to the XorMappedAddress attribute.

§Panics

Panics if the attribute is not an XorMappedAddress

Trait Implementations§

Source§

impl Clone for StunAttribute

Source§

fn clone(&self) -> StunAttribute

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 Debug for StunAttribute

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<AlternateServer> for StunAttribute

Source§

fn from(value: AlternateServer) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<ErrorCode> for StunAttribute

Source§

fn from(value: ErrorCode) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<Fingerprint> for StunAttribute

Source§

fn from(value: Fingerprint) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<MappedAddress> for StunAttribute

Source§

fn from(value: MappedAddress) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<MessageIntegrity> for StunAttribute

Source§

fn from(value: MessageIntegrity) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<MessageIntegritySha256> for StunAttribute

Source§

fn from(value: MessageIntegritySha256) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<Nonce> for StunAttribute

Source§

fn from(value: Nonce) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<PasswordAlgorithm> for StunAttribute

Source§

fn from(value: PasswordAlgorithm) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<PasswordAlgorithms> for StunAttribute

Source§

fn from(value: PasswordAlgorithms) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<Realm> for StunAttribute

Source§

fn from(value: Realm) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<Software> for StunAttribute

Source§

fn from(value: Software) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<Unknown> for StunAttribute

Source§

fn from(value: Unknown) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<UnknownAttributes> for StunAttribute

Source§

fn from(value: UnknownAttributes) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<UserHash> for StunAttribute

Source§

fn from(value: UserHash) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<UserName> for StunAttribute

Source§

fn from(value: UserName) -> StunAttribute

Converts to this type from the input type.
Source§

impl From<XorMappedAddress> for StunAttribute

Source§

fn from(value: XorMappedAddress) -> StunAttribute

Converts to this type from the input type.

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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, dst: *mut u8)

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

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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<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.
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
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T