Skip to main content

Event

Enum Event 

Source
#[non_exhaustive]
pub enum Event {
Show 17 variants TransactionTimeout(TransactionId), BindingResponse(TransactionId, ReflexiveAddr), BindingError(TransactionId, Error), AllocateResponse(TransactionId, RelayedAddr), AllocateError(TransactionId, RequestError), CreatePermissionResponse(TransactionId, PeerAddr), CreatePermissionError(TransactionId, RequestError), AllocationLost(RelayedAddr, RequestError), AllocationReleased(RelayedAddr), RefreshError(RelayedAddr, RequestError), PermissionLost(RelayedAddr, IpAddr, RequestError), ConnectResponse(TransactionId, PeerAddr, ConnectionId), ConnectError(TransactionId, PeerAddr, RequestError), ConnectionAttempt(RelayedAddr, PeerAddr, ConnectionId), IcmpError(PeerAddr, Icmp), ChannelBindError(RelayedAddr, PeerAddr, RequestError), DataIndicationOrChannelData(Option<ChannelNumber>, PeerAddr, BytesMut),
}
Expand description

What the client produces in response to inbound datagrams and elapsed time.

A variant that answers a request the caller made carries the TransactionId that request returned, so responses can be matched to requests. A variant about an allocation as a whole (lost, released, a refresh or a channel bind the client made by itself) names the allocation by its relayed address instead.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

TransactionTimeout(TransactionId)

A request exhausted its retransmissions without a response.

A request whose every response was discarded for its integrity, or whose response carried attributes the client must but does not understand, does not end here: it is reported by the error event of its kind (Event::AllocateError, Event::RefreshError, …) with RequestError::Failed, an ErrIntegrityMismatch in the first case (RFC 8489 §9.2.5: an integrity violation is not a timeout).

§

BindingResponse(TransactionId, ReflexiveAddr)

A STUN Binding succeeded, reporting this client’s server-reflexive address.

§

BindingError(TransactionId, Error)

A STUN Binding failed.

§

AllocateResponse(TransactionId, RelayedAddr)

An Allocate succeeded; the relayed address is now usable.

§

AllocateError(TransactionId, RequestError)

An Allocate failed — commonly authentication, or the server being out of ports. The error carries the server’s code (RFC 8656 §7.4 says what each one asks of the client).

§

CreatePermissionResponse(TransactionId, PeerAddr)

A CreatePermission succeeded; the relay will now forward to and from this peer.

§

CreatePermissionError(TransactionId, RequestError)

A CreatePermission failed; there is no permission for the peer.

§

AllocationLost(RelayedAddr, RequestError)

The server no longer holds the allocation: it answered 437 (Allocation Mismatch) to a request for it (RFC 8656 §5), or the allocation’s lifetime ran out with no Refresh answered. The client has dropped it, with its permissions and channel bindings; Client::relay no longer finds it.

§

AllocationReleased(RelayedAddr)

An allocation the application released with Relay::close is done with: the server confirmed, no longer had it, or never answered.

§

RefreshError(RelayedAddr, RequestError)

A Refresh of the allocation failed. The allocation is kept and refreshed again while its lifetime lasts; Event::AllocationLost follows if that runs out.

§

PermissionLost(RelayedAddr, IpAddr, RequestError)

The server refused to refresh the permission for a peer’s IP address. The client has dropped it: nothing is sent to that address until a new permission is created.

§

ConnectResponse(TransactionId, PeerAddr, ConnectionId)

A Connect succeeded: the server has a TCP connection to the peer, named by the CONNECTION-ID (RFC 6062 §4.3). The application now opens a new TCP connection to the server and binds it with Relay::data_connection; the server gives it 30 seconds.

§

ConnectError(TransactionId, PeerAddr, RequestError)

A Connect failed. After a 447 (Connection Timeout or Failure) the same peer can be tried again, ten seconds later at the earliest.

§

ConnectionAttempt(RelayedAddr, PeerAddr, ConnectionId)

A peer with a permission connected to the relayed address of a TCP allocation (RFC 6062 §4.4). To accept, the application opens a new TCP connection to the server and binds it with Relay::data_connection within 30 seconds; to refuse, it does nothing.

§

IcmpError(PeerAddr, Icmp)

A datagram the server relayed to this peer was answered with an ICMP error, for example “fragmentation needed” with the path MTU after a send with DONT-FRAGMENT (RFC 8656 §11.6). The peer address tells whether the type and code are ICMPv4 or ICMPv6.

§

ChannelBindError(RelayedAddr, PeerAddr, RequestError)

A ChannelBind for a peer failed. Data to it keeps going as Send indications, and the bind is tried again later. After a 437, or a 400 (the channels of client and server are out of step, RFC 8656 §12.3), Event::AllocationLost follows.

§

DataIndicationOrChannelData(Option<ChannelNumber>, PeerAddr, BytesMut)

Data arrived from a peer through the relay.

The channel number is Some when it came as ChannelData and None when it came as a Data indication.

Trait Implementations§

Source§

impl Debug for Event

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Event

§

impl !UnwindSafe for Event

§

impl Forget for Event

§

impl Freeze for Event
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, &'static str: Freeze, *const Error is !null: Freeze, PhantomData<Error>: Freeze, *const () is !null: Freeze, PhantomData<ErrorData<CustomOwner>>: Freeze, *const dyn Error + Sync + Send is !null: Freeze, PhantomData<dyn Error + Sync + Send>: Freeze, PhantomData<SocketAddr>: Freeze, PhantomData<AttrType>: Freeze, *mut Shared: Freeze,

§

impl Move for Event

§

impl Send for Event
where RawVecInner: Send, &'static str: Send, BoxRaw<Error>: Send, Repr: Send, BoxRaw<dyn Error + Sync + Send>: Send, BytesMut: Send,

§

impl Sync for Event
where RawVecInner: Sync, BoxRaw<Error>: Sync, Repr: Sync, BoxRaw<dyn Error + Sync + Send>: Sync, BytesMut: Sync,

§

impl Unpin for Event
where *const u8 is !null: Unpin, &'static str: Unpin, Box<Error>: Unpin, *const () is !null: Unpin, &'static SimpleMessage: Unpin, *const Custom is !null: Unpin, Box<dyn Error + Sync + Send>: Unpin, *mut Shared: Unpin,

§

impl UnsafeUnpin for Event

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.