35 lines
854 B
Markdown
35 lines
854 B
Markdown
# nu-p2p — CLAUDE.md
|
||
|
||
P2P ağ katmanı. `nu-node`'dan ayrı tutulur — test ederken network mock'lanabilir.
|
||
|
||
## Stack
|
||
|
||
- `libp2p 0.54` — Gossipsub, Kademlia DHT, Identify, Ping
|
||
- Tokio async runtime
|
||
|
||
## Modüller
|
||
|
||
| Dosya | Sorumluluk |
|
||
|-------|-----------|
|
||
| `behaviour.rs` | libp2p `NetworkBehaviour` kompozisyonu |
|
||
| `messages.rs` | Gossip topic sabitleri + mesaj tipleri |
|
||
| `peer.rs` | PeerRegistry (max 50 bağlantı) |
|
||
| `config.rs` | Listen addr, bootstrap peers, max peers |
|
||
|
||
## Gossip Topics
|
||
|
||
```
|
||
nu/blocks/1 → BlockAnnounce, BlockRequest, BlockResponse
|
||
nu/txs/1 → TxGossip
|
||
nu/votes/1 → VoteAnnounce
|
||
nu/validators/1 → ValidatorHeartbeat
|
||
```
|
||
|
||
## Geliştirme
|
||
|
||
```bash
|
||
cargo run --bin nu-p2p
|
||
|
||
# Faz 1: iki node arası gossip testi
|
||
RUST_LOG=debug cargo run --bin nu-p2p -- --bootstrap /ip4/127.0.0.1/tcp/30333
|
||
```
|