Пример #1
0
    def __init__(self, servers=None):
        super().__init__()
        ice_kargs = {}
        for server in servers or []:
            uri = parse_stun_turn_uri(server.urls)

            if uri['scheme'] == 'stun':
                if 'stun_server' in ice_kargs:
                    # do not suport multiples stun server. ignoring
                    continue
                ice_kargs['stun_server'] = (uri['host'], uri['port'] or 3478)
            elif uri['scheme'] == 'turn':
                if uri['transport'] and uri['transport'] != 'udp':
                    # only suport udp transport. ignoring
                    continue
                if 'turn_server' in ice_kargs:
                    # do not suport multiples turn server. ignoring
                    continue
                if server.credentialType != "password":
                    # only suport credentialType password. ignoring
                    continue
                ice_kargs['turn_server'] = (uri['host'], uri['port'] or 3478)
                ice_kargs['turn_username'] = server.username
                ice_kargs['turn_password'] = server.credential

            # ignoring unsuported schema as stuns and turns
        self._connection = Connection(ice_controlling=False, **ice_kargs)
        self.__state = 'new'
    def __init__(self, iceServers: Optional[List[RTCIceServer]] = None) -> None:
        super().__init__()

        if iceServers is None:
            iceServers = self.getDefaultIceServers()
        ice_kwargs = connection_kwargs(iceServers)

        self._connection = Connection(ice_controlling=False, **ice_kwargs)
        self.__state = "new"
Пример #3
0
 def __init__(self):
     super().__init__()
     self._connection = Connection(ice_controlling=False,
                                   stun_server=('stun.l.google.com', 19302))
     self.__state = 'new'