A Distributed Peer-to-Peer instant messaging TUI application built on libp2p
This program uses some protocols from libp2p to accomplish Hole-Punching, like libp2p circuit relay v2
, libp2p Direct Connection Upgrade through Relay
. So there should be a public server(cloud server) to act as a relay.
You can choose to compile by yourself or download binaries from releases.
cargo build --bin relay
cd tochat/target/debug/
nohup ./relay --port 4001 --secret-key-seed 0 &
Then watch the output and write down the listening address(with PeerId).
For Ubuntu, some tools need to be pre-installed: (other systems should download corresponding tools)
sudo apt install libssl-dev
sudo apt install protobuf-compiler
sudo apt install pkg-config
build:
cargo build --bin tochat
cd tochat/target/debug
Linux users as below. Use ./tochat.exe
in powershell if you're under windows.
# create your secret key or import an existed key
./tochat new || ./tochat import --key `xxx`
# someone should be listening first
./tochat dm --name `xxx` --relay-address `xxx` --topic `xxx`
# another one dials
./tochat dm --name `xxx` --relay-address `xxx` --remote-id `xxx` --topic `xxx`
# use `./tochat dm --help` to check help details
# create your secret key or import an existed key
./tochat new || ./tochat import --key `xxx`
# join the group
./tochat channel --name `xxx` --relay-address `xxx` --topic `xxx`
# use `./tochat channel --help` to check help details