pub struct H3Server { /* private fields */ }
Available on crate feature
dns-over-h3
only.Expand description
A DNS-over-HTTP/3 Server, see H3ClientStream for the client counterpart
Implementations§
Source§impl H3Server
impl H3Server
Sourcepub async fn new(
name_server: SocketAddr,
cert: Vec<CertificateDer<'static>>,
key: PrivateKeyDer<'static>,
) -> Result<Self, ProtoError>
pub async fn new( name_server: SocketAddr, cert: Vec<CertificateDer<'static>>, key: PrivateKeyDer<'static>, ) -> Result<Self, ProtoError>
Construct the new Acceptor with the associated pkcs12 data
Sourcepub fn with_socket(
socket: UdpSocket,
cert: Vec<CertificateDer<'static>>,
key: PrivateKeyDer<'static>,
) -> Result<Self, ProtoError>
pub fn with_socket( socket: UdpSocket, cert: Vec<CertificateDer<'static>>, key: PrivateKeyDer<'static>, ) -> Result<Self, ProtoError>
Construct the new server with an existing socket
Sourcepub async fn accept(
&mut self,
) -> Result<Option<(H3Connection, SocketAddr)>, ProtoError>
pub async fn accept( &mut self, ) -> Result<Option<(H3Connection, SocketAddr)>, ProtoError>
Accept the next incoming connection.
§Returns
A remote connection that could accept many potential requests and the remote socket address
Sourcepub fn local_addr(&self) -> Result<SocketAddr, Error>
pub fn local_addr(&self) -> Result<SocketAddr, Error>
Returns the address this server is listening on
This can be useful in tests, where a random port can be associated with the server by binding on 127.0.0.1:0
and then getting the
associated port address with this function.
Auto Trait Implementations§
impl Freeze for H3Server
impl !RefUnwindSafe for H3Server
impl Send for H3Server
impl Sync for H3Server
impl Unpin for H3Server
impl !UnwindSafe for H3Server
Blanket Implementations§
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