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
Sourcepub fn write(&mut self, remote: SocketAddr, data: &[u8]) -> Result<()>
pub fn write(&mut self, remote: SocketAddr, data: &[u8]) -> Result<()>
Queues application data for remote.
§Errors
Fails if there is no association with remote, or its handshake has not completed.
Sourcepub fn handle_timeout(&mut self, remote: SocketAddr, now: Instant) -> Result<()>
pub fn handle_timeout(&mut self, remote: SocketAddr, now: Instant) -> Result<()>
Advances remote’s association to now, driving handshake retransmissions.
§Errors
Fails if the handshake has exhausted its retransmissions.
Sourcepub fn poll_timeout(&self, remote: SocketAddr, eto: &mut Instant) -> Result<()>
pub fn poll_timeout(&self, remote: SocketAddr, eto: &mut Instant) -> Result<()>
When remote’s association next needs Self::handle_timeout.
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 = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<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
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>
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
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.