Current section
Files
Jump to
Current section
Files
lib/ipstack.ex
defmodule Ipstack do
@moduledoc """
Ipstack library
"""
defmodule Result do
@moduledoc false
@type t :: %__MODULE__{
country_code: String.t(),
region_code: String.t(),
city: String.t() | nil,
security: Ipstack.Result.Security.t()
}
defstruct country_code: nil,
region_code: nil,
city: nil,
security: nil
end
defmodule Result.Security do
@moduledoc false
@type t :: %__MODULE__{
is_tor?: boolean,
is_proxy?: boolean,
is_crawler?: boolean,
threat_level: :low | :medium | :high,
proxy_type: :cgi | :web | :vpn | nil
}
defstruct [:is_tor?, :is_proxy?, :is_crawler?, :threat_level, :proxy_type]
end
@callback resolve(String.t()) :: {:ok, map} | {:error | atom}
def resolve(ip_address) do
impl().resolve(ip_address)
end
defp impl, do: Application.fetch_env!(:ipstack, :impl)
end