Coder Social home page Coder Social logo

p2p-chat's Introduction

P2P-Chat

P2P-Chat is a python based peer-to-peer chat client with a command line interface.

For your information:

As this project was only for demonstation purposes as part of my paper on p2p, I will no longer work on p2p-chat.
You may fork this repository to work on it yourself.

Peer-to-peer vs. Client/Server

A regular client/server based chat:

         /<----\      /<----\
Client A        Server       Client B
         \---->/      \---->/

A peer-to-peer based chat:

         /<----\
Client A        Client B
         \---->/

As you can see, there is no third-party server involved when using peer-to-peer. All the messages you send and receive are private. They're only seen by your client and the client you are connected to.

#f03c15 WARNING: Nothing this client sends or receives is encrypted. Do only use it when connected to a private network.

Installation

To install P2P-Chat simply download this repo.

git clone https://github.com/F1xw/p2p-chat
cd ./p2p-chat

Requirements

P2P-Chat uses several python module. Make sure the package manager pip is installed, so that p2p-chat can automatically install all required modules.

For Windows users:

npyscreen uses the curses library which might not be pre-installed on windows. Download the corresponding version for your installation from here and install it with pip.

Usage

Run /run.py to start the client.

python run.py

You will be greeted with a slick, nostalgic CLI.

Try resizing your terminal if the app chrashes instantly.


To use p2p-chat follow these steps:

  1. Set your nickname with /nickname
  2. Connect to a peer with /connect

You are now able to send messages to the connected peer by typing them in and pressing enter. Take a look at all the other commands down below.

Commands

P2P-Chat uses commands to setup and connect. Try /help to get a list of all available commands.

Connect to a peer

Use /connect [host]ย [port] to connect to a peer. The client will try to connect for 5 seconds. You will have to set your nickname before connecting using /nick

Example:

/connect office-pc.local 3333

Disconnect

Use /disconnect to close the current connection.

Example:

/disconnect

Nickname

Use /nick [nickname] to set your nickname. Updating your nickname while a connection is active will send your new name to the connected peer.

Example:

/nick flowei

Quit

Use /quit to quit the app.

Example:

/quit

Port

Use /port to change the port your server runs on.

Example:

/port 3456

Connectback

Use /connectback to connect to a peer without having to enter their hostname and port. This command is only available if your server receives a connection while your client is not connected.

Example:

/connectback

Clear

Use /clear to clear the chat.

Example:

/clear

Eval

Use /eval [python code] to execute python code within the app itself. The output will be relayed to the chat feed.

Example:

# Print the nickname of the connected peer
/eval print(self.peer)
# Generate a system message
/eval self.sysMsg("Hello from /eval!")
# Forcefully exit the app
/eval exit()

Status

Use /status to get the current status of server and client.

Example:

/status

Log

Use /log to log all messages sent and received during your session to a file.

Example:

/log

Help

Use /help to get a list of all available commands.

Example:

/help

Implement:

  • Encryption
  • User Directory
  • Creators mode
  • MetMask (wallet) integration
  • PayWall
  • Content Library
  • Secure File transfer
  • payEd upload to creators for users
  • DHT
  • Dandelion
  • Audio/Video Streaming
  • Minotaur Mode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.