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 connections-generated events via handle and
handle_event.
Implementations§
Source§impl Endpoint
impl Endpoint
Sourcepub fn new(
local_addr: SocketAddr,
protocol: TransportProtocol,
server_config: Option<Arc<HandshakeConfig>>,
) -> Self
pub fn new( local_addr: SocketAddr, protocol: TransportProtocol, server_config: Option<Arc<HandshakeConfig>>, ) -> Self
Create a new endpoint
Returns Err if the configuration is invalid.
Sourcepub fn set_server_config(&mut self, server_config: Option<Arc<HandshakeConfig>>)
pub fn set_server_config(&mut self, server_config: Option<Arc<HandshakeConfig>>)
Replace the server configuration, affecting new incoming associations only
Sourcepub fn poll_transmit(&mut self) -> Option<TransportMessage<BytesMut>>
pub fn poll_transmit(&mut self) -> Option<TransportMessage<BytesMut>>
Get the next packet to transmit
Sourcepub fn get_connections_keys(&self) -> Keys<'_, SocketAddr, DTLSConn>
pub fn get_connections_keys(&self) -> Keys<'_, SocketAddr, DTLSConn>
Get keys of Connections
Sourcepub fn get_connection_state(&self, remote: SocketAddr) -> Option<&State>
pub fn get_connection_state(&self, remote: SocketAddr) -> Option<&State>
Get Connection State
Sourcepub fn connect(
&mut self,
remote: SocketAddr,
client_config: Arc<HandshakeConfig>,
initial_state: Option<State>,
) -> Result<()>
pub fn connect( &mut self, remote: SocketAddr, client_config: Arc<HandshakeConfig>, initial_state: Option<State>, ) -> Result<()>
Initiate an Association
Sourcepub fn stop(&mut self, remote: SocketAddr) -> Option<DTLSConn>
pub fn stop(&mut self, remote: SocketAddr) -> Option<DTLSConn>
Process stop remote
Sourcepub fn read(
&mut self,
now: Instant,
remote: SocketAddr,
ecn: Option<EcnCodepoint>,
data: BytesMut,
) -> Result<Vec<EndpointEvent>>
pub fn read( &mut self, now: Instant, remote: SocketAddr, ecn: Option<EcnCodepoint>, data: BytesMut, ) -> Result<Vec<EndpointEvent>>
Process an incoming UDP datagram
pub fn write(&mut self, remote: SocketAddr, data: &[u8]) -> Result<()>
pub fn handle_timeout(&mut self, remote: SocketAddr, now: Instant) -> Result<()>
pub fn poll_timeout(&self, remote: SocketAddr, eto: &mut Instant) -> Result<()>
Auto Trait Implementations§
impl !RefUnwindSafe for Endpoint
impl !UnwindSafe for Endpoint
impl Freeze for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl UnsafeUnpin for Endpoint
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.