pub struct Endpoint { /* private fields */ }Expand description
The main entry point to the library
This object performs no I/O whatsoever. Instead, it generates a stream of packets to send via
poll_transmit, and consumes incoming packets and association-generated events via handle and
handle_event.
Implementations§
Source§impl Endpoint
impl Endpoint
Sourcepub fn new(
local_addr: SocketAddr,
transport_protocol: TransportProtocol,
endpoint_config: Arc<EndpointConfig>,
server_config: Option<Arc<ServerConfig>>,
) -> Self
pub fn new( local_addr: SocketAddr, transport_protocol: TransportProtocol, endpoint_config: Arc<EndpointConfig>, server_config: Option<Arc<ServerConfig>>, ) -> Self
Create a new endpoint
Returns Err if the configuration is invalid.
Sourcepub fn set_server_config(&mut self, server_config: Option<Arc<ServerConfig>>)
pub fn set_server_config(&mut self, server_config: Option<Arc<ServerConfig>>)
Replace the server configuration, affecting new incoming associations only
Sourcepub fn handle_event(&mut self, ch: AssociationHandle, event: EndpointEvent)
pub fn handle_event(&mut self, ch: AssociationHandle, event: EndpointEvent)
Process EndpointEvents emitted from related Associations
Sourcepub fn handle(
&mut self,
now: Instant,
remote: SocketAddr,
ecn: Option<EcnCodepoint>,
data: Bytes,
) -> Option<(AssociationHandle, DatagramEvent)>
pub fn handle( &mut self, now: Instant, remote: SocketAddr, ecn: Option<EcnCodepoint>, data: Bytes, ) -> Option<(AssociationHandle, DatagramEvent)>
Process an incoming UDP datagram
Sourcepub fn poll_transmit(&mut self) -> Option<TransportMessage<Payload>>
pub fn poll_transmit(&mut self) -> Option<TransportMessage<Payload>>
Returns a packet the endpoint itself has to send: the answer to a packet that belongs to none of its associations (RFC 9260 section 8.4: an ABORT or a SHUTDOWN COMPLETE that reflects the packet’s Verification Tag, or the ABORT that refuses an INIT).
To be polled after handle. An owner that never polls it sends no such
answers, which costs a peer that kept an association this side has lost nothing but
time: its retransmissions run out instead of being cut short.
Sourcepub fn connect(
&mut self,
now: Instant,
config: ClientConfig,
remote: SocketAddr,
) -> Result<(AssociationHandle, Association), ConnectError>
pub fn connect( &mut self, now: Instant, config: ClientConfig, remote: SocketAddr, ) -> Result<(AssociationHandle, Association), ConnectError>
Initiate an Association
Sourcepub fn reject_new_associations(&mut self)
pub fn reject_new_associations(&mut self)
Unconditionally reject future incoming associations
Sourcepub fn endpoint_config(&self) -> &EndpointConfig
pub fn endpoint_config(&self) -> &EndpointConfig
Access the configuration used by this endpoint