aboutsummaryrefslogtreecommitdiff
path: root/shard/lib/net/addr.ex
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-10-11 17:25:31 +0200
committerAlex Auvolat <alex@adnab.me>2018-10-11 17:25:31 +0200
commite5a7330d0526efb592e200ab96c3f33585ae8d02 (patch)
tree906651f53e17002b32e3db3d77bca2918bf62c47 /shard/lib/net/addr.ex
parent1646bc57eae9880fd408d23ca692364dc6fd6442 (diff)
downloadshard-e5a7330d0526efb592e200ab96c3f33585ae8d02.tar.gz
shard-e5a7330d0526efb592e200ab96c3f33585ae8d02.zip
Initial support for private conversations
Diffstat (limited to 'shard/lib/net/addr.ex')
-rw-r--r--shard/lib/net/addr.ex4
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