diff --git a/lib/remote_ip.ex b/lib/remote_ip.ex index 5021627..b11a5d7 100644 --- a/lib/remote_ip.ex +++ b/lib/remote_ip.ex @@ -66,7 +66,8 @@ defmodule RemoteIp do def init(opts \\ []) do headers = Keyword.get(opts, :headers, @headers) headers = MapSet.new(headers) - proxies = Keyword.get(opts, :proxies, @proxies) ++ @reserved + reserved = Keyword.get(opts, :reserved, @reserved) + proxies = Keyword.get(opts, :proxies, @proxies) ++ reserved proxies = proxies |> Enum.map(&InetCidr.parse/1) {headers, proxies} @@ -75,7 +76,7 @@ defmodule RemoteIp do def call(conn, {headers, proxies}) do case last_forwarded_ip(conn, headers, proxies) do nil -> conn - ip -> %{conn | remote_ip: ip} + ip -> %{conn | remote_ip: ip} end end @@ -91,7 +92,7 @@ defmodule RemoteIp do defp last_ip_forwarded_through(ips, proxies) do ips - |> Enum.reverse + |> Enum.reverse() |> Enum.find(&forwarded?(&1, proxies)) end