Iptrie.find

You're seeing just the function find, go back to Iptrie module for more information.

Specs

find(t(), prefix()) :: {:ok, {prefix(), any()}} | {:error, atom()}

Finds a prefix,value-pair for given prefix from trie using a longest prefix match.

Convenience wrapper for Iptrie.fetch/3 with match: :lpm.

Example

iex> ipt = new()
...> |> put("1.1.1.0/24", "one")
...> |> put("2.2.2.0/24", "two")
iex>
iex> find(ipt, "1.1.1.0/24")
{:ok, {"1.1.1.0/24", "one"}}
iex>
iex> find(ipt, "12.12.12.12")
{:error, :notfound}
iex>
iex> find(ipt, "13.13.13.333")
{:error, :einval}