mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 10:18:54 +00:00
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.
21 lines
523 B
Elixir
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
|