knafeh 1.1.0

QUIC-based RPC library with Python bindings
Documentation
use pyo3::prelude::*;

/// TLS configuration exposed to Python.
#[pyclass(name = "TlsConfig", from_py_object)]
#[derive(Clone)]
pub struct PyTlsConfig {
    pub(crate) inner: crate::transport::tls::TlsConfig,
}

#[pymethods]
impl PyTlsConfig {
    /// Create a server TLS config.
    #[staticmethod]
    fn server(cert_path: String, key_path: String) -> Self {
        Self {
            inner: crate::transport::tls::TlsConfig::server(cert_path, key_path),
        }
    }

    /// Create a client TLS config with CA verification.
    #[staticmethod]
    fn client(ca_path: String) -> Self {
        Self {
            inner: crate::transport::tls::TlsConfig::client(ca_path),
        }
    }

    /// Create an insecure client config (no server verification).
    #[staticmethod]
    fn client_insecure() -> Self {
        Self {
            inner: crate::transport::tls::TlsConfig::client_insecure(),
        }
    }
}