brand: per-SNI server/network identity (welcome, ISUPPORT NETWORK, numeric source prefix)

This commit is contained in:
Jean Chevronnet 2026-08-24 23:29:15 +00:00
parent f36f803d42
commit b6ada854cc
No known key found for this signature in database
GPG key ID: 439666D63A9477E4
10 changed files with 153 additions and 27 deletions

View file

@ -46,6 +46,10 @@ pub trait TlsConn: Send {
fn tls_info(&self) -> Option<String> {
None
}
/// The SNI hostname the client requested during the TLS handshake, if any.
fn sni(&self) -> Option<String> {
None
}
}
/// A non-blocking TLS session the reactor drives itself over a mio socket. The
@ -79,6 +83,10 @@ pub trait TlsSession: Send {
fn tls_info(&self) -> Option<String> {
None
}
/// The SNI hostname the client requested during the TLS handshake, if any.
fn sni(&self) -> Option<String> {
None
}
fn shutdown(&mut self);
}
@ -258,6 +266,9 @@ impl TlsSession for OpensslSession {
fn tls_info(&self) -> Option<String> {
openssl_tls_info(self.0.ssl())
}
fn sni(&self) -> Option<String> {
self.0.ssl().servername(NameType::HOST_NAME).map(String::from)
}
fn shutdown(&mut self) {
// best-effort TLS close_notify, then close the socket. Non-blocking, so a
// WouldBlock just means the alert is queued — we don't wait for the peer's.
@ -292,4 +303,7 @@ impl TlsConn for OpensslConn {
fn tls_info(&self) -> Option<String> {
openssl_tls_info(self.0.ssl())
}
fn sni(&self) -> Option<String> {
self.0.ssl().servername(NameType::HOST_NAME).map(String::from)
}
}