Function create_agent

Source
pub(crate) fn create_agent(
    tls_security: ConnectionSecurity,
    max_idle_connections: Option<usize>,
    timeout_seconds: Option<u64>,
) -> Result<Agent, Error>
Expand description

Creates an [Agent] for the use in a NetHsm connection.

Takes a ConnectionSecurity to define the TLS security model for the connection. Allows setting the maximum idle connections per host using the optional max_idle_connections (defaults to available_parallelism and falls back to 100 if unavailable). Also allows setting the timeout in seconds for a successful socket connection using the optional timeout_seconds (defaults to 10).

ยงErrors

Returns an error if

  • the TLS client configuration can not be created,
  • ConnectionSecurity::Native is provided as tls_security, but no certification authority certificates are available on the system.