pub struct Tls { /* private fields */ }Expand description
How a connection to the broker is secured.
Start from Tls::system_roots for a broker whose certificate a public authority
issued, or Tls::with_ca_pem for one whose certificate comes from an authority of its
own, and add client_certificate when the broker asks each
client to prove who it is.
§Examples
use pamoja_mqtt::{MqttConfig, Tls};
// A hosted broker with a publicly issued certificate, on the MQTT over TLS port.
let config = MqttConfig::new("sensor-1", "broker.example.com", 8883).tls(Tls::system_roots());
assert!(config.uses_tls());Implementations§
Source§impl Tls
impl Tls
Sourcepub fn system_roots() -> Tls
pub fn system_roots() -> Tls
Trusts the certificate authorities the operating system trusts.
§Returns
The TLS settings, presenting no client certificate.
Sourcepub fn with_ca_pem(pem: impl Into<Vec<u8>>) -> Tls
pub fn with_ca_pem(pem: impl Into<Vec<u8>>) -> Tls
Trusts only the certificate authorities in a PEM file.
A broker on a private network usually holds a certificate its operator issued, so the client trusts that operator’s authority and nothing else.
§Arguments
pem- one or moreCERTIFICATEblocks.
§Returns
The TLS settings, presenting no client certificate.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tls
impl RefUnwindSafe for Tls
impl Send for Tls
impl Sync for Tls
impl Unpin for Tls
impl UnsafeUnpin for Tls
impl UnwindSafe for Tls
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more