Skip to content

feat(http_client): move to opendht's builtin HTTP proxy - #34

Merged
sim590 merged 10 commits into
sim590:masterfrom
jaja360:add_systemd_dht
Oct 1, 2026
Merged

sim590 merged 10 commits into
sim590:masterfrom
jaja360:add_systemd_dht

Conversation

@jaja360

@jaja360 jaja360 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

This pull request introduces significant improvements to how dpaste interacts with OpenDHT, providing a more robust and efficient DHT proxy setup. The main changes include adding support for an optional persistent local OpenDHT proxy via a systemd user unit, updating documentation and configuration to reflect this, and refactoring HTTP client interactions to use a new JSON-based API with base64 encoding. Additionally, installation scripts are updated to install the new systemd unit.

DHT Proxy Integration and Systemd Unit:

  • Added a new dpaste-dhtnode.service systemd user unit to run a persistent local OpenDHT proxy, and updated installation scripts (CMakeLists.txt, Makefile.am) to install this unit. [1] [2] [3] [4]
  • Updated documentation in README.md and doc/dpaste.1 to describe how to enable and use the systemd DHT proxy, and clarified the configuration file's host and port settings. [1] [2]

Configuration and Documentation Updates:

  • Updated config/dpaste.conf to clarify that the host and port refer to the OpenDHT DhtProxyServer endpoint.

Codebase Changes for Proxy Support:

  • Refactored the Bin class in src/bin.cpp/src/bin.h to only start a local DHT node if the proxy is unavailable, avoiding unnecessary node startups. Introduced ensureNodeRunning() and a node_running_ flag. [1] [2] [3] [4] [5]

HTTP Client Refactoring:

  • Rewrote HttpClient in src/http_client.cpp to use a new JSON API for the proxy, including base64 encoding/decoding for data transmission, and improved error handling and compatibility with the proxy server. [1] [2] [3]

These changes collectively improve performance, reliability, and usability for users who wish to run a persistent DHT proxy, and modernize the client-server communication protocol.

@sim590
sim590 self-requested a review September 4, 2026 04:48
@sim590 sim590 added this to the 0.5.0 milestone Sep 4, 2026
@sim590 sim590 linked an issue Sep 4, 2026 that may be closed by this pull request
@sim590 sim590 added the roadmap This issue/PR references an item on the roadmap label Sep 4, 2026
@sim590 sim590 modified the milestones: 0.5.0, 1.0.0 Sep 7, 2026
@sim590 sim590 added the breakscompat This change breaks compatibility label Sep 7, 2026
@sim590 sim590 changed the title perf: add a persistant systemd DHT node feat(http_client): move to opendht's builtin HTTP proxy Sep 7, 2026
@sim590 sim590 modified the milestones: 1.0.0, 0.5.0 Sep 7, 2026
Comment thread src/http_client.cpp Outdated
Comment thread src/http_client.cpp Outdated
Comment thread src/http_client.cpp
Comment thread config/dpaste.conf Outdated
Comment thread config/dpaste.conf Outdated
Comment thread src/bin.h Outdated
Comment thread src/bin.cpp Outdated
Comment thread src/http_client.cpp Outdated
Comment thread src/http_client.cpp
Comment thread src/http_client.cpp
Comment thread systemd/dpaste-dhtnode.service Outdated
Comment thread README.md Outdated
Comment thread src/node.h Outdated
Comment thread tests/bin.cpp Outdated

@sim590 sim590 left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

You should also revert deb203d. I think you mixed up some change you meant to do in a preivous PR. Avoiding to run the DHT node when the proxy is available is a good thing. Unless you can show me that this has a negative impact on execution time?

The legacy bootstrap.ring.cx default still works. Changing it deserves its
own PR and discussion.
Adds a --no-proxy flag and a no_proxy argument to Bin::get/paste so the proxy
can be skipped explicitly. The unit tests now use it instead of overriding the
user configuration to steer away from a configured proxy.
@sim590
sim590 merged commit 1a9ce9e into sim590:master Oct 1, 2026
@sim590

sim590 commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Merci pour ce bon travail. Et Vive le Québec libre!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breakscompat This change breaks compatibility enhancement roadmap This issue/PR references an item on the roadmap

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make use of OpenDHT's proxy

2 participants