Skip to content

ICE Guide

Alexander Scheurer edited this page Nov 26, 2024 · 2 revisions

Basics

ICE (Interactive Connectivity Establishment) is a framework used in WebRTC and VoIP systems to establish connections between peers, even when they are behind NAT (Network Address Translation) or firewalls. It uses two key components:

  • STUN (Session Traversal Utilities for NAT) servers help clients discover their public IP and port by acting as an intermediary, enabling peers to communicate directly when possible.
  • TURN (Traversal Using Relays around NAT) servers provide a fallback mechanism when direct communication isn't possible due to restrictive NAT or firewall configurations, relaying data between peers.

By combining STUN and TURN, ICE tests various connectivity paths and selects the most efficient one, optimizing communication and ensuring connectivity in challenging network conditions.

Setup

Server

STUN/TURN

Coturn provides both STUN and TURN functionality. Setup a server with Coturn according to their docs. The following example configuration should work with Fudge.

/etc/turnserver.conf:

fingerprint
lt-cred-mech
user=test:Something!193
server-name=<insert proper FQDN for this server>
realm=fudge
simple-log
log-file=/var/log/turn/turnserver.log
proc-user=turnserver
proc-group=turnserver
listening-port=3478
tls-listening-port=5349

Node.js FUDGE

On the same or a different server setup Node.js and Fudge. Additionally you need server certificates, one of the easiest sources is Let's Encrypt.

Use Test/Net/Server/Server.ts but pass the certificate and private key to server.startUp(..).

Start up the server with node Server.js 17640.

FUDGE Client

Edit Source/Net/Client/RtcConnection.ts and add the STUN/TURN-Server.

Now you can test the connection with Test/Net/Client/index.html

Clone this wiki locally