refactor: pass single ALPN around instead of ALPN list

This way there is always exactly one ALPN ("imap" or "smtp").
This commit is contained in:
link2xt
2024-07-28 14:42:42 +00:00
parent 354702fcab
commit 40d355209b
4 changed files with 14 additions and 14 deletions

View File

@@ -32,10 +32,10 @@ pub fn build_tls(strict_tls: bool, alpns: &[&str]) -> TlsConnector {
pub async fn wrap_tls<T: AsyncRead + AsyncWrite + Unpin>(
strict_tls: bool,
hostname: &str,
alpns: &[&str],
alpn: &str,
stream: T,
) -> Result<TlsStream<T>> {
let tls = build_tls(strict_tls, alpns);
let tls = build_tls(strict_tls, &[alpn]);
let tls_stream = tls.connect(hostname, stream).await?;
Ok(tls_stream)
}