refactor
This commit is contained in:
parent
16f63e16dc
commit
33b52309c7
1 changed files with 7 additions and 8 deletions
|
|
@ -105,22 +105,22 @@ where
|
||||||
|
|
||||||
#[cfg(feature = "http3")]
|
#[cfg(feature = "http3")]
|
||||||
async fn listener_service_h3(&self, mut server_crypto_rx: watch::Receiver<Option<Arc<ServerConfig>>>) -> Result<()> {
|
async fn listener_service_h3(&self, mut server_crypto_rx: watch::Receiver<Option<Arc<ServerConfig>>>) -> Result<()> {
|
||||||
|
info!("Start UDP proxy serving with HTTP/3 request for configured host names");
|
||||||
|
// first set as null config server
|
||||||
|
let server_crypto = ServerConfig::builder()
|
||||||
|
.with_safe_defaults()
|
||||||
|
.with_no_client_auth()
|
||||||
|
.with_cert_resolver(Arc::new(tokio_rustls::rustls::server::ResolvesServerCertUsingSni::new()));
|
||||||
|
|
||||||
let mut transport_config_quic = TransportConfig::default();
|
let mut transport_config_quic = TransportConfig::default();
|
||||||
transport_config_quic
|
transport_config_quic
|
||||||
.max_concurrent_bidi_streams(self.globals.h3_max_concurrent_bidistream)
|
.max_concurrent_bidi_streams(self.globals.h3_max_concurrent_bidistream)
|
||||||
.max_concurrent_uni_streams(self.globals.h3_max_concurrent_unistream);
|
.max_concurrent_uni_streams(self.globals.h3_max_concurrent_unistream);
|
||||||
|
|
||||||
let server_crypto = self
|
|
||||||
.globals
|
|
||||||
.backends
|
|
||||||
.generate_server_crypto_with_cert_resolver()
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
let mut server_config_h3 = QuicServerConfig::with_crypto(Arc::new(server_crypto));
|
let mut server_config_h3 = QuicServerConfig::with_crypto(Arc::new(server_crypto));
|
||||||
server_config_h3.transport = Arc::new(transport_config_quic);
|
server_config_h3.transport = Arc::new(transport_config_quic);
|
||||||
server_config_h3.concurrent_connections(self.globals.h3_max_concurrent_connections);
|
server_config_h3.concurrent_connections(self.globals.h3_max_concurrent_connections);
|
||||||
let (endpoint, mut incoming) = Endpoint::server(server_config_h3, self.listening_on)?;
|
let (endpoint, mut incoming) = Endpoint::server(server_config_h3, self.listening_on)?;
|
||||||
info!("Start UDP proxy serving with HTTP/3 request for configured host names");
|
|
||||||
|
|
||||||
let mut server_crypto: Option<Arc<ServerConfig>> = None;
|
let mut server_crypto: Option<Arc<ServerConfig>> = None;
|
||||||
loop {
|
loop {
|
||||||
|
|
@ -166,7 +166,6 @@ where
|
||||||
}
|
}
|
||||||
server_crypto = server_crypto_rx.borrow().clone();
|
server_crypto = server_crypto_rx.borrow().clone();
|
||||||
if server_crypto.is_some(){
|
if server_crypto.is_some(){
|
||||||
debug!("Reload server crypto");
|
|
||||||
endpoint.set_server_config(Some(QuicServerConfig::with_crypto(server_crypto.clone().unwrap())));
|
endpoint.set_server_config(Some(QuicServerConfig::with_crypto(server_crypto.clone().unwrap())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue