Pion 自定义 SFU 服务器在泊坞窗内不工作

我遵循了这个例子:https://github.com/pion/example-webrtc-applications/tree/master/sfu-ws

  • 在本地正在工作

  • 我做了一个linux版本,我把它放在服务器上,正在工作

  • 我把它放在一个码头集装箱里,它不再工作了。

在泊坞服务器上,我打开了端口范围:

  • 50000-50200:50000-50200/udp

version: '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))

但我在服务器或客户端上都没有得到。我看到了什么,在服务器上我收到了onTrack


PeerConnectionStateFailed

我使用谷歌眩晕,和客户端上的免费服务器


var config = {

            iceServers: [{

                urls: ["stun:stun1.l.google.com:19302"]

            },

            {

                urls: 'turn:numb.viagenie.ca:3478',

                credential: 'xxxx',

                username: 'xxxx@gmail.com'

            }

            ]

        };

        pc = new RTCPeerConnection(config)

如果你有任何想法,我会欣赏。


江户川乱折腾
浏览 195回答 1
1回答

蝴蝶刀刀

问题在于,皮昂(或任何WebRTC实现)只知道它正在侦听的IP地址。它无法知道映射/转发到它的所有地址。人们也会称之为或。因此,当Pion发出候选者时,它们可能看起来像,而远程对等体将无法联系到它。Public IPNAT Mapping10.10.0.*您应该做的是使用设置引擎并设置设置1To1IP。如果您知道主机的公共 IP,它将使用公共 IP 重写候选项。ICE是一个棘手的过程。从概念上理解它 对于好奇#网络来说,WebRTC可能会有所帮助。将确保尽快回答有关SO的任何后续问题!
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Go