What are STUN & TURN?
STUN (Session Traversal Utilities for NAT) is a simple protocol that lets a client discover its public IP address and the type of NAT (Network Address Translator) it sits behind. It is defined in RFC 5389.
TURN (Traversal Using Relays around NAT) is a more robust fallback. When direct peer‑to‑peer (P2P) connections fail, TURN relays the media traffic through a server, guaranteeing connectivity. TURN is defined in RFC 5766.
Why use them?
- Enable true P2P communication for browsers, mobile apps and IoT devices.
- Bypass corporate firewalls, symmetric NATs and restrictive carrier networks.
- Replace proprietary VOIP gateways that can be tapped or logged.
- Remain independent of telecom providers, keeping voice, video and data traffic out of their surveillance scope.
How IKDAO STUN & TURN fits the privacy promise
- Indie & Open: All server software is built from open‑source projects (coturn for TURN, stunserver for STUN).
- Free: No API keys, no quotas, no hidden fees. Anyone can query the service.
- Secure: TLS‑encrypted (run over 443) and DTLS for media channels. No logs are persisted.
- Privacy‑first: No client IP is stored; only transient connection metadata is kept in memory for the duration of a request.
Using STUN & TURN in a Web Application
When you create a WebRTC RTCPeerConnection, you supply a list of ICE (Interactive Connectivity Establishment) servers. IKDAO provides both:
// JavaScript example
const iceServers = [
{ urls: 'stun:peer.ikdao.org:3478' }, // STUN
{
urls: 'turns:peer.ikdao.org:5349', // TURN over TLS
username: 'exampleUser',
credential: 'examplePass'
}
];
const pc = new RTCPeerConnection({ iceServers });
Typical use‑cases:
- Web games – low‑latency positional data exchanged directly between browsers.
- Chat applications – encrypted text or data‑channel messages without a central server.
- Video conferencing – media streams flow peer‑to‑peer when possible; TURN acts as a reliable fallback.
When will TURN be used?
ICE runs a series of connectivity checks. If all direct candidates (host, server‑reflexive via STUN, relayed via TURN) fail, the TURN relayed candidate wins and all media is sent through the TURN server.
Availability & Global Reach
IKDAO runs a geographically‑distributed set of TURN relays, reachable from any internet‑connected device 24/7. The service works over both UDP (fastest) and TCP/TLS (fallback for restrictive networks), ensuring you can connect “anywhere, anytime”.
Specification Quick‑Reference
| Protocol | Spec (RFC) | Port(s) | Typical Use |
|---|---|---|---|
| STUN | 5389 | 3478 (UDP/TCP), 5349 (TLS) | Discover public IP & NAT type |
| TURN | 5766 | 3478 (UDP/TCP), 5349 (TLS) | Relay media when direct path fails |