- Notifications
You must be signed in to change notification settings - Fork17
hamidreza-s/NanoChat
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
NanoChat is apeer-to-peer,end-to-end encrypted anddiscoverable chat applicationthat can be used inside command line. It is totally server-less and every peer can discoverother peers in the same subnet without having the network address of them in advance.
It can be compiled and works on bothLinux andOSX system platforms.
Callnanochat
with desired flags. In order to see the list of available flags,use--help
as follows:
NanoChat help-------------Avaliable flags: Help: -h --help Host IP: -H --host {host IP} Broadcast IP: -B --broadcast {broadcast IP} RPC Port: -P --port {port} Discoverable: -d --discoverable Secure: -s --secure
--host {host IP}
flag is used to specify the network interface IP which you want to use. By defaultit is selected by NanoChat.--broadcast {broadcast IP}
flag is used to specify the network interface broadcast IPwhich you want to use. By default it is selected by NanoChat.--port
flag is used to specify the RPC port which is listening to answer chat requests after creatingthe requested chat room. Its default value is1991
.--discoverable
flag is used to let NanoChat to be disovered by other peers, otherwise it doesn'tanswer to discovery packet and remains hidden from others.--secure
flag is used to make NanoChat secure for end to end message encryption withasymmetric/public-key cryptography.
In order to see available commands inside NanoChat use/help
command as follows:
$ nanochat --discoverableNanoChat shell was started.>> /helpAvailable commands: /help prints this text /probe find online peers /list peers list online peers /list rooms list availabe rooms /connect {host} {port} connect to remote client /attach {room} attach to room /quit quit nanochat console>> ...
/probe
command discovers the subnet for other online NanoChat peers./list peers
command list discovered online peers' host and port address./list rooms
command list available rooms./connect {host} {port}
command connects you to other peers./attach {room}
command is used to enter to a created room by other peers./quit
command closes the NanoChat console.
NanoChat usesGNU Autotools. So you need to have them installed inyour system. Also it needsGCCorClang,GNU Make andGNU Readline library.Other dependencies are included in theNanoChat/lib
directory and will be compiled and linkedwith autotools automatically. So there is no need to get and build it manually.
Debian dependencies:
$ apt-get install gcc make automake autoconf libreadline-dev
Fedora dependencies:
$ yum install gcc make automake autoconf libreadline-devel
OSX dependencies:
$ port install gcc make automake autoconf readline
After making sure that your system has required dependencies, clone the repo and follow installation steps:
$ git clone https://github.com/hamidreza-s/NanoChat.git$ cd NanoChat$ autoreconf -i$ ./configure$ make && make install...=============================================================| NanoChat was successfully installed -------------------------------------------------------------| NanoChat was installed in /usr/local/bin directory. | Just type 'nanochat --help' there to get started.=============================================================
Nownanochat
executable file is accessible in the path of your shell.
My main purpose for writing NanoChat is learning things, so I think it isgood to know for you how it works and what tools and protocols it uses.
- For discovering other online peers in the same subnet it uses raw UDP broadcasting.
- For inter-node communication it uses somelibnanomsg scalibility protocols,for instance REQREP protocol for RPC and PAIR for one to one chat.
- For user's input/output multiplexing it usesselectPOSIX-compliant syscall.
- For storing user's information it useslibvedis embedded datastore engine.
- For line-editing and history capabilities of commands ituseslibreadline.
- For end to end encryption it useslibsodium public-key cryptography.
- For message serialization it useslibparson which is a JSON parser.
- For encoding and decoding encrypted messages before sending over wire it uses base64 codec.
Comments, contributions and patches are greatly appreciated.
The MIT License (MIT).