OpenBazaar / openbazaar-go

OpenBazaar 2.0 Server Daemon in Go
MIT License
994 stars 284 forks source link

Gateway (JSON-API) connections via Tor #794

Open botaniver opened 6 years ago

botaniver commented 6 years ago

Please add support for direct Tor connections into the Gateway (JSON-API).

I tried to set my Gateway as /onion/xxxxxxxxxxxxxxxx:4002 but OB failed at start with the following error:

protocol not found in multiaddr

My temporary solution was to revert to the default Gateway, /ip4/127.0.0.1/tcp/4002, and point a HiddenService into it on torrc. Does the job, but connecting through OB's dedicated hidden service seems a better solution. openbazaar-desktop already supports .onion addresses on the "Server IP" field if "Use Tor" is selected.

cpacia commented 6 years ago

Hmm. I'm trying to think of the best way to do this. I suppose it could be made to spin up the gateway server as a hidden service but it might require some significant tinkering because the gateway is actually part of the IPFS library.

Maybe an easier way would be to leave the gateway on /ip4/127.0.0.1/tcp/4002 and then create a hidden service in your torrc file?

HiddenServiceDir /Library/Tor/var/lib/tor/hidden_service/
HiddenServicePort 4002 127.0.0.1:4002

I think that should work.

botaniver commented 6 years ago

Hi @cpacia

Thanks for looking into it.

Maybe an easier way would be to [...] create a hidden service in your torrc file?

As you can read on my post above, that's exactly what I am doing. But IMO it is a workaround and not a definitive solution. As I said, it:

Does the job, but connecting through OB's dedicated hidden service seems a better solution.