3 ms·
I'm really not a fan of having a global TLS knob to turn in all Rust crates... that strikes me as heavy handed and inelegant. Why give a global configuration va
by hctaw 5y ago
I'm really not a fan of having a global TLS knob to turn in all Rust crates... that strikes me as heavy handed and inelegant. Why give a global configuration variable for something used by a tiny portion of crates? And what if a crate is incompatible with rustls? How do you express that with such a global knob in a sane way?
It's the wrong abstraction too - this is handled better by dynamic linkage. Rust just doesn't have a great dynamic library story (a C API/ABI is not exactly what I'm talking about here).
What you'd really want is a
trait TLS {
// ...
}
in some base tls crate and leave the implementation up to other crates. And any upstream dependency would require something like:
pub fn initialize <T: TLS> (tls:T) { ... }
- richardwhiuk 5y agohttps://crates.io/crates/native-tls/0.2.7 https://crates.io/crates/native-tls/0.2.7 provides this for native TLS implementations (which is what hyper-tls uses). It's pretty bare bones though, because to expose things through that, all of the underlying implementations need to support it.