Defdo.DDNS (defdo_ddns v0.5.0)

Copy Markdown

Public API for defdo_ddns when used as a dependency.

This module provides one-shot and monitored checkups, plus a small convenience surface for common DNS operations.

Summary

Functions

Returns API client credentials currently loaded in memory.

Runs a checkup through the monitor process if it is running. Falls back to a one-shot checkup when monitor is disabled.

Runs a one-shot checkup without requiring the monitor process.

Clears API client credentials from in-memory auth store.

Returns whether monitor startup is enabled in app config.

Returns whether the monitor process is currently running.

Replaces API client credentials in memory for multi-tenant-light auth mode.

Starts the monitor process manually.

Stops the monitor process if it is currently running.

Upserts a managed CNAME record using the internal DNS API logic.

Functions

api_clients(opts \\ [])

@spec api_clients(keyword()) :: %{optional(String.t()) => map()}

Returns API client credentials currently loaded in memory.

By default tokens are redacted. Use api_clients(redact: false) only for trusted, local debugging contexts.

checkup()

@spec checkup() :: list()

Runs a checkup through the monitor process if it is running. Falls back to a one-shot checkup when monitor is disabled.

checkup_once()

@spec checkup_once() :: list()

Runs a one-shot checkup without requiring the monitor process.

clear_api_clients()

@spec clear_api_clients() :: :ok | {:error, term()}

Clears API client credentials from in-memory auth store.

configured_domains()

See Defdo.Cloudflare.DDNS.get_all_cloudflare_config_domains/0.

get_current_ipv4()

See Defdo.Cloudflare.DDNS.get_current_ipv4/0.

get_current_ipv6()

See Defdo.Cloudflare.DDNS.get_current_ipv6/0.

monitor_enabled?()

@spec monitor_enabled?() :: boolean()

Returns whether monitor startup is enabled in app config.

monitor_running?()

@spec monitor_running?() :: boolean()

Returns whether the monitor process is currently running.

records_to_monitor(domain)

See Defdo.Cloudflare.DDNS.records_to_monitor/1.

set_api_clients(clients)

@spec set_api_clients(list()) :: :ok | {:error, term()}

Replaces API client credentials in memory for multi-tenant-light auth mode.

Expected format: [ %{

"id" => "client-id",
"token" => "secret-token",
"allowed_base_domains" => ["example.com"]

} ]

start_monitor(opts \\ [])

@spec start_monitor(keyword()) :: GenServer.on_start()

Starts the monitor process manually.

stop_monitor(timeout \\ 5000)

@spec stop_monitor(timeout()) :: :ok

Stops the monitor process if it is currently running.

upsert_free_domain(params)

@spec upsert_free_domain(map()) :: {:ok, map()} | {:error, term()}

Upserts a managed CNAME record using the internal DNS API logic.