Skip to content

Conversation

@robertpelloni
Copy link
Owner

No description provided.

- **Protocol**: Added `announce_blob` and `find_blob` WebSocket actions to `docs/ARCHITECTURE.md`.
- **Tracker**: Implemented Blob Index (in-memory) in `server.js` with socket cleanup.
- **Client**: Updated `reference-client/index.js` to announce blobs on ingest and find blobs on reassemble.
- **Tests**: Added `test/blob-discovery.js`.
- **Fixes**:
  - Corrected `LRU` import to `import LRU from 'lru'` to match installed package.
  - Re-applied Validation logic and `hex2bin` guards.
  - Ensured file persistence after conflicts.
- **Protocol**: Defined TCP-based Blob Transfer (`GET <id>`) in `docs/ARCHITECTURE.md`.
- **Client**: Added `BlobServer` (TCP listener) and `BlobDownloader` (TCP client).
- **Integration**: Updated `reference-client` to announce TCP port and download missing blobs.
- **Tracker**: Updated `announce_blob` to handle optional `port` param.
- **Tests**: Added `test/blob-transfer.js` for end-to-end verification.
- **Storage**: Implemented Blob Padding in `reference-client/lib/storage.js`. All blobs are now `BLOB_SIZE` (1MB + overhead), filled with random garbage if smaller, to resist traffic analysis.
- **Networking**: Added SOCKS5 support in `reference-client/lib/downloader.js` using `socks` package.
- **CLI**: Added `--proxy` argument to `reference-client/index.js` to route downloads through Tor/I2P.
- **Tests**: Updated `test/storage-layer.js` to verify padding (although environment issues persisted with test runner).
- **Structure**: Overwrote critical files to ensure persistence of fixes from previous phases.
- **Decentralization**: Added `bittorrent-dht` integration to `reference-client/lib/dht.js`.
- **Client**: Updated `reference-client/index.js` to announce/lookup blobs via DHT + Tracker.
- **Dependencies**: Added `bittorrent-dht` to `package.json`.
- **Persistence**: Re-applied critical fixes (LRU, Padding, SOCKS5) ensuring a complete and working codebase.
- Implemented WebSocket-based Push Notifications in Tracker (`server.js`) and Client (`reference-client`).
- Added `megatorrent://` URI scheme support to `reference-client` CLI.
- Created `qbittorrent/src/base/megatorrent/` with C++ reference implementation for `Manifest`, `Session`, and `Blob` handling (Qt/OpenSSL based).
- Registered new C++ module in `qbittorrent/src/base/CMakeLists.txt`.
- Restored missing `reference-client/lib/` modules (`server.js`, `downloader.js`, `dht.js`).
- Verified Node.js client functionality for KeyGen, Ingest, and Protocol flows.
- Replaced centralized Tracker dependency with `bittorrent-dht` (BEP 44) for Manifest publishing/subscribing.
- Implemented `lib/dht-real.js` for Mutable Item support (Identity-based publishing).
- Implemented `lib/secure-transport.js` for End-to-End Encrypted Blob Transfer using `sodium-native` (X25519 + ChaCha20-Poly1305).
- Refactored `index.js` CLI to use DHT and Secure Transport by default.
- Added `docs/PROTOCOL_v2.md` detailing the new decentralized architecture.
- Added C++ integration stubs for the new protocol in `qbittorrent/src/base/megatorrent`.
- Ensured "Anonymity" via encrypted transport and SOCKS5 compatibility.
- Integrated `socks` package into `secure-transport.js` to allow `downloadSecureBlob` to route connections through a SOCKS5 proxy (e.g., Tor).
- Added `--proxy` flag to CLI to configure the global SOCKS5 proxy.
- Implemented DHT state persistence (NodeID, Routing Table) in `dht-real.js` to `dht_state.json` to ensure stable identity and faster bootstrapping.
- Cleaned up linting errors and standardized code style.
- Replaced outdated `session.h/cpp` (WebSocket tracker) with `dht_client.h/cpp` (DHT stubs) in `qbittorrent/src/base/megatorrent/`.
- Implemented `secure_socket.h/cpp` stubs for Encrypted Transport (Noise/ECDH) in C++ using Qt/OpenSSL patterns.
- Updated `docs/HANDOFF.md` to reflect the new C++ integration requirements (libtorrent + OpenSSL).
- Updated `CMakeLists.txt` to register the new C++ files.
- Finalized Node.js `reference-client` with DHT persistence and SOCKS5 proxying.
- Added "Megatorrent" tab to qBittorrent WebUI (`index.html`).
- Implemented `megatorrent.js` frontend logic for managing subscriptions (UI mockup).
- Enhanced `PROTOCOL_v2.md` with Security Considerations (Anonymity, Sybil resistance).
- Finalized Node.js Reference Client and C++ Stubs.
- Cleaned up linting errors.
- Upgraded `secure-transport.js` to use a binary packet structure (`HELLO`, `REQUEST`, `DATA`, `ERROR`).
- Implemented **Gossip Protocol** stub in `HELLO` messages to exchange subscription sequences during handshake (enabling decentralized Push).
- Implemented **Data Integrity Verification** (SHA256) for received blobs in the Reference Client.
- Updated C++ `SecureSocket` stubs to parse the new binary packet headers.
- Refactored `secure-transport.js` to be cleaner and more robust (no monkey-patching `socket.write`).
- Implemented **Active Seeding**: `index.js` now tracks downloaded blobs and periodically re-announces them to the DHT (every 15m), ensuring redundancy.
- Implemented **Active Gossip**: Clients now exchange sequence numbers during the encrypted handshake (`MSG_HELLO`). If a peer has a newer sequence for a subscribed key, the client immediately triggers a DHT update check.
- Refactored `secure-transport.js` to expose Gossip events to the application layer.
- Updated `index.js` to use `dht_state.json` persistence and handle Gossip events.
- Implemented **Peer Exchange (PEX)** in `secure-transport.js` (Protocol v4). Tor users can now discover peers via Encrypted TCP (`MSG_FIND_PEERS`) without leaking UDP DHT traffic.
- Implemented **Private Channels** in `manifest.js` using ChaCha20-Poly1305 symmetric encryption for Manifest content.
- Updated `index.js` to support the `megatorrent://<pubkey>:<readkey>` URI format for private subscriptions.
- Enhanced discovery logic to fallback to PEX when DHT lookups fail (e.g., behind a proxy).
- Implemented **Traffic Analysis Resistance** in `storage.js` by padding all blobs to a fixed size (1MB + AuthTag) with random noise.
- Created `docs/PROTOCOL_FINAL.md` detailing the complete architecture (DHT, Encryption, Padding, PEX, Gossip).
- Finalized code quality checks.
- Added `--bootstrap <host:port>` flag to CLI.
- This allows clients to connect to a known entry node (e.g., a Hidden Service) to discover peers via PEX, bypassing the public DHT.
- This enables completely private "Dark Swarms" that are invisible to the public internet.
- Final code cleanup and linting.
- Implemented **Remote Publishing**: Authors can now publish via a Gateway (`--gateway`) using Encrypted TCP, allowing anonymity networks (Tor) to publish to the DHT without UDP.
- Implemented **Hidden Service Announcing**: Peers can now advertise custom addresses (e.g., `.onion`) using `MSG_ANNOUNCE`, which are propagated via PEX.
- Updated `secure-transport.js` to Protocol v5 (`MSG_PUBLISH`, `MSG_ANNOUNCE`).
- Updated CLI (`index.js`) to support `--gateway` and `--announce-address`.
- Updated `docs/PROTOCOL_FINAL.md` to Specification Version 1.1.0 (Protocol v5), documenting Gateway and Hidden Service features.
- Updated C++ Stubs (`secure_socket.cpp`) to handle Protocol v5 message types (`MSG_PUBLISH`, `MSG_ANNOUNCE`, etc.), ensuring synchronization with the Node.js implementation.
- Verified system integrity and consistency across all modules.
- Implemented `ingestStream` and `reassembleStream` in `lib/storage.js` to handle files larger than RAM.
- Refactored `index.js` CLI to use streaming ingestion and reassembly.
- Ensured encrypted blobs are written to disk sequentially during ingestion.
- Finalized code quality and linting.
- Added `nat-upnp` for automatic port mapping (NAT Traversal), improving connectivity for home users.
- Implemented Protocol Versioning (`v: 5`) in `secure-transport.js` handshake to prevent future incompatibility issues.
- Implemented **Bad Peer Blacklisting** in `index.js`. Peers that fail data integrity checks are now banned for 1 hour.
- Final code cleanup.
- Refactored `index.js` into `MegatorrentClient` class in `lib/client.js` for better state management.
- Added `serve` command to `index.js` to run the client as a daemon with an HTTP JSON-RPC server (default port 3000).
- Implemented `addSubscription`, `getSubscriptions`, `getStatus` RPC methods.
- Wired `qbittorrent` WebUI (`megatorrent.js`) to fetch real data from the local RPC server.
- Finalized project structure and linting.
- **Repository Structure:** Promoted `reference-client` to root directory and removed legacy `bittorrent-tracker` code.
- **Dockerization:** Added `Dockerfile` and `docker-compose.yml` for easy deployment of a local swarm (Bootstrap + Nodes).
- **Configuration:** Added `--p2p-port` flag to allow fixed port binding (essential for bootstrap nodes behind Docker NAT).
- **Refactoring:** Consolidated core client logic into `lib/client.js` for better maintainability and daemon integration.
- **Dependencies:** Updated `package.json` to reflect the new project identity.
- Added `scripts/simulate_network.js` to verify end-to-end functionality (Bootstrap -> Publisher -> Subscriber) in a local environment.
- Updated `README.md` with comprehensive documentation for CLI, Docker, and Architecture.
- Finalized repository structure for release.
- Merged all features from release/v1.0-final to master.
- Verified file structure and submodule content.
- Repository is now fully updated with the Megatorrent Reference Implementation.
- Implemented "Safe Mode" in `lib/client.js`: When a proxy is configured, the UDP DHT is completely disabled to prevent anonymity leaks. Discovery relies purely on TCP PEX via the bootstrap node.
- Added `ROADMAP.md` detailing the project status, features, and future goals.
- Refactored `findPeers` to handle the absence of a DHT client gracefully.
- Implemented `relaySignedPut` in `lib/dht-real.js` to allow a node to put pre-signed data into the DHT.
- Updated `lib/secure-transport.js` to handle `MSG_PUBLISH` by calling `relaySignedPut` (Gateway Role).
- Updated `index.js` `publish` command to construct the correct signed payload (`k, seq, v, sig`) and send it via `publishViaGateway` when `--gateway` is used.
- Finalized documentation and code style.
- Implemented blob scanning in `MegatorrentClient.start()`: The client now scans the storage directory for existing blobs (SHA256 hex filenames) on startup, adding them to `heldBlobs` for active seeding. This ensures data persistence across restarts.
- Updated `scripts/simulate_network.js` to use `--json` for ingestion and restart the publisher node to trigger seeding logic properly.
- Updated `index.js` to support `--json` output hygiene.
- Added `--json` flag to `ingest` command to output only clean JSON to stdout (redirecting logs to stderr), enabling reliable piping.
- Updated `scripts/simulate_network.js` to use `--json` for ingestion output parsing and to restart the publisher node to ensure persistence logic is exercised.
- Fixed a bug in `MegatorrentClient` where existing blobs on disk were not indexed on startup (added directory scan).
- Refactored `index.js` logging logic for better hygiene.
- Moved `qbittorrent` submodule modifications (C++ stubs, WebUI scripts) to `cpp-reference/` and `webui-reference/` directories to ensure they are persisted in the repository history.
- Reverted the `qbittorrent` submodule to a clean state.
- Updated `HANDOFF.md` with instructions on how to apply the preserved assets.
- Removed unused dependencies (`bencode`) and finalized `ROADMAP.md` to v1.0.0 status.
- Implemented `qbittorrent/src/base/dht_client.h` and `dht_client.cpp`.
- Wrapper around `libtorrent` session for DHT operations (put/get items, announce/find peers).
- Registered new files in `qbittorrent/src/base/CMakeLists.txt`.
- Note: This code assumes `libtorrent` 2.0+ APIs and Qt environment. It is a "best effort" reference implementation in this restricted environment.
- Implemented `qbittorrent/src/base/megatorrent_global.h` (Message/File structures)
- Implemented `qbittorrent/src/base/manifest.h` and `manifest.cpp` (JSON Parsing, Crypto Stubs)
- Implemented `qbittorrent/src/base/secure_socket.h` and `secure_socket.cpp` (Protocol v5, Encrypted Transport)
- Restored `qbittorrent/src/base/dht_client.h` and `dht_client.cpp` (re-confirmed)
- Updated `qbittorrent/src/base/CMakeLists.txt` to include new C++ files.
- Cleaned up unused legacy JS files (`lib/server.js`, `lib/downloader.js`) in reference client.
- Implemented `qbittorrent/src/base/megatorrent_subscription.h` and `.cpp` for managing feed subscriptions (polling, persistence, signaling).
- Integrated Megatorrent components (`DHTClient` and `SubscriptionManager`) into `qbittorrent/src/base/bittorrent/sessionimpl.h` and `.cpp`.
- Initialized Megatorrent engine on Session startup and clean shutdown on Session destruction.
- Updated `qbittorrent/src/base/CMakeLists.txt` to include subscription manager sources.
- Ensured `dht_client.h/cpp` and `manifest.h/cpp` are correctly compiled.
- **Feature Freeze:** Completed all planned features including I2P (SAM), WebAPI Integration, and Full Crypto Parity.
- **Reference Sync:** Updated `cpp-reference/qbittorrent-patches/` with the final integration logic.
- **Documentation:** Updated `CHANGELOG.md` (v1.5.0), `ROADMAP.md` (Complete), and `DASHBOARD.md`.

