#[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
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.