Skip to content

Commit

Permalink
Merge pull request #30 from firezone/fix/extract-ip
Browse files Browse the repository at this point in the history
extract IP
  • Loading branch information
AndrewDryga authored Jul 17, 2024
2 parents 2e2a483 + 1445236 commit 745351b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/probe/controllers/run.ex
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,12 @@ defmodule Probe.Controllers.Run do

defp get_client_ip(conn) do
case Plug.Conn.get_req_header(conn, "fly-client-ip") do
[ip | _] -> :inet.parse_address(Kernel.to_charlist(ip))
[] -> conn.remote_ip
[ip | _] ->
{:ok, ip_tuple} = :inet.parse_address(Kernel.to_charlist(ip))
ip_tuple

[] ->
conn.remote_ip
end
end

Expand Down

0 comments on commit 745351b

Please sign in to comment.