Blockstream / gdk_rpc

gdk_rpc for bitcoind/liquidd
MIT License
6 stars 7 forks source link

Tor #8

Closed stevenroose closed 5 years ago

stevenroose commented 5 years ago

gdk got tor merged so on top of having wally linked you'll also have tor linked. We will need to call one function exposed on tor, in a similar way to how we do gdk. You can only have one running at any point in time. But you should only run one when you are requested Tor and the socks5 is left empty by the user. If there are multiple sessions, you still have one tor instance at most shared

greenaddress commented 5 years ago

You will need to call into a C function from rust

https://github.com/Blockstream/gdk/blob/796d75d7f203c0469a5519c6b9001f5d7666656d/src/ga_tor.cpp#L509

To call into C you could do something like this https://gist.github.com/RCasatta/9b5a01db5e8520b77e553b1b9879b895

that's just to start tor - then you need to read a cookie and talk to its socket to find out socks5 and state. There may be a rust library/bindings there

greenaddress commented 5 years ago

Note: this requires to optionally accept a datadir paramenter in gdk_init

greenaddress commented 5 years ago

Functions to map:

tor_main_configuration_new tor_main_configuration_set_command_line tor_run_main tor_main_configuration_free

greenaddress commented 5 years ago

No longer necessary