Files
firezone/elixir/apps/api/lib/api/client/views/interface.ex
bmanifold 043cd555aa Update DNS portal config (#2432)
Why:

* After further discussion around the Client DNS settings, it was
decided that keeping both `type` and `address` would be easier to help
with validation and parsing. At the moment, only IP DNS servers are
accepted, but placeholders for `DNS over TLS` and `DNS over HTTPS` have
been created.
2023-10-20 21:16:45 +00:00

21 lines
523 B
Elixir

defmodule API.Client.Views.Interface do
alias Domain.Clients
alias Domain.Config.Configuration.ClientsUpstreamDNS
def render(%Clients.Client{} = client) do
upstream_dns =
Clients.fetch_client_config!(client)
|> Keyword.fetch!(:upstream_dns)
|> Enum.map(fn dns_config ->
addr = ClientsUpstreamDNS.normalize_dns_address(dns_config)
%{dns_config | address: addr}
end)
%{
upstream_dns: upstream_dns,
ipv4: client.ipv4,
ipv6: client.ipv6
}
end
end