To provide peer to peer support for users with a firewall, a TURN
service might be required. Not everyone can/wants to setup a self-hosted
TURN server. This change adds support to consume a remote TURN service
which usually requires authentication. Spreed WebRTC received TURN
credentials using this service in regular intervals and provides them to
all Spreed WebRTC sessions.
If the remote TURN service provides multiple zones and a GEO location
endpoint, the web client will also directly connect to that TURN service
GEO endpoint to let the TURN service select preferred zones based on the
clients information.
The advanced settings provide a way to control the TURN service zone
directly and to disable the client side GEO call. By default the
selection is auto if the TURN service provides a GEO endpoint. If no
such endpoint is required, the zone with the highest priority is used by
default (as sent by the TURN credentials service).
This also refactors the channelling API for better clarity
as well as introducing the following functional changes:
* All Hello requests will now receive a Welcome or Error return.
* The message sent in response to a successful authentication
request now uses the Iid provided with the originating request.
* Responses to requests for the Self document now use the Iid
provided with the originating request.
* Failed authentication requests now receive an error return.
* Malformed requests for the Hello, Authentication, Sessions,
and Rooms documents will now receive an error return.
* Requests for the Sessions document which cannot be processed
now receive an error return.
* Requests for the Users document will receive an error return
if the requesting session has not joined a room.
This should resolve any cases where sessions were not removed from the hub
after their connection closed.
Also moves buddy image management entirely into the session and
vastly improves locking around session data. Also allocates less
when sending client left messages and paves the way for session specific
message codecs.
In addition to adding unit tests for the "Hello" message,
the following notable improvements are included:
* Separate websocket callbacks from the hub via a handler API
and adaptor.
* Move all application specific state to the session.
* Session no longer refers to the hub.
* Remove redundant MessageRequest struct.
* Hub is no longer responsible for buffer pool or
buddy image management.
* Consolidated connection table locking in the hub.
* Remove redundant session table from the hub.
* Split room join and leave into separate handlers.
This also removes the RoomConnectionUpdate struct.
* Entirely remove room management from the hub.
This also provides room operations with a separate mutex.
* Split stats into a separate service.
* Simplify the session token handler.
* Buddy image HTTP handler no longer takes the entire hub.
* Centralize JSON encoding and decoding. This removes JSON
encoding from the room worker queue.
* Improve unicast message statistics.
* Numerous other renamings and cleanup items.