scsibug / nostr-rs-relay

Mirror of https://sr.ht/~gheartsfield/nostr-rs-relay/
MIT License
565 stars 154 forks source link

Tor support #22

Open dskvr opened 1 year ago

dskvr commented 1 year ago

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

Great work btw, lean and mean.

scsibug commented 1 year ago

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.

islandbitcoin commented 1 year ago

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

dr-bonez commented 1 year ago

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

dskvr commented 1 year ago

@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.

scsibug commented 1 year ago

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

Thanks for the effort!

islandbitcoin commented 1 year ago

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

scsibug commented 1 year ago

30

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

islandbitcoin commented 1 year ago

I do, but haven't personally tested it

scsibug commented 1 year ago

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.

dr-bonez commented 1 year ago

@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?

dskvr commented 1 year ago

@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

dr-bonez commented 1 year ago

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.

chrisguida commented 1 year ago

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 commented 1 year ago

@dr-bonez ^

islandbitcoin commented 1 year ago

This might help? https://nostrplebs.com

dr-bonez commented 1 year ago

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