Open bitcynic opened 1 month ago
First of all thanks for the suggestion and the effort put in this issue.
The feature is very interesting but I have some doubts about the implementation side. You mentioned the tor-control
library, do you mean this tor_control
library?
If so I have some concerns about it, since it seems just an initial implementation (10 commits) and unmaintained (last update is from 2016).
To better frame this proposal, is the proposed code a suggestion or have you tried to run it as well?
Hi Zoe, first of all, thank you for the feedback.
You are right, the correct library name is with an underscore and not a hyphen, it is my typo. You are also right about your concerns about its use. The alternative for creating Onion Services would be the other library mentioned: arti
which is maintained by the Tor project itself. However, it is little more than experimental at the moment.
In conclusion, these are only suggestions. If there are no approaches that you evaluate better, I can try to implement and run it.
It seems the Rust ecosystem is not completely ready for Tor. arti
for sure seems very promising. Considering the status of RLN and RGB I would wait a little bit more for this feature (assuming it's not a blocker for you), hoping that, when we'll re-evaluate this, arti
will be ready.
Hi Zoe,
after discussing it with the team I would say we can put Tor integration on standby for the time being, i.e. it is not blocking. Definitely using arti
is the most promising one, but as you rightly pointed out in general there are no mature libraries in Rust to interact with Tor. Let's wait for the developments of arti
and RGB. Thank you.
Enhancement: proposal to introduce Tor connection options and hybrid mode
I would like to suggest an enhancement to support connectivity via Tor. This feature will provide users the ability to connect to peers via clearnet, Tor, or a hybrid system (both) as in
^lnd 0.14.0
.Proposed Changes
Args
structure to specify the Tor options updating theLdkUserInfo
structure to include the Tor configuration options.ldk.rs
Update the PeerManager initialization to handle connections via both clearnet and Tor, based on the provided Tor arguments. We will integrate thetokio-socks
library to support Tor connections via an external Tor proxy and thetor-control
library to use the Tor Control Protocol (TorCP) to create an Onion Service for inbound connections again via the external Tor proxy. I do not consider it feasible at this time to use thearti
library for integrating a Tor proxy directly into the application because it is still an unstable library and not comparable in security to the C implementation of the Tor daemon. Also,arti
is not yet able to give full support to Onion Service, so we would be limited in handling inbound connections.Explanation of changes in
start_ldk
Tor Configuration:
Proxy Handling:
Listeners:
Event Handling:
Testing
To ensure the proper functioning of a minimal implementation:
--tor-active true
and verify it connects via Tor.--tor-active true
--tor-skip-proxy-for-clearnet-targets true
and verify it can connect via both methods.--tor-active
false and verify it connects via clearnet.