Skip to content

feat: add NAT-traversing P2P file sharing example#1220

Open
GautamBytes wants to merge 3 commits intolibp2p:mainfrom
GautamBytes:feat/p2p-file-share-nat
Open

feat: add NAT-traversing P2P file sharing example#1220
GautamBytes wants to merge 3 commits intolibp2p:mainfrom
GautamBytes:feat/p2p-file-share-nat

Conversation

@GautamBytes
Copy link
Contributor

What was wrong?

The repository lacked a practical, runnable example demonstrating serverless, peer-to-peer file sharing across NATs with local peer persistence, as requested in the product-innovation bounty.

Issue #877

How was it fixed?

Added a lightweight, serverless file-sharing application under examples/file-share/ that fulfills the exact requirements of the issue.

Summary of approach.

  • NAT Traversal: Leveraged the library's built-in capabilities by initializing the host with enable_upnp=True. The CLI visually splits Local IPs and Public IPs on startup to prove hole-punching success.

  • Peer Persistence: Implemented a lightweight peerstore alternative using a local friends.json file. This acts as a "Contacts List," allowing the user to persist and instantly reconnect to known peers across restarts without needing to rely on external DHT or bootstrap nodes.

  • Stream Protocol: Implemented a custom, chunk-based binary stream protocol (/file-share/1.0.0) over trio to transfer file metadata (name, size) and safely stream file data directly to disk without bloating RAM.

To-Do

  • Clean up commit history
  • Add or update documentation related to these changes
  • Add entry to the release notes

Cute Animal Picture

ʕ•ᴥ•ʔ

Gautam Manchandani and others added 3 commits February 14, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments