Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for listening on hidden service #19

Closed
binarybaron opened this issue Nov 18, 2024 · 4 comments · Fixed by #24
Closed

Add support for listening on hidden service #19

binarybaron opened this issue Nov 18, 2024 · 4 comments · Fixed by #24

Comments

@binarybaron
Copy link
Contributor

We should make it possible to listen on an /onion/xxxxx multi address. art_client has stable support for running a hidden service (example).

@binarybaron binarybaron changed the title Add support for listening on onion service Add support for listening on hidden service Nov 18, 2024
@umgefahren
Copy link
Owner

That's a great idea! Would you like to push it?
It was a long standing plan for this crate to support this but at the time of writing Arti didn't support it.

@binarybaron
Copy link
Contributor Author

I'd love to.

Can you give me some pointers as to how to best implement this? I'm still learning when it comes to libp2p.

Some questions that come to mind:

  • Is it possible for a transport to announce a new listen address? Can the transport tell the swarm which onion address it wants to listen on?
  • Are /onion/ addresses already defined somewhere or do I need to implement this myself?

@umgefahren
Copy link
Owner

umgefahren commented Nov 20, 2024

I'd love to help!

  • Is it possible for a transport to announce a new listen address? Can the transport tell the swarm which onion address it wants to listen on?

It's not possible to tell the transport directly what to listen on, but that's not really a problem. For example a swarm with tcp transports is seldom instructed to listen on anything else then 0.0.0.0. But it doesn't matter since the transport announces the concrete listen address (like 192.168.2.1) with the TransportEvent. I would go the same way with the hidden services. Instruct to listen on a generic or reserved onion address (you have to look that up if that exists) and then the transport would tell the swarm.

  • Are /onion/ addresses already defined somewhere or do I need to implement this myself?

They are implemented as a Protocol in multiaddr. Look at the Onion and Onion3 variant. They shoud be correct and sufficient. You would be the first one to actually use them!

This should be the corresponding type in Arti: https://tpo.pages.torproject.net/core/doc/rust/tor_hsservice/struct.HsId.html. I'm not quite sure what to do with the extra 3 bytes if I'm completely honest with you.

@binarybaron
Copy link
Contributor Author

This should be the corresponding type in Arti: https://tpo.pages.torproject.net/core/doc/rust/tor_hsservice/struct.HsId.html. I'm not quite sure what to do with the extra 3 bytes if I'm completely honest with you.

The extra bytes are a checksum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants