GitXplorerGitXplorer
s

voices

public
6 stars
1 forks
9 issues

Commits

List of commits on branch main.
Unverified
8ead2cd7d7c8768f4819b946cafc8d39c17a3eda

Tests

ssebpuetz committed 2 years ago
Unverified
f2a0aabcde242ae6d3fae2551e5e996efc66993b

More tests, initialized msg

ssebpuetz committed 2 years ago
Unverified
1ace796efd0c0af044b0a1a561dbdfbe61b22fee

Channels tests

ssebpuetz committed 2 years ago
Unverified
33615bad3d8468687f4a9983bf88e06a3f1f1142

Docs!

ssebpuetz committed 2 years ago
Unverified
e905cdd6cc092993540d4cb22147a536e10de7fd

ipv4 in tests

ssebpuetz committed 2 years ago
Unverified
5f1128011bed657e5dde19bd87dd7015be46e0fc

ipv4?

ssebpuetz committed 2 years 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