erldns (erldns v11.2.0)

View Source

Convenience API to start erldns directly.

Summary

Functions

Start the DNS listeners if they were not started at boot.

Stop the DNS listeners, closing the sockets they bind.

Types

keyset()

-type keyset() ::
          #keyset{key_signing_key :: dynamic(),
                  key_signing_key_tag :: non_neg_integer(),
                  key_signing_alg :: non_neg_integer(),
                  zone_signing_key :: dynamic(),
                  zone_signing_key_tag :: non_neg_integer(),
                  zone_signing_alg :: non_neg_integer(),
                  inception :: integer(),
                  valid_until :: integer()}.

zone()

-type zone() ::
          #zone{labels :: dns:labels(),
                reversed_labels :: dns:labels(),
                name :: dns:dname(),
                version :: erldns_zones:version(),
                authority :: dns:authority(),
                record_count :: non_neg_integer(),
                records :: [dns:rr()],
                keysets :: [erldns:keyset()]}.

Functions

start()

-spec start() -> term().

start_listeners()

-spec start_listeners() -> supervisor:startchild_ret().

Start the DNS listeners if they were not started at boot.

When erldns is configured with the autostart_listeners application environment set to false, the listeners (and the sockets they bind) are not started during boot. An embedding application can then call this once its own resources are ready, so no query is served before they exist. Also brings the listeners back after stop_listeners/0.

Returns the supervisor child start result. Idempotent: returns {error, {already_started, _}} when the listeners are already running.

stop_listeners()

-spec stop_listeners() -> ok | {error, not_found}.

Stop the DNS listeners, closing the sockets they bind.

The mirror of start_listeners/0: an embedding application can call this before tearing down the resources its pipeline stages depend on, so no query is served once they are gone. Queries in flight are terminated along with the listeners, they are not drained.

Returns {error, not_found} when the listeners were never started. Idempotent: returns ok when they are already stopped.