feat: add TURN servers for symmetric NAT traversal
- Add openrelay.metered.ca TURN servers for testing - Support connections through symmetric NAT (mobile networks) - Add TCP transport fallback for strict firewalls - Enables P2P file transfer across different networks
This commit is contained in:
@@ -1,12 +1,30 @@
|
||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { getSocket } from '../services/socket';
|
||||
|
||||
// WebRTC configuration with STUN servers for NAT traversal
|
||||
// WebRTC configuration with STUN and TURN servers for NAT traversal
|
||||
const rtcConfig = {
|
||||
iceServers: [
|
||||
// STUN servers for basic NAT traversal
|
||||
{ urls: 'stun:stun.l.google.com:19302' },
|
||||
{ urls: 'stun:stun1.l.google.com:19302' },
|
||||
{ urls: 'stun:stun2.l.google.com:19302' },
|
||||
|
||||
// TURN servers for symmetric NAT and strict firewalls (public relay for testing)
|
||||
{
|
||||
urls: 'turn:openrelay.metered.ca:80',
|
||||
username: 'openrelayproject',
|
||||
credential: 'openrelayproject',
|
||||
},
|
||||
{
|
||||
urls: 'turn:openrelay.metered.ca:443',
|
||||
username: 'openrelayproject',
|
||||
credential: 'openrelayproject',
|
||||
},
|
||||
{
|
||||
urls: 'turn:openrelay.metered.ca:443?transport=tcp',
|
||||
username: 'openrelayproject',
|
||||
credential: 'openrelayproject',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user