mirror of
https://github.com/logos-storage/libp2p-mix-ping-example.git
synced 2026-05-19 09:19:33 +00:00
updates README
This commit is contained in:
parent
f86f580965
commit
b084d99c3d
42
README.md
42
README.md
@ -1,6 +1,18 @@
|
|||||||
# libp2p Mix Example
|
# libp2p Mix Examples
|
||||||
|
|
||||||
Standalone Nim example for running a libp2p Mix protocol ping simulation.
|
Standalone Nim examples for running libp2p Ping over the Mix protocol and for
|
||||||
|
demonstrating a switch with multiple transports.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
This repository contains three runnable examples:
|
||||||
|
|
||||||
|
- `mix_ping_tcp.nim` - sends a Ping through a Mix overlay using TCP transport
|
||||||
|
for the mix nodes and destination.
|
||||||
|
- `mix_ping_quic.nim` - sends a Ping through a Mix overlay using QUIC transport
|
||||||
|
for the mix nodes and destination.
|
||||||
|
- `multiple_transports_example.nim` - creates libp2p switches that support both
|
||||||
|
TCP and QUIC, then runs one Ping preferring QUIC and one Ping preferring TCP.
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
@ -14,12 +26,25 @@ From a fresh clone:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
nimble setup -l
|
nimble setup -l
|
||||||
nim c -r mix_ping.nim
|
nim c -r mix_ping_tcp.nim
|
||||||
```
|
```
|
||||||
|
|
||||||
`nimble setup -l` enables project-local dependency mode, installs dependencies
|
`nimble setup -l` enables project-local dependency mode, installs dependencies
|
||||||
under `nimbledeps/`, and generates `nimble.paths` and `nimble.develop`.
|
under `nimbledeps/`, and generates `nimble.paths` and `nimble.develop`.
|
||||||
|
|
||||||
|
Run the individual examples with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nim c -r mix_ping_tcp.nim
|
||||||
|
nim c -r mix_ping_quic.nim
|
||||||
|
nim c -r multiple_transports_example.nim
|
||||||
|
```
|
||||||
|
|
||||||
|
The Mix examples start several local libp2p nodes, build a Mix overlay, and send
|
||||||
|
a Ping request through that overlay to a destination node. The multi-transport
|
||||||
|
example starts separate client switches for the QUIC-preferred and TCP-preferred
|
||||||
|
pings so that libp2p connection reuse does not hide which transport was selected.
|
||||||
|
|
||||||
## Local Files
|
## Local Files
|
||||||
|
|
||||||
The repository uses `config.nims` to keep Nim build output in the local
|
The repository uses `config.nims` to keep Nim build output in the local
|
||||||
@ -31,16 +56,21 @@ These files and directories are local artifacts and should not be committed:
|
|||||||
- `nimble.paths`
|
- `nimble.paths`
|
||||||
- `nimble.develop`
|
- `nimble.develop`
|
||||||
- `nimcache/`
|
- `nimcache/`
|
||||||
- `mix_ping`
|
- `mix_ping_tcp`
|
||||||
|
- `mix_ping_quic`
|
||||||
|
- `multiple_transports_example`
|
||||||
|
|
||||||
## Clean Rebuild
|
## Clean Rebuild
|
||||||
|
|
||||||
To verify the project can be rebuilt from committed files:
|
To verify the project can be rebuilt from committed files:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
rm -rf nimbledeps nimble.paths nimble.develop nimcache mix_ping
|
rm -rf nimbledeps nimble.paths nimble.develop nimcache \
|
||||||
|
mix_ping_tcp mix_ping_quic multiple_transports_example
|
||||||
nimble setup -l
|
nimble setup -l
|
||||||
nim c -r mix_ping.nim
|
nim c -r mix_ping_tcp.nim
|
||||||
|
nim c -r mix_ping_quic.nim
|
||||||
|
nim c -r multiple_transports_example.nim
|
||||||
```
|
```
|
||||||
|
|
||||||
If `nimble setup -l` reports that it cannot determine the VCS revision, make at
|
If `nimble setup -l` reports that it cannot determine the VCS revision, make at
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user