updates README

This commit is contained in:
Marcin Czenko 2026-05-05 05:42:47 +02:00
parent f86f580965
commit b084d99c3d
No known key found for this signature in database
GPG Key ID: A0449219BDBA98AE

View File

@ -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
@ -14,12 +26,25 @@ From a fresh clone:
```bash
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
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
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.develop`
- `nimcache/`
- `mix_ping`
- `mix_ping_tcp`
- `mix_ping_quic`
- `multiple_transports_example`
## Clean Rebuild
To verify the project can be rebuilt from committed files:
```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
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