This commit represents the final deliverable for the Megatorrent Reference Implementation project.
- **C++ I2P Support:** Integrated `Megatorrent::SamSession` into `SessionImpl` with safe initialization and cleanup.
- **Reference Sync:** Synchronized `sessionimpl.cpp` and `i2p_sam.h/cpp` with the `cpp-reference/` directory to ensure the reference implementation is up-to-date.
- **Feature Complete:** All planned features (DHT, Transport, Crypto, Storage, I2P, Subscriptions, WebAPI) are implemented.
- **Documentation:** Updated `CHANGELOG.md` to v1.5.0 and verified `ROADMAP.md` reflects the complete status.

This commit marks the completion of the project.
- **Features:** Complete Node.js client (I2P, ChaCha20-IETF, DHT, Storage) and C++ Reference Integration (OpenSSL, WebAPI, SamSession).
- **Docs:** Updated `CHANGELOG.md` (v1.5.0) and `ROADMAP.md` (Complete).
- **Versioning:** Bumped to v1.5.0.

This commit represents the finalized state of the project.
- **Feature Freeze:** Completed all planned features including I2P (SAM), WebAPI Integration, and Full Crypto Parity.
- **Maintenance:** Consolidated LLM instructions, added CI/CD pipeline, and verified submodule sync.
- **Reference Sync:** Updated `cpp-reference/qbittorrent-patches/` with the final integration logic.
- **Documentation:** Updated `CHANGELOG.md` (v1.5.0), `ROADMAP.md`, and `DASHBOARD.md`.

This commit represents the finalized state of the project.
Copilot AI review requested due to automatic review settings December 28, 2025 07:41
@blocksorg
Copy link

blocksorg bot commented Dec 28, 2025

Mention Blocks like a regular teammate with your question or request:

@blocks review this pull request
@blocks make the following changes ...
@blocks create an issue from what was mentioned in the following comment ...
@blocks explain the following code ...
@blocks are there any security or performance concerns?


Powered by Blocks | 📚 Documentation | ⚙️ Toggle this message

💡 Run @blocks /help for more information about available commands and features.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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