webrtc-streamer icon indicating copy to clipboard operation
webrtc-streamer copied to clipboard

Document TURN relay mode support with -I option

Open Copilot opened this issue 5 months ago • 0 comments

Overview

This PR addresses issue #XXX by documenting the existing TURN relay support that was already implemented but undocumented in the codebase.

Problem

Users were unaware that webrtc-streamer already supports forcing connections through TURN relay servers. The -I option exists to control ICE transport types, but it was poorly documented:

  • Help text didn't explain what values were valid
  • README had no mention of the option
  • No guidance on when/why to force TURN relay mode

Solution

Enhanced documentation to make TURN relay functionality discoverable and usable:

1. Improved Command-Line Help

Updated help text in src/main.cpp to clearly show valid values:

-I icetransport : Set ice transport type (0=all,1=relay,2=nohost default:0)

2. Updated README Usage Section

Added the -I option to the documented command-line arguments with value explanations.

3. Added "Forcing TURN relay mode" Section

Created comprehensive documentation explaining:

  • How WebRTC connection negotiation works by default (tries P2P first, falls back to TURN)
  • When to force TURN relay mode (security, network policy, testing)
  • Practical examples with both embedded and external TURN servers

Usage Examples

Force all connections through TURN relay with embedded server:

./webrtc-streamer -s- -T0.0.0.0:3478 -tturn:turn@$(curl -s ifconfig.me):3478 -I1

With external TURN server:

./webrtc-streamer -s- -tturn:[email protected]:3478 -I1

Transport Type Values

  • -I 0 (default): Allow all connection types - tries direct P2P first, falls back to TURN
  • -I 1: Force relay only - all traffic goes through TURN server
  • -I 2: No host - prevents local network connections

Impact

  • Minimal code changes: 1 line modified for clarity
  • Comprehensive documentation: 18 lines added
  • Zero breaking changes: All modifications are backward compatible
  • Improved discoverability: Users can now find and use this feature easily

The functionality was already fully implemented in the codebase - this PR simply makes it accessible through proper documentation.

Original prompt

Add support of Turn relay


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Oct 12 '25 09:10 Copilot