forked from lavina/lavina
1
0
Fork 0

xmpp: add the server's hostname to the config

This commit is contained in:
Nikita Vilunov 2024-04-05 12:18:57 +00:00
parent 36b0d50d51
commit 2ed70a4885
2 changed files with 4 additions and 2 deletions

View File

@ -9,6 +9,7 @@ server_name = "irc.localhost"
listen_on = "127.0.0.1:5222"
cert = "./certs/xmpp.pem"
key = "./certs/xmpp.key"
hostname = "localhost"
[storage]
db_path = "db.sqlite"

View File

@ -44,6 +44,7 @@ pub struct ServerConfig {
pub listen_on: SocketAddr,
pub cert: PathBuf,
pub key: PathBuf,
pub hostname: Str,
}
struct LoadedConfig {
@ -156,7 +157,7 @@ pub async fn launch(
}
async fn handle_socket(
config: Arc<LoadedConfig>,
cert_config: Arc<LoadedConfig>,
mut stream: TcpStream,
socket_addr: &SocketAddr,
mut players: PlayerRegistry,
@ -175,7 +176,7 @@ async fn handle_socket(
let mut config = tokio_rustls::rustls::ServerConfig::builder()
.with_safe_defaults()
.with_no_client_auth()
.with_single_cert(vec![config.cert.clone()], config.key.clone())?;
.with_single_cert(vec![cert_config.cert.clone()], cert_config.key.clone())?;
config.key_log = Arc::new(tokio_rustls::rustls::KeyLogFile::new());
log::debug!("Accepting TLS connection...");