我遵循了這個例子:https://github.com/pion/example-webrtc-applications/tree/master/sfu-ws在本地正在工作我做了一個linux版本,我把它放在服務器上,正在工作我把它放在一個碼頭集裝箱里,它不再工作了。在泊塢服務器上,我打開了端口范圍:50000-50200:50000-50200/udpversion: '3'services: app: image: xxxx container_name: web_preprod ports: - 127.0.0.1:8080:8080 - 127.0.0.1:6060:6060 - 50000-50200:50000-50200/udp restart: on-failure networks: - xxxx nginx: image: nginx:latest restart: always container_name: nginx_preprod command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'" ports: - "80:80" - "443:443" - "6061:6061" - "6062:6062" networks: - xxxx volumes: - /tmp:/tmp - ./nginx.conf:/etc/nginx/nginx.conf - ./data/certbot/conf:/etc/letsencrypt - ./data/certbot/www:/var/www/certbot depends_on: - app networks: xxxx: driver: bridge端口不安全,用于測試。6061在我的服務器上,我放置了要使用的相同端口:se := webrtc.SettingEngine{}se.SetEphemeralUDPPortRange(50000, 50200)WebRTCApi = webrtc.NewAPI(webrtc.WithMediaEngine(getPublisherMediaEngine()), webrtc.WithSettingEngine(se))但我在服務器或客戶端上都沒有得到。我看到了什么,在服務器上我收到了onTrackPeerConnectionStateFailed我使用谷歌眩暈,和客戶端上的免費服務器var config = { iceServers: [{ urls: ["stun:stun1.l.google.com:19302"] }, { urls: 'turn:numb.viagenie.ca:3478', credential: 'xxxx', username: '[email protected]' } ] }; pc = new RTCPeerConnection(config)如果你有任何想法,我會欣賞。
1 回答

蝴蝶刀刀
TA貢獻1801條經驗 獲得超8個贊
問題在于,皮昂(或任何WebRTC實現)只知道它正在偵聽的IP地址。它無法知道映射/轉發到它的所有地址。人們也會稱之為或。因此,當Pion發出候選者時,它們可能看起來像,而遠程對等體將無法聯系到它。Public IP
NAT Mapping
10.10.0.*
您應該做的是使用設置引擎并設置設置1To1IP。如果您知道主機的公共 IP,它將使用公共 IP 重寫候選項。
ICE是一個棘手的過程。從概念上理解它 對于好奇#網絡來說,WebRTC可能會有所幫助。將確保盡快回答有關SO的任何后續問題!
- 1 回答
- 0 關注
- 144 瀏覽
添加回答
舉報
0/150
提交
取消