Skip to content

Commit

Permalink
Fix some grammar. Fix ice_ip_filter default value
Browse files Browse the repository at this point in the history
  • Loading branch information
mickel8 committed Sep 23, 2024
1 parent 17f2a52 commit 7fafd57
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions guides/deploying/fly.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Elixir WebRTC-based apps can be easily deployed on [Fly.io](https://fly.io)!

There are just two things you need to do:

- configure a STUN server both on the client and server side
- use custom Fly.io IP filter on the server side
* configure a STUN server both on the client and server side
* use a custom Fly.io IP filter on the server side

In theory, configuring a STUN server just on a one side should be enough but we recommend to do it on both sides.
In theory, configuring a STUN server just on one side should be enough but we recommend doing it on both sides.

In JavaScript code:

Expand All @@ -17,7 +17,7 @@ pc = new RTCPeerConnection({
});
```

in Elixir code:
In Elixir code:

```elixir
ip_filter = Application.get_env(:your_app, :ice_ip_filter)
Expand All @@ -29,15 +29,15 @@ ip_filter = Application.get_env(:your_app, :ice_ip_filter)
)
```

in `runtime.exs`:
In `runtime.exs`:

```elixir
if System.get_env("FLY_IO") do
config :your_app, ice_ip_filter: &ExWebRTC.ICE.FlyIpFilter.ip_filter/1
end
```

in fly.toml:
In fly.toml:

```toml
[env]
Expand All @@ -46,5 +46,5 @@ in fly.toml:
```

That's it!
No special UDP port exports or dedicated IP address needed.
No special UDP port exports or dedicated IP address are needed.
Just run `fly launch` and enjoy your deployment :)
3 changes: 2 additions & 1 deletion lib/ex_webrtc/ice/fly_ip_filter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ defmodule ExWebRTC.ICE.FlyIpFilter do
@moduledoc """
ICE IP filter for Fly.io deployments.
This module defines a single function, which filters out IP addresses,
This module defines a single function, which filters IP addresses,
which ICE Agent will use as its host candidates.
It accepts only the IPv4 address that `fly-global-services` resolves to.
"""

@spec ip_filter(:inet.ip_address()) :: boolean()
Expand Down
3 changes: 1 addition & 2 deletions lib/ex_webrtc/peer_connection/configuration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ defmodule ExWebRTC.PeerConnection.Configuration do
controlling_process: Process.dest(),
ice_servers: [ice_server()],
ice_transport_policy: :relay | :all,
ice_ip_filter: (:inet.ip_address() -> boolean()),
ice_ip_filter: (:inet.ip_address() -> boolean()) | nil,
ice_port_range: Enumerable.t(non_neg_integer()),
audio_codecs: [RTPCodecParameters.t()],
video_codecs: [RTPCodecParameters.t()],
Expand Down Expand Up @@ -240,7 +240,6 @@ defmodule ExWebRTC.PeerConnection.Configuration do
feedbacks = Keyword.get(options, :rtcp_feedbacks, @default_rtcp_feedbacks)

options
|> Keyword.put_new(:ice_ip_filter, fn _ -> true end)
|> Keyword.put(:audio_extensions, Enum.map(audio_extensions, fn {_, ext} -> ext end))
|> Keyword.put(:video_extensions, Enum.map(video_extensions, fn {_, ext} -> ext end))
|> then(&struct(__MODULE__, &1))
Expand Down

0 comments on commit 7fafd57

Please sign in to comment.