Struct quinn_proto::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 connection-generated events via handle
and
handle_event
.
Implementations§
source§impl Endpoint
impl Endpoint
sourcepub fn new(
config: Arc<EndpointConfig>,
server_config: Option<Arc<ServerConfig>>,
allow_mtud: bool
) -> Self
pub fn new( config: Arc<EndpointConfig>, server_config: Option<Arc<ServerConfig>>, allow_mtud: bool ) -> Self
Create a new endpoint
allow_mtud
enables path MTU detection when requested by Connection
configuration for
better performance. This requires that outgoing packets are never fragmented, which can be
achieved via e.g. the IPV6_DONTFRAG
socket option.
sourcepub fn poll_transmit(&mut self) -> Option<Transmit>
pub fn poll_transmit(&mut self) -> Option<Transmit>
Get the next packet to transmit
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 connections only
sourcepub fn handle_event(
&mut self,
ch: ConnectionHandle,
event: EndpointEvent
) -> Option<ConnectionEvent>
pub fn handle_event( &mut self, ch: ConnectionHandle, event: EndpointEvent ) -> Option<ConnectionEvent>
Process EndpointEvent
s emitted from related Connection
s
In turn, processing this event may return a ConnectionEvent
for the same Connection
.
sourcepub fn handle(
&mut self,
now: Instant,
remote: SocketAddr,
local_ip: Option<IpAddr>,
ecn: Option<EcnCodepoint>,
data: BytesMut
) -> Option<(ConnectionHandle, DatagramEvent)>
pub fn handle( &mut self, now: Instant, remote: SocketAddr, local_ip: Option<IpAddr>, ecn: Option<EcnCodepoint>, data: BytesMut ) -> Option<(ConnectionHandle, DatagramEvent)>
Process an incoming UDP datagram
sourcepub fn connect(
&mut self,
config: ClientConfig,
remote: SocketAddr,
server_name: &str
) -> Result<(ConnectionHandle, Connection), ConnectError>
pub fn connect( &mut self, config: ClientConfig, remote: SocketAddr, server_name: &str ) -> Result<(ConnectionHandle, Connection), ConnectError>
Initiate a connection
sourcepub fn set_socket_buffer_fill(&mut self, len: usize)
pub fn set_socket_buffer_fill(&mut self, len: usize)
Set the socket_buffer_fill
to the input len
sourcepub fn reject_new_connections(&mut self)
pub fn reject_new_connections(&mut self)
Reject new incoming connections without affecting existing connections
Convenience short-hand for using
set_server_config
to update
concurrent_connections
to
zero.
sourcepub fn config(&self) -> &EndpointConfig
pub fn config(&self) -> &EndpointConfig
Access the configuration used by this endpoint