GithubHelp home page GithubHelp logo

baitcenter / p2p Goto Github PK

View Code? Open in Web Editor NEW

This project forked from driftluo/tentacle

0.0 1.0 0.0 999 KB

A multiplexed p2p network framework that supports custom protocols

Home Page: https://docs.rs/tentacle/0.2.0/tentacle/

License: MIT License

Rust 99.68% Makefile 0.32%

p2p's Introduction

P2P

Build Status image

Overview

This is a minimal implementation for a multiplexed p2p network based on yamux that supports mounting custom protocols.

Architecture

  1. Data stream transmission
+----+      +----------------+      +-----------+      +-------------+      +----------+      +------+
|user| <--> | custom streams | <--> |Yamux frame| <--> |Secure stream| <--> |TCP stream| <--> |remote|
+----+      +----------------+      +-----------+      +-------------+      +----------+      +------+
  1. Code implementation

All data is passed through the futures channel, yamux splits the actual tcp stream into multiple substreams, and the service layer wraps the yamux substream into a protocol stream.

At the same time, support for other protocol(such as websocket) is also planned, but will delay a lot.

Detailed introduction: δΈ­ζ–‡/English

Note: It is not compatible with libp2p.

Status

The API of this project is basically usable. However we still need more tests. PR is welcome.

Usage

From cargo

[dependencies]
tentacle = { version = "0.2", feaures = ["molc"] }

Example

  1. Clone
$ git clone https://github.com/nervosnetwork/p2p.git
  1. On one terminal:

Listen on 127.0.0.1:1337

$ RUST_LOG=simple=info,tentacle=debug cargo run --example simple --feaures molc -- server
  1. On another terminal:
$ RUST_LOG=simple=info,tentacle=debug cargo run --example simple --feaures molc
  1. Now you can see some data interaction information on the terminal.

You can see more detailed example in these two repos: ckb/cita.

Why?

Because when I use rust-libp2p, I have encountered some difficult problems, and it is difficult to locate whether it is my problem or the library itself, it is better to implement one myself.

p2p's People

Contributors

aimeedeer avatar dependabot-support avatar doitian avatar driftluo avatar jjyr avatar keroro520 avatar quake avatar thewawar avatar yejiayu avatar

Watchers

 avatar

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.