Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
Created August 21, 2014 22:11
Show Gist options
  • Save mattdeboard/00ea62d7ec2f264970f3 to your computer and use it in GitHub Desktop.
Save mattdeboard/00ea62d7ec2f264970f3 to your computer and use it in GitHub Desktop.
def init(conn) do
Process.flag :trap_exit, true
{ip, port} = conn |> Socket.remote!
host = case Socket.Host.by_address(ip) do
{:ok, _host} ->
_host.name
{:error, _} ->
Socket.Address.format ip
end
{listener, secure} =
case nil? conn.listener do
true ->
{nil, nil}
false ->
{conn.listener, conn.listener.secure}
end
{:ok, conn}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment