Sign inSign up

asanrom/webrtc-cdn

By asanrom

•Updated about 1 month ago

Live media content delivery network based on the WebRTC protocol.

Image
0

1.1K

asanrom/webrtc-cdn repository overview

⁠WebRTC CDN

Live media content delivery network based on the WebRTC protocol.

Repository: https://github.com/AgustinSRG/webrtc-cdn⁠

⁠Usage

This project is meant to be used to create a network to deliver live media content using the WebRTC protocol.

In order to create the network, you can spawn multiple nodes connected to a Redis Pub/Sub service for inter-node communication.

Once the network is up, clients can connect to the nodes via Websocket (for signaling purposes), in order to request for publishing or receiving media streams via WebRTC.

⁠Configuration

You can configure the node using environment variables

⁠WebRTC options
Variable NameDescription
STUN_SERVERSTUN server URL. Example: stun:stun.l.google.com:19302
TURN_SERVERTURN server URL. Set if the server is behind NAT. Example: turn:turn.example.com:3478
TURN_USERNAMEUsername for the TURN server.
TURN_PASSWORDCredential for the TURN server.
⁠Redis

To configure the redis connection, set the following variables:

Variable NameDescription
STAND_ALONESet it to YES if you want to disable redis and just use a single node. By default, webrtc-cdn will use redis
REDIS_PORTPort to connect to Redis Pub/Sub. Default is 6379
REDIS_HOSTHost to connect to Redis Pub/Sub. Default is 127.0.0.1
REDIS_PASSWORDRedis authentication password, if required.
REDIS_TLSSet it to YES in order to use TLS for the connection.
⁠TLS for signaling

If you want to use TLS for the websocket connections (recommended), you have to set the following variables in order for it to work:

Variable NameDescription
SSL_PORTHTTPS listening port. Default is 443
SSL_CERTPath to SSL certificate (REQUIRED).
SSL_KEYPath to SSL private key (REQUIRED).
SSL_CHECK_RELOAD_SECONDSNumber of seconds to check for changes in the certificate or key (for auto renewal)
⁠Authentication

Authentication options:

Variable NameDescription
JWT_SECRETSecret to validate JSON web tokens used for authentication in the signaling protocol. If not set, no authentication is required.
⁠More options

Here is a list with more options you can configure:

Variable NameDescription
HTTP_PORTHTTP listening port for insecure websocket connections, used for signaling. Default is 80
BIND_ADDRESSBind address for siganling services. By default it binds to all network interfaces.
LOG_REQUESTSSet to YES or NO. By default is YES
LOG_DEBUGSet to YES or NO. By default is NO
MAX_IP_CONCURRENT_CONNECTIONSMax number of concurrent connections to accept from a single IP. By default is 4.
CONCURRENT_LIMIT_WHITELISTList of IP ranges not affected by the max number of concurrent connections limit. Split by commas. Example: 127.0.0.1,10.0.0.0/8
MAX_REQUESTS_PER_SOCKETMax number of active requests for a single websocket session. By default is 100

⁠Firewall configuration

The ports used by the signaling websocket server must be openned, they are 80 and 443 by default.

In order for the nodes to be able to communicate via WebRTC, they need to use the port range 40000:65535/UDP

If you use a TURN server there is no need for the UDP ports to be oppened, since communication can be acomplish using the TURN server as intermediate.

Tag summary

Content type

Image

Digest

sha256:521156f4c…

Size

372.5 MB

Last updated

about 1 month ago

docker pull asanrom/webrtc-cdn