GitXplorerGitXplorer
s

voices

public
6 stars
1 forks
9 issues

Commits

List of commits on branch main.
Unverified
193209e8148520b7d655a2a83bae61798b585271

Move server components into own directory

ssebpuetz committed 9 months ago
Verified
014184f05fe166e8d787e6ece7720e22486b4b96

Bump dependencies (#24)

ssebpuetz committed a year ago
Unverified
ded378d913c7a60e36585a35bf4156b5f82bfb86

Update runtime container, pin rust version

ssebpuetz committed a year ago
Unverified
63e86d0c478f074e60bf2620408547794059cce1

Undo formatting mistake

ssebpuetz committed a year ago
Unverified
e1640b71fe0cc0deef7b8157c7f3b613a4fcff83

Update dependencies

ssebpuetz committed a year ago
Unverified
214141a1eb0453120d2d112b3f69b6a9321ab3cd

Remove commented test

ssebpuetz committed a year ago

README

The README file for this repository.

Voices

Voices is a voice chat implemented in Rust. Voice streams are encoded with Opus and encrypted with xsalsa20poly1305 and distributed by a server, i.e. no P2P connections. Voice data is sent over UDP, setting up a connection and controlling session state is handled over web sockets.

Configuring servers and channels is possible through a REST API exposed on the Gateway.

There's a basic client available under ./client that connects to the provided Gateway URL, fetches the list of available servers and allows interactively joining a channel by entering the list index of the given server and channel.

Deployment

Voices can be both be deployed (mostly) standalone and in a distributed way.

Standalone

Standalone setup runs the voice server, channels registry and gateway in a single binary. There is an external dependency on Postgres.

Database setup

# requires diesel_cli, in turn depends on libpq
cargo install diesel_cli --no-default-features --features=postgres
DATABASE_URL=postgres://postgres:password@localhost:5432/voices_channels diesel database setup

Gateway

# run all components integrated and listen for WebSockets / HTTP on 33332
# defaults to opening UDP ports 33333 and 33334 for the voice server
# expects postgres postgres://postgres:password@localhost:5432/voices_channels
RUST_LOG=DEBUG,tower=warn,h2=warn voices-gateway --ws-listen-port 33332 standalone

Distributed

Distributed setup runs voice server instances, channel registry instances and gateway instances independently of each other. There is an additional dependency on a Redis instance to broadcast channel events across different gateway instances.

Gateway

# listen for WebSockets / HTTP on 33332
# expect channels registry running on http://localhost:33330
RUST_LOG=DEBUG,tower=warn,h2=warn voices-gateway --ws-listen-port 33332 distributed --redis-conn redis://127.0.0.1:6379/

Voice Server

# expect channels registry running on http://localhost:33330
# registers itself at channels registry with --http-host-url=http://localhost and --http-port=33331
# generates a random server-id at startup used to identify itself at channels registry
# defaults to opening UDP ports 33333 and 33334
RUST_LOG=debug,tower=warn,h2=warn voices-voice-grpc

Channels Registry

# listens for HTTP / gRPC on on http://localhost:33330
# expects migrated voices_channels db postgres://postgres:password@localhost:5432/voices_channels
RUST_LOG=debug,tower=warn,h2=warn voices-channels-grpc

Dev Deployment

Distributed

Deploys 3 instances of channels, gateway and voice-server via docker-compose. The gateways are behind an nginx reverse proxy listening on port 8000, the voice-server instances start assigning up to 100 UDP ports from 12222, 22222 and 32222 respectively. The voice-servers are configured to return their local listen address, i.e. they are not reachable from the internet without modifying the UDP_HOST variable in their deployments to something reachable from the internet.

./docker/build.sh \
# bring up 3 channels, gateway and voice-server instances along nginx, redis and postgres
&& docker-compose -f docker/docker-compose.yml -p voices up -d
# to follow the logs
# docker-compose -f docker/docker-compose.yml -p voices logs -f 

Standalone

Deploys a single instance of the Gateway via docker-compose. The gateway listens on port 8001, the integrated voice server starts assigning ports from 13333 to 13433 and is configured to return its local listen address, i.e. they are not reachable from the internet without modifying the UDP_HOST` variable in their deployments to something reachable from the internet.

./docker/build-standalone.sh \
# bring up 3 channels, gateway and voice-server instances along nginx, redis and postgres
&& docker-compose -f docker/docker-compose-standalone.yml -p voices-standalone up -d
# to follow the logs
# docker-compose -f docker/docker-compose-standalone.yml -p voices-standalone logs -f