This commit is contained in:
MeexReay 2025-04-07 01:11:26 +03:00
parent 631025efdb
commit 903bf23a4c
2 changed files with 13 additions and 4 deletions

View File

@ -97,7 +97,7 @@ impl FlowgateServer {
let listener = TcpListener::bind(&config.read().await.https_host).await?;
let acceptor = TlsAcceptor::from(Arc::new(create_server_config(config.clone()).await));
info!("HTTPS server runned on {}", &config.read().await.http_host);
info!("HTTPS server runned on {}", &config.read().await.https_host);
loop {
let Ok((stream, addr)) = listener.accept().await else { break };
@ -117,7 +117,7 @@ impl FlowgateServer {
config,
&mut stream,
addr,
false
true
).await;
});
}

View File

@ -1,4 +1,4 @@
use std::sync::Arc;
use std::{sync::Arc, thread};
use rustls::{
crypto::aws_lc_rs::sign::any_supported_type,
@ -50,7 +50,16 @@ impl ResolvesServerCertWildcard {
impl ResolvesServerCert for ResolvesServerCertWildcard {
fn resolve(&self, client_hello: ClientHello<'_>) -> Option<Arc<CertifiedKey>> {
if let Some(cert) = client_hello.server_name()
.and_then(|name| self.handle.block_on(self.config.read()).get_site(name).cloned())
.and_then(|name| {
thread::spawn({
let handle = self.handle.clone();
let config = self.config.clone();
move || {
handle.block_on(config.read()).clone()
}
}).join().unwrap().get_site(name).cloned()
})
.and_then(|site| site.ssl) {
Some(Arc::new(cert.get_key()))
} else {