SaltDns.Edges (Salt v1.0.0)

Which servers serve this installation's zones, and whether they are up to date. Read only.

The edges are what the primary Knot's configuration says it notifies (SaltDns.Knot.edges/0: the remotes of the notify group, by default knot-edge). For each edge address and each active zone probe/2 asks the edge itself for the zone's SOA, over the network, and compares the serial with the primary's:

  • :current - the same serial
  • :behind - an older serial (a change is on its way, or the transfer is stuck)
  • :ahead - a newer serial than the primary reports (the primary was just changed, or was restored from an older copy)
  • :no_answer - no usable answer in time (down, firewalled, or the zone is not there yet); :refused and :servfail are reported as such
  • :unchecked - this host has no route for the address's family (Salt itself has no IPv6, for example), so the address was not asked at all. That is not a verdict on the edge, and it is deliberately not :no_answer; give Salt a route for the family to check it.

The probe is the same question a resolver asks. It needs no key and changes nothing. The asker is configurable for tests with config :salt_dns, :edge_prober, Module (a module with soa_serial/3).

Summary

Types

A server that answers for the zones: what the primary's Knot configuration says (:remote, the addresses it notifies and transfers to) and what the names customers delegate to resolve to (:delegation, the A and AAAA addresses of SALT_DNS_NAMESERVERS). roles says which is which per address.

Functions

The servers to probe: the edges in the primary's configuration, plus every address the delegated names resolve to (so an IPv6 address that Knot does not transfer to is asked as well). An address of a delegated name that is also an edge's address belongs to that edge; any other address of the name joins it when one of its addresses is a known edge, otherwise the name is a server of its own. {:error, reason} when the configuration cannot be read.

How many zones one probe asks about at most.

Probes every address of every edge for each active zone in zones (at most max_zones/0, in the order given). Returns one row per zone.

The addresses (IPv4 then IPv6, as text) a name resolves to, looked up as the Name servers page looks up the names of the name servers: a full name with a final dot, bounded in time. A CNAME is followed. A name that does not resolve has none. Used by SaltDns.Certificates.Http01 to see where a host points.

The probe timeout per question, in milliseconds.

Types

address_result()

@type address_result() :: %{
  edge: String.t(),
  address: String.t(),
  serial: non_neg_integer() | nil,
  state:
    :current | :behind | :ahead | :no_answer | :refused | :servfail | :unchecked
}

row()

@type row() :: %{
  zone: String.t(),
  primary: non_neg_integer() | nil,
  results: [address_result()]
}

server()

@type server() :: %{
  id: String.t(),
  addresses: [String.t()],
  port: non_neg_integer(),
  names: [String.t()],
  roles: %{required(String.t()) => [:remote | :delegation]}
}

A server that answers for the zones: what the primary's Knot configuration says (:remote, the addresses it notifies and transfers to) and what the names customers delegate to resolve to (:delegation, the A and AAAA addresses of SALT_DNS_NAMESERVERS). roles says which is which per address.

Functions

edges()

@spec edges() :: {:ok, [server()]} | {:error, term()}

The servers to probe: the edges in the primary's configuration, plus every address the delegated names resolve to (so an IPv6 address that Knot does not transfer to is asked as well). An address of a delegated name that is also an edge's address belongs to that edge; any other address of the name joins it when one of its addresses is a known edge, otherwise the name is a server of its own. {:error, reason} when the configuration cannot be read.

max_zones()

@spec max_zones() :: pos_integer()

How many zones one probe asks about at most.

probe(edges, zones)

@spec probe([server() | SaltDns.Knot.edge()], [SaltDns.Zones.Zone.t()]) :: [row()]

Probes every address of every edge for each active zone in zones (at most max_zones/0, in the order given). Returns one row per zone.

resolve(name)

@spec resolve(String.t()) :: [String.t()]

The addresses (IPv4 then IPv6, as text) a name resolves to, looked up as the Name servers page looks up the names of the name servers: a full name with a final dot, bounded in time. A CNAME is followed. A name that does not resolve has none. Used by SaltDns.Certificates.Http01 to see where a host points.

timeout()

@spec timeout() :: pos_integer()

The probe timeout per question, in milliseconds.