Crates.io | tentacle |
lib.rs | tentacle |
version | |
source | src |
created_at | 2019-02-27 07:55:14.044148+00 |
updated_at | 2025-04-03 08:21:34.665717+00 |
description | Minimal implementation for a multiplexed p2p network framework. |
homepage | |
repository | https://github.com/nervosnetwork/tentacle |
max_upload_size | |
id | 117531 |
Cargo.toml error: | TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
This is a minimal implementation for a multiplexed p2p network based on yamux
that supports mounting custom protocols.
+----+ +----------------+ +-----------+ +-------------+ +----------+ +------+
|user| <--> | custom streams | <--> |Yamux frame| <--> |Secure stream| <--> |TCP stream| <--> |remote|
+----+ +----------------+ +-----------+ +-------------+ +----------+ +------+
All data is passed through the futures channel, yamux
splits the actual tcp/websocket stream into multiple substreams,
and the service layer wraps the yamux substream into a protocol stream.
Detailed introduction: 中文/English
Note: It is not compatible with
libp2p
.
The API of this project is basically usable. However we still need more tests. PR is welcome.
The codes in the protocols/
directory are no longer maintained and only used as reference
[dependencies]
tentacle = { version = "0.6.0" }
$ git clone https://github.com/nervosnetwork/tentacle.git
Listen on 127.0.0.1:1337
$ RUST_LOG=simple=info,tentacle=debug cargo run --example simple --features ws -- server
$ RUST_LOG=simple=info,tentacle=debug cargo run --example simple
You can see more detailed example in these three repos:
$ cd tentacle && RUST_LOG=info cargo run --example simple --features ws -- server
$ cd simple_wasm && wasm-pack build
$ npm install && npm run serve
all wasm code generate from book
Use a browser to visit http://localhost:8080/
Now you can see the connection on the server workbench or on browser's console
Implementations in other languages
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.