IP.Scope (ip v2.1.3)
Implements scope lookup for all (currently) known scopes.
Please open a pull-request if this needs changing.
Summary
Functions
@spec address_scope(IP.Address.t()) :: binary()
Return the scope of address
Examples
iex> ~i(192.0.2.0)
...> |> IP.Scope.address_scope()
"Documentation (TEST-NET-1), GLOBAL, RESERVED"
iex> ~i(2001:db8::)
...> |> IP.Scope.address_scope()
"Documentation, GLOBAL, RESERVED"
@spec prefix_scope(IP.Prefix.t()) :: binary()
Return the scope of prefix
Examples
iex> ~i(192.0.2.0/24)
...> |> IP.Scope.prefix_scope()
"Documentation (TEST-NET-1), GLOBAL, RESERVED"
iex> ~i(2001:db8::/32)
...> |> IP.Scope.prefix_scope()
"Documentation, GLOBAL, RESERVED"