nostr-rs-relay icon indicating copy to clipboard operation
nostr-rs-relay copied to clipboard

Tor support

Open dskvr opened this issue 3 years ago • 16 comments

Are there plans to include tor support as there is in nostr-ts-relay ?

Great work btw, lean and mean.

dskvr avatar Nov 18 '22 16:11 dskvr

I'm really not sure what that would involve. Is there something you could point me to with respect to adding Tor support for network servers? I guess I always thought it would just be run behind some Tor-aware proxy or something.

scsibug avatar Nov 26 '22 14:11 scsibug

it seems like the typescript implementation has tor support... maybe this will help?

islandbitcoin avatar Dec 20 '22 23:12 islandbitcoin

Should be as simple as adding socks5 support for your http client

dr-bonez avatar Dec 20 '22 23:12 dr-bonez

@scsibug Early on, I looked into this. No tor proxy daemons I could find supported websockets. I tested the most 'Tor-Proxy' and confirmed that this was true. @dr-bonez Maybe, I gave it a go and was unable to connect successfully. Unfortunately I timeboxed myself and ran out of time.

dskvr avatar Dec 23 '22 12:12 dskvr

That's too bad. I guess I'll close this. If someone gets it working, I'm open to merging.

Thanks for the effort!

scsibug avatar Dec 23 '22 13:12 scsibug

https://github.com/scsibug/nostr-rs-relay/pull/30 - @dr-bonez seems to have it working, check the PR

islandbitcoin avatar Dec 23 '22 13:12 islandbitcoin

#30

Do you think this patch is enough for working Tor support?

scsibug avatar Dec 23 '22 13:12 scsibug

I do, but haven't personally tested it

islandbitcoin avatar Dec 23 '22 13:12 islandbitcoin

If there is interest in Tor, and someone can test, I'm happy to merge. But I'd rather see that happen first, since I don't want someone else going down a rabbit hole thinking this should work.

scsibug avatar Dec 23 '22 13:12 scsibug

@dskvr I'm curious what you're talking about. What sort of client are you using? Tor is a tcp based protocol, so nothing special needs to happen to support websockets. Were you using an http proxy for Tor instead of the recommended socks5 proxy?

dr-bonez avatar Dec 23 '22 18:12 dr-bonez

@dr-bonez I did not test a socks5 proxy. Wish I could tell you more, it was about a month ago, was a short research spike and a lot has happened since then :D

dskvr avatar Dec 23 '22 23:12 dskvr

Nothing needs to happen server side to support websockets over Tor. The referenced pr only matters for NIP-05 verification against onion services.

Your client needs to support tor in order for it to work. You can use a system wide socks proxy, or something like torsocks if your client doesn't support socks5 natively.

dr-bonez avatar Dec 23 '22 23:12 dr-bonez

I can test this whenever someone comes up with a viable test scenario... Seems this would only be needed for "nip-05 verification against onion services"... how does one accomplish this?

chrisguida avatar Dec 28 '22 17:12 chrisguida

@dr-bonez ^

chrisguida avatar Dec 28 '22 17:12 chrisguida

This might help? https://nostrplebs.com

islandbitcoin avatar Dec 29 '22 01:12 islandbitcoin

That's not hosted on a .onion so I'm not sure how much it would help

dr-bonez avatar Dec 29 '22 16:12 dr-bonez