Appearance
vix p2p
Run a Vix P2P node (TCP + discovery + optional bootstrap).
Usage
bash
vix p2p --id <node_id> --listen <port> [options]Description
vix p2p starts a peer-to-peer node with:
- TCP transport
- Optional UDP discovery
- Optional HTTP bootstrap registry
- Live stats (TUI mode)
- Structured logging
Designed for testing distributed networking locally or across nodes.
Core Options
bash
--id <node_id> Node id (string, required)
--listen <port> TCP listen port (required)
--connect <host:port> Connect to peer after start
--connect-delay <ms> Delay before connect()
--run <seconds> Auto-stop after N seconds
--stats-every <ms> Stats interval (default: 1000)
--tui <on|off> Single-line live stats (default: auto on TTY)
--quiet Print only final stats
--no-connect Disable auto connect callbacksDiscovery (UDP)
bash
--discovery <on|off> Default: on
--disc-port <port> Default: 37020
--disc-mode <broadcast|multicast> Default: broadcast
--disc-interval <ms> Default: 2000Allows peers on the same network to auto-discover each other.
Bootstrap (HTTP Registry)
bash
--bootstrap <on|off> Default: off
--registry <url> Default: http://127.0.0.1:8080/p2p/v1
--boot-interval <seconds> Default: 15
--announce <on|off> Default: onUsed to:
- Register node presence
- Discover remote peers via registry endpoint
Logging
bash
--log-level <level>Levels:
trace | debug | info | warn | error | critical | offExamples
Single node:
bash
vix p2p --id A --listen 9001Connect two peers:
bash
vix p2p --id A --listen 9001
vix p2p --id B --listen 9002 --connect 127.0.0.1:9001Run for 10 seconds:
bash
vix p2p --id A --listen 9001 --run 10Disable discovery:
bash
vix p2p --id A --listen 9001 --discovery offEnable bootstrap:
bash
vix p2p --id A --listen 9001 --bootstrap onTypical Workflow
Open two terminals:
Terminal 1:
bash
vix p2p --id A --listen 9001Terminal 2:
bash
vix p2p --id B --listen 9002 --connect 127.0.0.1:9001vix p2p enables distributed experimentation without external dependencies.