MikrotikApi.Auth (mikrotik_api v0.3.4)

View Source

Authentication and request policy used per call alongside a target IP.

Construct once (credentials, TLS verification, timeouts, retry policy), then pass with a target IP to each API call.

Summary

Functions

Build an Auth struct.

Types

t()

@type t() :: %MikrotikApi.Auth{
  connect_timeout: non_neg_integer(),
  default_headers: [{binary(), binary()}],
  password: String.t(),
  recv_timeout: non_neg_integer(),
  retry: %{max_attempts: non_neg_integer(), backoff_ms: non_neg_integer()},
  ssl_opts: keyword(),
  username: String.t(),
  verify: :verify_peer | :verify_none
}

Functions

new(opts)

@spec new(Keyword.t()) :: t()

Build an Auth struct.

Options:

  • :username, :password (required)
  • :verify (:verify_peer | :verify_none) default :verify_peer

  • :recv_timeout (ms) default 15_000
  • :connect_timeout (ms) default 5_000
  • :retry (%{max_attempts, backoff_ms}) default %{max_attempts: 2, backoff_ms: 250}
  • :default_headers list of {key, value} binaries
  • :ssl_opts keyword passed to :ssl (e.g., cacerts, cacertfile, server_name_indication)