From c20e54aa7e13aa464b977a31fabf5a5fc7e2984c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Wala?= Date: Tue, 8 Aug 2023 15:36:54 +0200 Subject: [PATCH] Change project name to `Rel` --- Dockerfile | 4 ++-- README.md | 2 +- config/config.exs | 2 +- config/prod.exs | 2 +- config/runtime.exs | 8 +++---- docker-compose.yml | 2 +- lib/{ex_turn => rel}/allocation_handler.ex | 12 +++++----- .../attributes/additional-address-family.ex | 2 +- .../attributes/channel_number.ex | 2 +- lib/{ex_turn => rel}/attributes/data.ex | 2 +- lib/{ex_turn => rel}/attributes/even_port.ex | 2 +- lib/{ex_turn => rel}/attributes/lifetime.ex | 2 +- .../attributes/requested_address_family.ex | 2 +- .../attributes/requested_transport.ex | 2 +- .../attributes/reservation_token.ex | 2 +- .../attributes/xor_peer_address.ex | 2 +- .../attributes/xor_relayed_address.ex | 2 +- lib/{ex_turn => rel}/auth.ex | 12 +++++----- lib/{ex_turn => rel}/auth_provider.ex | 8 +++---- lib/{ex_turn => rel}/listener.ex | 20 ++++++++--------- lib/{ex_turn => rel}/monitor.ex | 2 +- lib/{ex_turn => rel}/supervisor.ex | 10 ++++----- lib/{ex_turn => rel}/utils.ex | 12 +++++----- lib/{ex_turn_app.ex => rel_app.ex} | 22 +++++++++---------- mix.exs | 6 ++--- prometheus.yml | 2 +- 26 files changed, 73 insertions(+), 73 deletions(-) rename lib/{ex_turn => rel}/allocation_handler.ex (97%) rename lib/{ex_turn => rel}/attributes/additional-address-family.ex (91%) rename lib/{ex_turn => rel}/attributes/channel_number.ex (92%) rename lib/{ex_turn => rel}/attributes/data.ex (93%) rename lib/{ex_turn => rel}/attributes/even_port.ex (93%) rename lib/{ex_turn => rel}/attributes/lifetime.ex (94%) rename lib/{ex_turn => rel}/attributes/requested_address_family.ex (91%) rename lib/{ex_turn => rel}/attributes/requested_transport.ex (92%) rename lib/{ex_turn => rel}/attributes/reservation_token.ex (91%) rename lib/{ex_turn => rel}/attributes/xor_peer_address.ex (95%) rename lib/{ex_turn => rel}/attributes/xor_relayed_address.ex (93%) rename lib/{ex_turn => rel}/auth.ex (88%) rename lib/{ex_turn => rel}/auth_provider.ex (87%) rename lib/{ex_turn => rel}/listener.ex (95%) rename lib/{ex_turn => rel}/monitor.ex (91%) rename lib/{ex_turn => rel}/supervisor.ex (55%) rename lib/{ex_turn => rel}/utils.ex (92%) rename lib/{ex_turn_app.ex => rel_app.ex} (66%) diff --git a/Dockerfile b/Dockerfile index cf8af11..1ceceb2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,6 @@ RUN apk add --no-cache --update libncursesw openssl libstdc++ WORKDIR /app -COPY --from=build /app/_build/prod/rel/ex_turn ./ +COPY --from=build /app/_build/prod/rel/rel ./ -CMD ["bin/ex_turn", "start"] +CMD ["bin/rel", "start"] diff --git a/README.md b/README.md index a7ee68a..141f009 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ExTURN +# Rel TURN server. diff --git a/config/config.exs b/config/config.exs index 9ba409c..7b54f26 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,6 +1,6 @@ import Config -config :ex_turn, +config :rel, # 1 day in seconds, see https://datatracker.ietf.org/doc/html/draft-uberti-rtcweb-turn-rest-00#section-2.2 credentials_lifetime: 24 * 60 * 60, # 10 minutes in seconds diff --git a/config/prod.exs b/config/prod.exs index 0608353..b73c529 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1,4 +1,4 @@ import Config # FIXME: temporary, as `:credentials_lifetime` is a compile time variable atm -config :ex_turn, :credentials_lifetime, 3 * 24 * 24 +config :rel, :credentials_lifetime, 3 * 24 * 24 diff --git a/config/runtime.exs b/config/runtime.exs index f42538a..0c1d464 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -101,7 +101,7 @@ external_relay_ip = end # AuthProvider/credentials configuration -config :ex_turn, +config :rel, auth_provider_ip: System.get_env("AUTH_PROVIDER_IP", "127.0.0.1") |> ConfigUtils.parse_ip_address(), auth_provider_port: System.get_env("AUTH_PROVIDER_PORT", "4000") |> ConfigUtils.parse_port(), @@ -110,7 +110,7 @@ config :ex_turn, certfile: certfile # TURN server configuration -config :ex_turn, +config :rel, listen_ip: listen_ip, external_listen_ip: external_listen_ip, relay_ip: relay_ip, @@ -119,11 +119,11 @@ config :ex_turn, domain_name: System.get_env("DOMAIN_NAME", "example.com") # Metrics endpoint configuration -config :ex_turn, +config :rel, metrics_ip: System.get_env("METRICS_IP", "127.0.0.1") |> ConfigUtils.parse_ip_address(), metrics_port: System.get_env("METRICS_PORT", "9568") |> ConfigUtils.parse_port() # Automatically generated secrets -config :ex_turn, +config :rel, auth_secret: :crypto.strong_rand_bytes(64), nonce_secret: :crypto.strong_rand_bytes(64) diff --git a/docker-compose.yml b/docker-compose.yml index 5d4199e..f92de52 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.2' services: turn: - image: ghcr.io/elixir-webrtc/ex_turn:${TAG} + image: ghcr.io/elixir-webrtc/rel:${TAG} container_name: turn restart: on-failure network_mode: host diff --git a/lib/ex_turn/allocation_handler.ex b/lib/rel/allocation_handler.ex similarity index 97% rename from lib/ex_turn/allocation_handler.ex rename to lib/rel/allocation_handler.ex index e41a354..b6a2d78 100644 --- a/lib/ex_turn/allocation_handler.ex +++ b/lib/rel/allocation_handler.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.AllocationHandler do +defmodule Rel.AllocationHandler do @moduledoc false use GenServer, restart: :transient @@ -7,15 +7,15 @@ defmodule ExTURN.AllocationHandler do alias ExSTUN.Message alias ExSTUN.Message.Type - alias ExTURN.Auth - alias ExTURN.Attribute.{ChannelNumber, Data, Lifetime, XORPeerAddress} - alias ExTURN.Utils + alias Rel.Auth + alias Rel.Attribute.{ChannelNumber, Data, Lifetime, XORPeerAddress} + alias Rel.Utils @type five_tuple() :: {:inet.ip_address(), :inet.port_number(), :inet.ip_address(), :inet.port_number(), :udp} - @permission_lifetime Application.compile_env!(:ex_turn, :permission_lifetime) - @channel_lifetime Application.compile_env!(:ex_turn, :channel_lifetime) + @permission_lifetime Application.compile_env!(:rel, :permission_lifetime) + @channel_lifetime Application.compile_env!(:rel, :channel_lifetime) @spec start_link(term()) :: GenServer.on_start() def start_link([five_tuple, alloc_socket | _rest] = args) do diff --git a/lib/ex_turn/attributes/additional-address-family.ex b/lib/rel/attributes/additional-address-family.ex similarity index 91% rename from lib/ex_turn/attributes/additional-address-family.ex rename to lib/rel/attributes/additional-address-family.ex index 03e3aa8..5b04efc 100644 --- a/lib/ex_turn/attributes/additional-address-family.ex +++ b/lib/rel/attributes/additional-address-family.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Attribute.AdditionalAddressFamily do +defmodule Rel.Attribute.AdditionalAddressFamily do @moduledoc false @behaviour ExSTUN.Message.Attribute diff --git a/lib/ex_turn/attributes/channel_number.ex b/lib/rel/attributes/channel_number.ex similarity index 92% rename from lib/ex_turn/attributes/channel_number.ex rename to lib/rel/attributes/channel_number.ex index 446d5a6..a557712 100644 --- a/lib/ex_turn/attributes/channel_number.ex +++ b/lib/rel/attributes/channel_number.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Attribute.ChannelNumber do +defmodule Rel.Attribute.ChannelNumber do @moduledoc false @behaviour ExSTUN.Message.Attribute diff --git a/lib/ex_turn/attributes/data.ex b/lib/rel/attributes/data.ex similarity index 93% rename from lib/ex_turn/attributes/data.ex rename to lib/rel/attributes/data.ex index d6e3ce1..efab1ac 100644 --- a/lib/ex_turn/attributes/data.ex +++ b/lib/rel/attributes/data.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Attribute.Data do +defmodule Rel.Attribute.Data do @moduledoc false @behaviour ExSTUN.Message.Attribute diff --git a/lib/ex_turn/attributes/even_port.ex b/lib/rel/attributes/even_port.ex similarity index 93% rename from lib/ex_turn/attributes/even_port.ex rename to lib/rel/attributes/even_port.ex index 7e22620..1656858 100644 --- a/lib/ex_turn/attributes/even_port.ex +++ b/lib/rel/attributes/even_port.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Attribute.EvenPort do +defmodule Rel.Attribute.EvenPort do @moduledoc false @behaviour ExSTUN.Message.Attribute diff --git a/lib/ex_turn/attributes/lifetime.ex b/lib/rel/attributes/lifetime.ex similarity index 94% rename from lib/ex_turn/attributes/lifetime.ex rename to lib/rel/attributes/lifetime.ex index 826b83d..2127eca 100644 --- a/lib/ex_turn/attributes/lifetime.ex +++ b/lib/rel/attributes/lifetime.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Attribute.Lifetime do +defmodule Rel.Attribute.Lifetime do @moduledoc false @behaviour ExSTUN.Message.Attribute diff --git a/lib/ex_turn/attributes/requested_address_family.ex b/lib/rel/attributes/requested_address_family.ex similarity index 91% rename from lib/ex_turn/attributes/requested_address_family.ex rename to lib/rel/attributes/requested_address_family.ex index 67451f2..78854b2 100644 --- a/lib/ex_turn/attributes/requested_address_family.ex +++ b/lib/rel/attributes/requested_address_family.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Attribute.RequestedAddressFamily do +defmodule Rel.Attribute.RequestedAddressFamily do @moduledoc false @behaviour ExSTUN.Message.Attribute diff --git a/lib/ex_turn/attributes/requested_transport.ex b/lib/rel/attributes/requested_transport.ex similarity index 92% rename from lib/ex_turn/attributes/requested_transport.ex rename to lib/rel/attributes/requested_transport.ex index 954f234..d8369e7 100644 --- a/lib/ex_turn/attributes/requested_transport.ex +++ b/lib/rel/attributes/requested_transport.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Attribute.RequestedTransport do +defmodule Rel.Attribute.RequestedTransport do @moduledoc false @behaviour ExSTUN.Message.Attribute diff --git a/lib/ex_turn/attributes/reservation_token.ex b/lib/rel/attributes/reservation_token.ex similarity index 91% rename from lib/ex_turn/attributes/reservation_token.ex rename to lib/rel/attributes/reservation_token.ex index 38d534a..6c2f604 100644 --- a/lib/ex_turn/attributes/reservation_token.ex +++ b/lib/rel/attributes/reservation_token.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Attribute.ReservationToken do +defmodule Rel.Attribute.ReservationToken do @moduledoc false @behaviour ExSTUN.Message.Attribute diff --git a/lib/ex_turn/attributes/xor_peer_address.ex b/lib/rel/attributes/xor_peer_address.ex similarity index 95% rename from lib/ex_turn/attributes/xor_peer_address.ex rename to lib/rel/attributes/xor_peer_address.ex index 40d230d..60eefbd 100644 --- a/lib/ex_turn/attributes/xor_peer_address.ex +++ b/lib/rel/attributes/xor_peer_address.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Attribute.XORPeerAddress do +defmodule Rel.Attribute.XORPeerAddress do @moduledoc """ STUN Message Attribute XOR Peer Address diff --git a/lib/ex_turn/attributes/xor_relayed_address.ex b/lib/rel/attributes/xor_relayed_address.ex similarity index 93% rename from lib/ex_turn/attributes/xor_relayed_address.ex rename to lib/rel/attributes/xor_relayed_address.ex index 78a065f..71a24ad 100644 --- a/lib/ex_turn/attributes/xor_relayed_address.ex +++ b/lib/rel/attributes/xor_relayed_address.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Attribute.XORRelayedAddress do +defmodule Rel.Attribute.XORRelayedAddress do @moduledoc false @behaviour ExSTUN.Message.Attribute diff --git a/lib/ex_turn/auth.ex b/lib/rel/auth.ex similarity index 88% rename from lib/ex_turn/auth.ex rename to lib/rel/auth.ex index 4acc649..c9c58b4 100644 --- a/lib/ex_turn/auth.ex +++ b/lib/rel/auth.ex @@ -1,16 +1,16 @@ -defmodule ExTURN.Auth do +defmodule Rel.Auth do @moduledoc false require Logger alias ExSTUN.Message alias ExSTUN.Message.Attribute.{MessageIntegrity, Nonce, Realm, Username} - @nonce_lifetime Application.compile_env!(:ex_turn, :nonce_lifetime) - @credentials_lifetime Application.compile_env!(:ex_turn, :credentials_lifetime) + @nonce_lifetime Application.compile_env!(:rel, :nonce_lifetime) + @credentials_lifetime Application.compile_env!(:rel, :credentials_lifetime) @spec authenticate(Message.t(), username: String.t()) :: {:ok, binary()} | {:error, atom()} def authenticate(%Message{} = msg, opts \\ []) do - auth_secret = Application.fetch_env!(:ex_turn, :auth_secret) + auth_secret = Application.fetch_env!(:rel, :auth_secret) with :ok <- verify_message_integrity(msg), {:ok, username, nonce} <- verify_attrs_presence(msg), @@ -64,7 +64,7 @@ defmodule ExTURN.Auth do |> :base64.decode() |> String.split(" ", parts: 2) - nonce_secret = Application.fetch_env!(:ex_turn, :nonce_secret) + nonce_secret = Application.fetch_env!(:rel, :nonce_secret) is_hash_valid? = hash == :crypto.hash(:sha256, "#{timestamp}:#{nonce_secret}") @@ -77,7 +77,7 @@ defmodule ExTURN.Auth do @spec generate_credentials(String.t() | nil) :: {username :: String.t(), password :: String.t(), ttl :: non_neg_integer()} def generate_credentials(username \\ nil) do - auth_secret = Application.fetch_env!(:ex_turn, :auth_secret) + auth_secret = Application.fetch_env!(:rel, :auth_secret) timestamp = System.os_time(:second) + @credentials_lifetime username = if is_nil(username), do: "#{timestamp}", else: "#{timestamp}:#{username}" diff --git a/lib/ex_turn/auth_provider.ex b/lib/rel/auth_provider.ex similarity index 87% rename from lib/ex_turn/auth_provider.ex rename to lib/rel/auth_provider.ex index 6e19c83..94ccecc 100644 --- a/lib/ex_turn/auth_provider.ex +++ b/lib/rel/auth_provider.ex @@ -1,11 +1,11 @@ -defmodule ExTURN.AuthProvider do +defmodule Rel.AuthProvider do @moduledoc false # REST service described in https://datatracker.ietf.org/doc/html/draft-uberti-rtcweb-turn-rest-00 use Plug.Router require Logger - alias ExTURN.Auth + alias Rel.Auth plug(CORSPlug) plug(:match) @@ -20,8 +20,8 @@ defmodule ExTURN.AuthProvider do username = Map.get(query_params, "username") {username, password, ttl} = Auth.generate_credentials(username) - ip_addr = Application.fetch_env!(:ex_turn, :external_listen_ip) - port = Application.fetch_env!(:ex_turn, :listen_port) + ip_addr = Application.fetch_env!(:rel, :external_listen_ip) + port = Application.fetch_env!(:rel, :listen_port) response = Jason.encode!(%{ diff --git a/lib/ex_turn/listener.ex b/lib/rel/listener.ex similarity index 95% rename from lib/ex_turn/listener.ex rename to lib/rel/listener.ex index d27e422..ec5499f 100644 --- a/lib/ex_turn/listener.ex +++ b/lib/rel/listener.ex @@ -1,10 +1,10 @@ -defmodule ExTURN.Listener do +defmodule Rel.Listener do @moduledoc false use Task, restart: :permanent require Logger - alias ExTURN.Attribute.{ + alias Rel.Attribute.{ EvenPort, Lifetime, RequestedAddressFamily, @@ -13,9 +13,9 @@ defmodule ExTURN.Listener do XORRelayedAddress } - alias ExTURN.AllocationHandler - alias ExTURN.Auth - alias ExTURN.Utils + alias Rel.AllocationHandler + alias Rel.Auth + alias Rel.Utils alias ExSTUN.Message alias ExSTUN.Message.Type @@ -46,7 +46,7 @@ defmodule ExTURN.Listener do ] ) - spawn(ExTURN.Monitor, :start, [self(), socket]) + spawn(Rel.Monitor, :start, [self(), socket]) recv_loop(socket, %{ listener_id: listener_addr, @@ -160,8 +160,8 @@ defmodule ExTURN.Listener do :ok <- check_even_port(even_port), {:ok, alloc_port} <- get_available_port(), {:ok, lifetime} <- Utils.get_lifetime(msg) do - relay_ip = Application.fetch_env!(:ex_turn, :relay_ip) - external_relay_ip = Application.fetch_env!(:ex_turn, :external_relay_ip) + relay_ip = Application.fetch_env!(:rel, :relay_ip) + external_relay_ip = Application.fetch_env!(:rel, :external_relay_ip) type = %Type{class: :success_response, method: msg.type.method} @@ -192,8 +192,8 @@ defmodule ExTURN.Listener do {:ok, alloc_pid} = DynamicSupervisor.start_child( - ExTURN.AllocationSupervisor, - {ExTURN.AllocationHandler, [five_tuple, alloc_socket, socket, username, lifetime]} + Rel.AllocationSupervisor, + {Rel.AllocationHandler, [five_tuple, alloc_socket, socket, username, lifetime]} ) :ok = :gen_udp.controlling_process(alloc_socket, alloc_pid) diff --git a/lib/ex_turn/monitor.ex b/lib/rel/monitor.ex similarity index 91% rename from lib/ex_turn/monitor.ex rename to lib/rel/monitor.ex index be0e27e..069ff6a 100644 --- a/lib/ex_turn/monitor.ex +++ b/lib/rel/monitor.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Monitor do +defmodule Rel.Monitor do @moduledoc false require Logger diff --git a/lib/ex_turn/supervisor.ex b/lib/rel/supervisor.ex similarity index 55% rename from lib/ex_turn/supervisor.ex rename to lib/rel/supervisor.ex index 8c100bb..71e92b3 100644 --- a/lib/ex_turn/supervisor.ex +++ b/lib/rel/supervisor.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Supervisor do +defmodule Rel.Supervisor do @moduledoc false use Supervisor @@ -9,13 +9,13 @@ defmodule ExTURN.Supervisor do @impl true def init(_arg) do - listen_ip = Application.fetch_env!(:ex_turn, :listen_ip) - listen_port = Application.fetch_env!(:ex_turn, :listen_port) + listen_ip = Application.fetch_env!(:rel, :listen_ip) + listen_port = Application.fetch_env!(:rel, :listen_port) children = [ - {DynamicSupervisor, strategy: :one_for_one, name: ExTURN.AllocationSupervisor}, + {DynamicSupervisor, strategy: :one_for_one, name: Rel.AllocationSupervisor}, {Registry, keys: :unique, name: Registry.Allocations}, - {ExTURN.Listener, [listen_ip, listen_port]} + {Rel.Listener, [listen_ip, listen_port]} ] Supervisor.init(children, strategy: :one_for_all) diff --git a/lib/ex_turn/utils.ex b/lib/rel/utils.ex similarity index 92% rename from lib/ex_turn/utils.ex rename to lib/rel/utils.ex index f3d09d6..ff9e419 100644 --- a/lib/ex_turn/utils.ex +++ b/lib/rel/utils.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.Utils do +defmodule Rel.Utils do @moduledoc false require Logger @@ -7,10 +7,10 @@ defmodule ExTURN.Utils do alias ExSTUN.Message.Type alias ExSTUN.Message.Attribute.{ErrorCode, Nonce, Realm} - alias ExTURN.Attribute.Lifetime + alias Rel.Attribute.Lifetime - @default_lifetime Application.compile_env!(:ex_turn, :default_allocation_lifetime) - @max_lifetime Application.compile_env!(:ex_turn, :max_allocation_lifetime) + @default_lifetime Application.compile_env!(:rel, :default_allocation_lifetime) + @max_lifetime Application.compile_env!(:rel, :max_allocation_lifetime) @spec get_lifetime(Message.t()) :: {:ok, integer()} | {:error, :invalid_lifetime} def get_lifetime(msg) do @@ -32,7 +32,7 @@ defmodule ExTURN.Utils do @spec build_error(atom(), integer(), Method.t()) :: {response :: binary(), log_msg :: String.t()} def build_error(reason, t_id, method) do - domain_name = Application.fetch_env!(:ex_turn, :domain_name) + domain_name = Application.fetch_env!(:rel, :domain_name) {log_msg, code, with_attrs?} = translate_error(reason) error_type = %Type{class: :error_response, method: method} @@ -55,7 +55,7 @@ defmodule ExTURN.Utils do defp build_nonce() do # inspired by https://datatracker.ietf.org/doc/html/rfc7616#section-5.4 - nonce_secret = Application.fetch_env!(:ex_turn, :nonce_secret) + nonce_secret = Application.fetch_env!(:rel, :nonce_secret) timestamp = System.monotonic_time(:nanosecond) hash = :crypto.hash(:sha256, "#{timestamp}:#{nonce_secret}") "#{timestamp} #{hash}" |> :base64.encode() diff --git a/lib/ex_turn_app.ex b/lib/rel_app.ex similarity index 66% rename from lib/ex_turn_app.ex rename to lib/rel_app.ex index f09e8b9..57b4608 100644 --- a/lib/ex_turn_app.ex +++ b/lib/rel_app.ex @@ -1,4 +1,4 @@ -defmodule ExTURN.App do +defmodule Rel.App do @moduledoc false use Application @@ -8,16 +8,16 @@ defmodule ExTURN.App do @impl true def start(_, _) do - Logger.info("Starting ExTURN v#{@version}") + Logger.info("Starting Rel v#{@version}") - auth_provider_ip = Application.fetch_env!(:ex_turn, :auth_provider_ip) - auth_provider_port = Application.fetch_env!(:ex_turn, :auth_provider_port) - use_tls? = Application.fetch_env!(:ex_turn, :auth_provider_use_tls?) - keyfile = Application.fetch_env!(:ex_turn, :keyfile) - certfile = Application.fetch_env!(:ex_turn, :certfile) + auth_provider_ip = Application.fetch_env!(:rel, :auth_provider_ip) + auth_provider_port = Application.fetch_env!(:rel, :auth_provider_port) + use_tls? = Application.fetch_env!(:rel, :auth_provider_use_tls?) + keyfile = Application.fetch_env!(:rel, :keyfile) + certfile = Application.fetch_env!(:rel, :certfile) - metrics_ip = Application.fetch_env!(:ex_turn, :metrics_ip) - metrics_port = Application.fetch_env!(:ex_turn, :metrics_port) + metrics_ip = Application.fetch_env!(:rel, :metrics_ip) + metrics_port = Application.fetch_env!(:rel, :metrics_port) scheme_opts = if use_tls? do @@ -31,11 +31,11 @@ defmodule ExTURN.App do end children = [ - ExTURN.Supervisor, + Rel.Supervisor, {TelemetryMetricsPrometheus, metrics: metrics(), plug_cowboy_opts: [ip: metrics_ip, port: metrics_port]}, {Bandit, - [plug: ExTURN.AuthProvider, ip: auth_provider_ip, port: auth_provider_port] ++ scheme_opts} + [plug: Rel.AuthProvider, ip: auth_provider_ip, port: auth_provider_port] ++ scheme_opts} ] Logger.info( diff --git a/mix.exs b/mix.exs index 55d05f4..66f06f3 100644 --- a/mix.exs +++ b/mix.exs @@ -1,9 +1,9 @@ -defmodule ExTurn.MixProject do +defmodule Rel.MixProject do use Mix.Project def project do [ - app: :ex_turn, + app: :rel, version: "0.1.0", elixir: "~> 1.15", start_permanent: Mix.env() == :prod, @@ -24,7 +24,7 @@ defmodule ExTurn.MixProject do # Run "mix help compile.app" to learn about applications. def application do [ - mod: {ExTURN.App, []}, + mod: {Rel.App, []}, extra_applications: [:logger, :crypto] ] end diff --git a/prometheus.yml b/prometheus.yml index 8e9ad82..2d3563d 100644 --- a/prometheus.yml +++ b/prometheus.yml @@ -10,7 +10,7 @@ global: # Here it's Prometheus itself. scrape_configs: # The job name is added as a label `job=` to any timeseries scraped from this config. - - job_name: 'ex_turn' + - job_name: 'rel' # Override the global default and scrape targets from this job every 5 seconds. scrape_interval: 1s