- install rust -> https://www.rust-lang.org/tools/install
- cargo run
- open "client.html" file in browser
source code of other people used in this project:
client
https://github.com/wwwtyro/cryptico
https://github.com/ricmoo/aes-js
https://github.com/bashi/minimp3-wasm
https://github.com/Ivan-Feofanov/ws-audio-api
A
I made this to be similar to teamspeak, not IRC. So unlike IRC this also contains voice chat.
The messages send in this chat, text messages, images and voice data are all end to end encrypted for both direct and channel communication. This chat does not rely on TLS/SSL and encrypts stuff on its own.
It was made to be hard as possible, even for admin hosting this, to see messages of others that do not belong to him.
This tool is my contribution to free software on internet that no one asked for
A what do you think?
A
To answer this, it is important to know that the client.html is ment to be run from desktop. This was done to make chat client accessible without the need to run .exe.
It works fine. If really needed, the client.html can be packed to .exe with something like electron.
That being said, yes, the client.html can also be embedded to website so people can connect directly from it.
with these assumptions:
- apache2 running on ubuntu
- websocket port of choice: 1111
- stunnel used
- websockets secure (WSS) port of choice: 1112 (set in stunnel configuration file)
- certbot used
- domain name "justsometestchat.com"
steps to do it would be following
- copy client.html to /var/www/html
- apt install stunnel
- apt install apache2
- install certbot (easiest way to get free certificate)
- sudo certbot --apache
- service apache2 start
- vim /etc/stunnel.conf
put this data in /etc/stunnel.conf
[chatserver]
accept = 0.0.0.0:1112
connect = 127.0.0.1:1111
cert = /etc/letsencrypt/live/justsometestchat.com/cert.pem
key = /etc/letsencrypt/live/justsometestchat.com/privkey.pem
- run "stunnel" command in terminal. If command run with no error, server is probably set up correctly and accessible from https secured site.
try viewwing https://justsometestchat.com/client.html in browser and test if everything works. The server will be accessible from both desktop and website
Yes, the client.html has two webassembly files embedded directly in it as base64 string.
- first webassembly (libopusjs) for encoding/decoding pcm to/from opus
https://github.com/azc5OQ/libopusjs-wasm--build-steps - second webassembly for encoding mp3 to pcm
https://github.com/azc5OQ/minimp3-wasm-build-steps
There are two options on how to build and reproduce these exact webasemblies:
- clone it from my repository and setup build enviroment yourself
- download .ova file (exported virtual machine) that contains build enviroment with everything already setup
I provided virtual machine for building these webassemblies because the enviroment needed to build them from scratch was just too complicated to setup.
There is also webassembly-free version of client, client_noaudio.html.
I got asked why I did not use rust.
I thought about it. I wanted server to be easy to build into binary and rust made that possible. There are pros and cons to everything.
I used C before for server side code and it worked. There are some forks of it here.
I must say I find rust syntax unnecessary complicated. While writing code in rust, I tried to made the server code readable at all costs even if the code was not following "rust standards"
in case you have any feature request open new issue or just fork it and add what you want
posible solution to problem of making server visible (hosting server on windows behind router etc)
- buy cheap VPS (1 cpu core and 500mb ram more than enough, vps will be access point / router for traffic)
- ssh -i some_generated_private_key -p 2245 -w 0:0 -R 1234:localhost:1234 -R 3478:localhost:3478 -v [email protected]
some explanation: (its assumed reader knows how this ssh command works)
1234 is a websocket port that admin chooses when he starts server
3478 is a stun port used for creating a NON-peer-to-peer webrtc datachannel. Similar to websocket, just UDP. If voice chatting is not needed, this can be ignored.
todo: add fallback to websocket if webrtc channel fails to create