• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

manishmeganathan/peerchat: A terminal-based P2P chat application using libp2p an ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

manishmeganathan/peerchat

开源软件地址:

https://github.com/manishmeganathan/peerchat

开源编程语言:

Go 94.6%

开源软件介绍:

PeerChat

Banner

A terminal-based P2P chat application using libp2p and Golang that uses a Kademlia DHT and the IPFS network for peer discovery and routing

Version: 1.1.0
Platform: Windows, Mac OSX and Linux
Language: Go 1.16
License: MIT

Overview

The application was inspired by chat examples found on libp2p's pubsub library, but is more evolved and fully featured version of it.
It uses a Kademlia DHT from libp2p for peer discovery and routing and supports a more fully featured host. The other components of the libp2p such as TLS encryption, peer active discovery, YAMUX stream multiplexing are integrated as well.

The application also allows users to jump between different chat rooms without having to restart the application and they can also change their usernames at any point.

The application works for two nodes on the same network or on different networks. Nodes that are behind NATs on private network are able to communicate with each other because the application attempts to configure the router automatically using UPnP and also uses AutoRelay (TURN) to facilitate the connection between private nodes by discovering relay nodes and connecting to them.

Note: Communcation between nodes on different private networks works only from v1.1.0.

Dependancies

libp2p

libp2p is a modular network stack library born out of The IPFS Project.
PeerChat's P2P and GossipSub layers are built using the Go implementation of libp2p.

go-libp2p Repository
libp2p Documentation

tview

tview is terminal UI library written in Golang with a collection of rich, interactive widgets.
PeerChat's UI layer is built using tview and tcell.

tview Repository
tcell Repository

Installation

The PeerChat applcation can be installed in one of two ways.

  1. Without Go

    • This method does not require a Go installation on the target system.
    • Download the latest binary/executable for your system platform from the releases
    • Enter the directory where the binary is downlaoded
    • Run the executable/binary

    For Windows

    ./peerchat.exe
    

    For Linux

    sudo chmod +x peerchat
    ./peerchat
    
  2. With Go

    • This method requires Go v1.16 or greater installed on the target system. Install Go
    • This method also uses the make command, which is built in for Linux and can be installed on Windows using choco install make.
    • Clone the PeerChat Repository from here using Git and CD into it.
    git clone https://github.com/manishmeganathan/peerchat.git 
    cd peerchat
    
    • Run the install command on a linux based shell (Git Bash for Windows)
    make install
    
    • The application is now installed and can be invoked anywhere in the system.
    peerchat
    
    • Alternatively, the application can be simply started using
    go run .
    

Usage

When the PeerChat application is invoked without any flags, it joins the lobby chat room as a user named newuser. This can be modified by passing the -user and -room flags.

The following starts the application and joins the mychatroom chat room as a user named manish.

peerchat -user manish -room mychatroom

The method of peer discovery method can be modified using the -discover flag. Valid values are announce and advertise. The application defaults to the advertise. This value should only changed if peer connections aren't being established with the default method.

The loglevel for the application startup runtime can be modified using the -log flag. Valid values are trace, debug, info, warn, error, fatal and panic. The application defaults to info. This value is meant for development and debuggin only.

Future Development

  • Support for QUIC and WebSocket transports
  • Migrate to Protocol Buffers instead of JSON for message encoding
  • Chat Room notification for when user changes names
  • Support for other PubSub routers (RandomSub, FloodSub and someday EpiSub)
  • Support for password protected Chat Rooms.



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap