diff options
Diffstat (limited to 'shard/lib/net/addr.ex')
-rw-r--r-- | shard/lib/net/addr.ex | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/shard/lib/net/addr.ex b/shard/lib/net/addr.ex index 645e109..630f95a 100644 --- a/shard/lib/net/addr.ex +++ b/shard/lib/net/addr.ex @@ -24,4 +24,8 @@ defmodule SNet.Addr do addrset = MapSet.put(addrset, get_pub_inet4()) MapSet.to_list addrset end + + def is_local?({:inet, ip, port}) do + port == Application.get_env(:shard, :port) and (ip == {127,0,0,1} or ip in get_if_inet4()) + end end |