@@ -10,7 +10,7 @@ mod quinn_setup_utils {
1010 use anyhow:: Result ;
1111 use quinn:: { crypto:: rustls:: QuicClientConfig , ClientConfig , ServerConfig } ;
1212
13- /// Builds default quinn client config and trusts given certificates.
13+ /// Create a quinn client config and trusts given certificates.
1414 ///
1515 /// ## Args
1616 ///
@@ -52,6 +52,7 @@ mod quinn_setup_utils {
5252 Ok ( ( server_config, cert_der. to_vec ( ) ) )
5353 }
5454
55+ /// Create a quinn client config and trust all certificates.
5556 pub fn configure_client_insecure ( ) -> Result < ClientConfig > {
5657 let crypto = rustls:: ClientConfig :: builder ( )
5758 . dangerous ( )
@@ -85,16 +86,7 @@ mod quinn_setup_utils {
8586 Ok ( endpoint)
8687 }
8788
88- /// Create a server endpoint with a self-signed certificate
89- ///
90- /// Returns the server endpoint and the certificate in DER format
91- pub fn make_server_endpoint ( bind_addr : SocketAddr ) -> Result < ( Endpoint , Vec < u8 > ) > {
92- let ( server_config, server_cert) = configure_server ( ) ?;
93- let endpoint = Endpoint :: server ( server_config, bind_addr) ?;
94- Ok ( ( endpoint, server_cert) )
95- }
96-
97- /// Constructs a QUIC endpoint that trusts all certificates.
89+ /// Constructs a QUIC endpoint configured for use a client only that trusts all certificates.
9890 ///
9991 /// This is useful for testing and local connections, but should be used with care.
10092 pub fn make_insecure_client_endpoint ( bind_addr : SocketAddr ) -> Result < Endpoint > {
@@ -103,6 +95,15 @@ mod quinn_setup_utils {
10395 endpoint. set_default_client_config ( client_cfg) ;
10496 Ok ( endpoint)
10597 }
98+
99+ /// Constructs a QUIC server endpoint with a self-signed certificate
100+ ///
101+ /// Returns the server endpoint and the certificate in DER format
102+ pub fn make_server_endpoint ( bind_addr : SocketAddr ) -> Result < ( Endpoint , Vec < u8 > ) > {
103+ let ( server_config, server_cert) = configure_server ( ) ?;
104+ let endpoint = Endpoint :: server ( server_config, bind_addr) ?;
105+ Ok ( ( endpoint, server_cert) )
106+ }
106107 }
107108
108109 #[ cfg( not( target_arch = "wasm32" ) ) ]
0 commit comments