A DNS over HTTPS (DoH) client written in elixir.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dough/lib/dough.ex

49 lines
1.2 KiB

defmodule Dough do
@moduledoc false
use Application
import Supervisor.Spec
import Cachex.Spec
require Logger
def start(_type, _args) do
children = [
worker(Cachex, [
:dough,
[
expiration:
expiration(
default: :timer.seconds(6000),
interval: :timer.seconds(300),
lazy: true
)
]
]),
{Plug.Adapters.Cowboy2,
scheme: :https,
plug: Dough.Router,
options: [
port: 8331,
otp_app: :dough,
keyfile: "priv/ssl/localhost.key",
certfile: "priv/ssl/localhost.crt"
]}
]
Logger.info("
██▄ ████▄ ▄ ▄▀ ▄ █
█ █ █ █ █ ▄▀ █ █
█ █ █ █ █ █ █ ▀▄ ██▀▀█
█ █ ▀████ █ █ █ █ █ █
███▀ █▄ ▄█ ███ █
▀▀▀ ▀
Starting Dough Server #{Application.get_env(:dough, :current_version)} ...
DNS Proxying to #{Application.get_env(:dough, :dns_server)}
")
opts = [strategy: :one_for_one, name: Dough.Supervisor]
Supervisor.start_link(children, opts)
end
end