IP.Subnet.is_in
You're seeing just the macro
is_in
, go back to IP.Subnet module for more information.
true if the ip
parameter is inside the subnet. ip
must be a
single ip address; if you need a membership function
that accepts ranges or subnets, use Kernel.in/2
.
Be aware of the parameter order, if you are using this after import IP.Range
.
Currently only works for ipv4 addresses.
usable in guards.
iex> import IP
iex> IP.Subnet.is_in(~i"10.0.0.0/24", ~i"10.0.0.2")
true
iex> IP.Subnet.is_in(~i"10.0.0.0/24", ~i"10.0.1.5")
false