-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Fly.io deployment utils and instructions
- Loading branch information
Showing
4 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule ExWebRTC.ICE.FlyIpFilter do | ||
@moduledoc """ | ||
ICE IP filter for Fly.io deployments. | ||
This module defines a single function, which filters out IP addresses, | ||
which ICE Agent will use as its host candidates. | ||
""" | ||
|
||
@spec ip_filter(:inet.ip_address()) :: boolean() | ||
def ip_filter(ip_address) do | ||
case :inet.gethostbyname(~c"fly-global-services") do | ||
# Assume that fly-global-services has to resolve | ||
# to a single ipv4 address. | ||
# In other case, don't even try to connect. | ||
{:ok, {:hostent, _, _, :inet, 4, [addr]}} -> | ||
addr == ip_address | ||
|
||
_ -> | ||
false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters