0Pricing
Real-Time Streaming Systems (WebRTC + Live Data) · Ders

Kendi TURN Sunucunuzu Dağıtma ve Güvenceye Alma

coturn ile kendi TURN sunucunuzu barındırmayı, kimlik bilgilerini süre sınırlı belirteçlerle güvenle yapılandırmayı ve kendi sunucunuzu barındırma ile yönetilen TURN hizmetleri arasında seçim yapmayı öğrenin.

Kendi TURN Sunucunuzu Dağıtma ve Güvenceye Alma, CoddyKit'te ücretsiz bir Real-Time Streaming Systems (WebRTC + Live Data) dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Real-Time Streaming Systems (WebRTC + Live Data) öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Real-Time Streaming Systems (WebRTC + Live Data) kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

From Theory to Operation

You understand NAT challenges, STUN, and what TURN does. Now you will actually run a TURN server, secure it, and connect WebRTC to it. The most common open-source choice is coturn.

Why Self-Host TURN

Public STUN is free, but TURN relays media and consumes bandwidth, so it is rarely free. Running your own TURN server gives you control over capacity, cost, and privacy.

Installing coturn

On a Linux server you install coturn from the package manager. It runs as a background service.

sudo apt-get update
sudo apt-get install -y coturn
sudo systemctl enable coturn

Basic Configuration

coturn reads /etc/turnserver.conf. A minimal config sets the realm and listening ports.

listening-port=3478
tls-listening-port=5349
realm=turn.example.com
fingerprint

The Credential Problem

TURN requires authentication or anyone could relay traffic through your server at your expense. Hardcoding a static username and password is risky because clients can leak them.

Time-Limited Credentials

The secure approach is the REST/ephemeral credential mechanism. Your server generates short-lived usernames and passwords derived from a shared secret, so leaked credentials expire quickly.

use-auth-secret
static-auth-secret=your_long_shared_secret

Generating a Credential

Your backend creates a username as an expiry timestamp and signs it with HMAC-SHA1 using the shared secret. The signature becomes the password.

const crypto = require('crypto');
function turnCredential(secret, ttl) {
  const username = String(Math.floor(Date.now() / 1000) + ttl);
  const hmac = crypto.createHmac('sha1', secret);
  hmac.update(username);
  const password = hmac.digest('base64');
  return { username, password };
}

Wiring It Into WebRTC

Pass the TURN URL and ephemeral credentials into the peer connection's ICE server list. WebRTC uses them when direct paths fail.

const pc = new RTCPeerConnection({
  iceServers: [{
    urls: 'turn:turn.example.com:3478',
    username: cred.username,
    credential: cred.password
  }]
});

Use TLS and TCP Fallback

Some restrictive networks block UDP entirely. Offer turns: over TCP on port 443 so media can tunnel through firewalls that only allow HTTPS traffic.

// add a TLS/TCP TURN entry alongside the UDP one
urls: 'turns:turn.example.com:443?transport=tcp'

Self-Host vs Managed

Self-hosting coturn is cheaper at scale but means you handle uptime, bandwidth, and security. Managed TURN providers cost more per GB but remove operational burden. Pick based on your team and traffic.

Operating Responsibly

Monitor bandwidth, rotate the shared secret periodically, restrict relay to authenticated users, and place the server geographically near your users to minimize latency. A well-run TURN server is the safety net that makes calls connect everywhere.

Quick Check

Test your understanding of TURN deployment.

Recap

You learned to deploy and secure TURN:

  • Install and configure coturn with a realm and ports
  • Use use-auth-secret with HMAC-based ephemeral credentials
  • Wire credentials into the ICE server list
  • Offer TLS/TCP on 443 for restrictive networks
  • Weigh self-hosting against managed services

A secure TURN server ensures calls connect even behind tough NATs.

Sıkça Sorulan Sorular

“Kendi TURN Sunucunuzu Dağıtma ve Güvenceye Alma” dersi ücretsiz mi?

Evet — “Kendi TURN Sunucunuzu Dağıtma ve Güvenceye Alma” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Real-Time Streaming Systems (WebRTC + Live Data) kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Real-Time Streaming Systems (WebRTC + Live Data) kursu toplamda 4 dersten oluşur.

“Kendi TURN Sunucunuzu Dağıtma ve Güvenceye Alma” dersinde ne öğreneceğim?

coturn ile kendi TURN sunucunuzu barındırmayı, kimlik bilgilerini süre sınırlı belirteçlerle güvenle yapılandırmayı ve kendi sunucunuzu barındırma ile yönetilen TURN hizmetleri arasında seçim yapmayı… Real-Time Streaming Systems (WebRTC + Live Data) ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Real-Time Streaming Systems (WebRTC + Live Data) öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Real-Time Streaming Systems (WebRTC + Live Data), başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.

“Kendi TURN Sunucunuzu Dağıtma ve Güvenceye Alma” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Real-Time Streaming Systems (WebRTC + Live Data) dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Real-Time Streaming Systems (WebRTC + Live Data) dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. NAT ve Güvenlik Duvarı Zorlukları
  2. STUN Sunucusunun İşlevi
  3. Aktarımlı Bağlantılar için TURN Sunucusu
  4. Kendi TURN Sunucunuzu Dağıtma ve Güvenceye Alma
← Real-Time Streaming Systems (WebRTC + Live Data) Sayfasına Dön