Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/AgustinSRG/webrtc-cdn

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/AgustinSRG/webrtc-cdn

  • v1.0.3
  • Source
  • Go
  • Socket score

Version published
Created
Source

WebRTC CDN

Live media content delivery network based on the WebRTC protocol.

Compilation

In order to install dependencies, type:

go get github.com/AgustinSRG/webrtc-cdn

To compile the code type:

go build

The build command will create a binary in the current directory, called webrtc-cdn, or webrtc-cdn.exe if you are using Windows.

Docker Image

You can find the docker image for this project available in Docker Hub: https://hub.docker.com/r/asanrom/webrtc-cdn

To pull it type:

docker pull asanrom/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.

Network example

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 3 variables in order for it to work:

Variable NameDescription
SSL_PORTHTTPS listening port. Default is 443
SSL_CERTPath to SSL certificate.
SSL_KEYPath to SSL private key.

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 signaling 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 opened, 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 opened, since communication can be accomplish using the TURN server as intermediate.

Documentation

Check the documentation in order to connect to the nodes:

If you want to know about the inter-node communication protocol check:

Client Libraries

Here is a list of available client libraries to connect to webrtc-cdn:

Utilities / Experiments

Here is a list of utilities and experiments based of webrtc-cdn:

License

This project is under the MIT License.

FAQs

Package last updated on 06 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc