View Source RemoteIp.Parsers.Forwarded (remote_ip v1.2.0)
RFC 7239 compliant parser for
Forwarded
headers.
This module implements the RemoteIp.Parser
behaviour. IPs are parsed out of
the for=
pairs across each forwarded element.
Examples
iex> RemoteIp.Parsers.Forwarded.parse("for=1.2.3.4;by=2.3.4.5")
[{1, 2, 3, 4}]
iex> RemoteIp.Parsers.Forwarded.parse("for=\"[::1]\", for=\"[::2]\"")
[{0, 0, 0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 0, 2}]
iex> RemoteIp.Parsers.Forwarded.parse("invalid")
[]