defmodule GitGud.TestResolver do
@moduledoc """
DNS for `GitGud.OutboundUrl` under test — the suite runs without a
network. Names under `.internal.test` resolve to a private address,
`localhost` to loopback, `dual.test` to a public and a private one;
everything else gets a public documentation-free address.
"""
def resolve("localhost"), do: [{127, 0, 0, 1}]
def resolve("dual.test"), do: [{93, 184, 216, 34}, {10, 0, 0, 7}]
def resolve("nowhere.test"), do: []
def resolve(host) do
if String.ends_with?(host, ".internal.test"),
do: [{10, 1, 2, 3}],
else: [{93, 184, 216, 34}]
end
end
neiam
/gitgud
Git Gud
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
1
Log in to mark this repository.
627 B · text
History
49fdeb3