pub struct SslManager { /* private fields */ }Expand description
Manages SSL certificates for the session.
Created once at session start; provides per-torrent TLS configs on demand.
Implementations§
Source§impl SslManager
impl SslManager
Sourcepub fn new(settings: &Settings) -> Result<Self>
pub fn new(settings: &Settings) -> Result<Self>
Create a new SSL manager from session settings.
If ssl_cert_path / ssl_key_path are set, loads them from disk.
Otherwise, generates a self-signed cert and optionally persists it
to resume_data_dir.
§Errors
Returns an error if the certificate or key material is missing or cannot be parsed.
Sourcepub fn from_pem(cert_pem: Vec<u8>, key_pem: Vec<u8>) -> Self
pub fn from_pem(cert_pem: Vec<u8>, key_pem: Vec<u8>) -> Self
Create an SSL manager from existing PEM bytes.
Sourcepub fn config_for_torrent(&self, ca_cert_pem: &[u8]) -> SslConfig
pub fn config_for_torrent(&self, ca_cert_pem: &[u8]) -> SslConfig
Build an SslConfig for a specific torrent (combines our cert with the torrent’s CA).
Sourcepub fn client_config(
&self,
ca_cert_pem: &[u8],
) -> Result<Arc<ClientConfig>, Error>
pub fn client_config( &self, ca_cert_pem: &[u8], ) -> Result<Arc<ClientConfig>, Error>
Build a rustls ClientConfig for outbound TLS connections to an SSL torrent.
§Errors
Returns an error if the rustls client configuration cannot be built.
Sourcepub fn server_config(
&self,
ca_cert_pem: &[u8],
) -> Result<Arc<ServerConfig>, Error>
pub fn server_config( &self, ca_cert_pem: &[u8], ) -> Result<Arc<ServerConfig>, Error>
Build a rustls ServerConfig for inbound TLS connections to an SSL torrent.
§Errors
Returns an error if the rustls server configuration cannot be built.