Installation¶
Requirements¶
- Erlang/OTP 28 or later
- rebar3 build tool
Adding to Your Project¶
Using rebar3¶
Add estun to your rebar.config dependencies:
Then fetch dependencies:
Using Hex¶
Building from Source¶
Clone the repository and build:
Running Tests¶
Unit Tests¶
Integration Tests¶
Integration tests require network access to public STUN servers:
Dialyzer¶
Verifying Installation¶
Start an Erlang shell with estun loaded:
Then test basic functionality:
1> application:ensure_all_started(estun).
{ok,[estun]}
2> estun:add_server(#{host => "stun.l.google.com", port => 19302}).
{ok, 1}
3> estun:discover().
{ok,{stun_addr,ipv4,54321,{203,0,113,42}}}
If you see your public IP address, estun is working correctly!
Application Configuration¶
You can configure default STUN servers in your sys.config: