Skip to main content

Endpoint

Struct Endpoint 

Source
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

Source

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.

Source

pub fn set_server_config(&mut self, server_config: Option<Arc<ServerConfig>>)

Replace the server configuration, affecting new incoming associations only

Source

pub fn handle_event(&mut self, ch: AssociationHandle, event: EndpointEvent)

Process EndpointEvents emitted from related Associations

Source

pub fn handle( &mut self, now: Instant, remote: SocketAddr, ecn: Option<EcnCodepoint>, data: Bytes, ) -> Option<(AssociationHandle, DatagramEvent)>

Process an incoming UDP datagram

Source

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.

Source

pub fn connect( &mut self, now: Instant, config: ClientConfig, remote: SocketAddr, ) -> Result<(AssociationHandle, Association), ConnectError>

Initiate an Association

Source

pub fn reject_new_associations(&mut self)

Unconditionally reject future incoming associations

Source

pub fn endpoint_config(&self) -> &EndpointConfig

Access the configuration used by this endpoint

Trait Implementations§

Source§

impl Debug for Endpoint

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Endpoint

§

impl !UnwindSafe for Endpoint

§

impl Forget for Endpoint

§

impl Freeze for Endpoint
where *const u8 is !null: Freeze, PhantomData<(u32, AssociationHandle)>: Freeze, PhantomData<((SocketAddr, u16, u16), AssociationHandle)>: Freeze, PhantomData<Entry<AssociationMeta>>: Freeze, *const dyn AssociationIdGenerator is !null: Freeze, PhantomData<dyn AssociationIdGenerator>: Freeze, *const ArcInner<EndpointConfig> is !null: Freeze, PhantomData<ArcInner<EndpointConfig>>: Freeze, *const ArcInner<ServerConfig> is !null: Freeze, PhantomData<ArcInner<ServerConfig>>: Freeze, PhantomData<TransportMessage<Payload>>: Freeze, PhantomData<Arc<CookieSigner>>: Freeze,

§

impl Move for Endpoint

§

impl Send for Endpoint
where RawTable<(u32, AssociationHandle)>: Send, RawTable<((SocketAddr, u16, u16), AssociationHandle)>: Send, RawVecInner: Send, RawTable<(u64, u32)>: Send, Arc<Atomic<bool>>: Send, BoxRaw<dyn AssociationIdGenerator>: Send, Arc<EndpointConfig>: Send, Arc<ServerConfig>: Send, Bytes: Send, Arc<CookieSigner>: Send,

§

impl Sync for Endpoint
where RawTable<(u32, AssociationHandle)>: Sync, RawTable<((SocketAddr, u16, u16), AssociationHandle)>: Sync, RawVecInner: Sync, RawTable<(u64, u32)>: Sync, Arc<Atomic<bool>>: Sync, BoxRaw<dyn AssociationIdGenerator>: Sync, Arc<EndpointConfig>: Sync, Arc<ServerConfig>: Sync, Bytes: Sync, Arc<CookieSigner>: Sync,

§

impl Unpin for Endpoint
where *const u8 is !null: Unpin, Arc<Atomic<bool>>: Unpin, Box<dyn AssociationIdGenerator>: Unpin, Arc<EndpointConfig>: Unpin, Arc<ServerConfig>: Unpin, *const u8: Unpin, Align8<*mut ()>: Unpin, &'static Vtable: Unpin, Arc<CookieSigner>: Unpin,

§

impl UnsafeUnpin for Endpoint

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, 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.