brand: per-SNI server/network identity (welcome, ISUPPORT NETWORK, numeric source prefix)
This commit is contained in:
parent
f36f803d42
commit
b6ada854cc
10 changed files with 153 additions and 27 deletions
14
src/tls.rs
14
src/tls.rs
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue