cyphernet-labs / rust-internet2

Set of rust crates for software supporting Internet2 (Tor, Noise protocol, lightning network-style messaging)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connect to hidden service through socks5 proxy

TheCharlatan opened this issue · comments

I would like to connect a Brontide or Brontozaur session to a hidden service. This is typically done through a socks5 proxy. Currently I don't see a way to do that with the current state of this crate (though I may be mistaken).

The socks crate allows its user to create a Socks5Stream, which is similar to a TcpStream of the std library. A TcpStream is also what runs the connection currently used for both Brontide and Brontozaur. Once a Socks5Stream is established and connected, it can be consumed and transformed into a TcpStream.

Currently it is possible to re-create the low-level types to establish a BrontozaurSession. However the members of the BrontozaurSession are private to the Session module, so it can't be re-created from scratch with an injected Socks5Stream.

In order to support connecting to a hidden service, I thus see three possibilities. Either make the members of the Session public, or pass in a user-defined existing TcpStream, or create a Socks5Stream in the encrypted connection module if a Onion address is provided. The last option would also require an additional proxy address to be passed in.

@dr-orlovsky I am keen to implement any of these options, do you have an opinion here?

Sorry for a late reply, had a number of conference talks in a row.

Thank you for proposing solution to this. I think the best way forward will be adding a new constructor to the BrontozaurSession which will take an Onion address and will do all dirty work internally, finally instantiating the self with TcpStream internally. What do you think?