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

feat: Listen on onion-service, dial onion services #24

Merged

Conversation

binarybaron
Copy link
Contributor

@binarybaron binarybaron commented Nov 20, 2024

This PR adds support for listening on onion services (/onion3/*:x/ addresses, where * is an onion address and x an arbitrary port)

It also add support for dialing them.

Closes #19

@binarybaron binarybaron force-pushed the feat/listen-hidden-service branch from 2f3020b to fefca98 Compare November 21, 2024 14:33
@binarybaron
Copy link
Contributor Author

@umgefahren This works as a proof-of-concept. Can you take a look regarding the general direction this PR is going?

# Starts listening on an onion service
cargo run --example ping-onion

# Connect to the onion service (adjust peer id and onion address)
cargo run --example ping-onion /onion3/nqxrqep7hqagkhs2x3l5vykzjhh3icov4yeukngwtype3hr7ys2inqid:9999/p2p/12D3KooWREFBSvaPqzdiCjaqC9jnySdQfecCUD9w8e1uztVJPLYF

@binarybaron binarybaron changed the title feat: Listen on hidden-service feat: Listen on hidden-service, dial onion service Nov 21, 2024
@binarybaron binarybaron changed the title feat: Listen on hidden-service, dial onion service feat: Listen on hidden-service, dial onion services Nov 21, 2024
@binarybaron
Copy link
Contributor Author

@Einliterflasche You can give this a review as well once it's ready.

@umgefahren
Copy link
Owner

I think you are going in the right direction. Although I would suggest you put this behind a feature gate

@binarybaron binarybaron force-pushed the feat/listen-hidden-service branch from 673f6ee to f4e71fa Compare November 24, 2024 14:08
@binarybaron binarybaron marked this pull request as ready for review November 24, 2024 14:14
@binarybaron
Copy link
Contributor Author

@umgefahren @Einliterflasche This is ready for review

@binarybaron binarybaron changed the title feat: Listen on hidden-service, dial onion services feat: Listen on onion-service, dial onion services Nov 25, 2024
@binarybaron binarybaron force-pushed the feat/listen-hidden-service branch from e050f37 to 6295fba Compare November 26, 2024 14:23
@binarybaron binarybaron force-pushed the feat/listen-hidden-service branch from 6295fba to 0a973c8 Compare November 26, 2024 14:27
@binarybaron
Copy link
Contributor Author

@umgefahren Do you have time to give this a review?

@umgefahren umgefahren self-requested a review November 28, 2024 20:30
Copy link
Owner

@umgefahren umgefahren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some night pick. Otherwise LGTM 🚀

Comment on lines +133 to +134
// TODO: We need to do this because otherwise the status of the onion service is gonna be [`Shutdown`]
// when we first poll it and then the swarm will not pull it again (?). I don't know why this is the case.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look into this. But this can also be fixed later.

@umgefahren umgefahren merged commit d9095d8 into umgefahren:main Nov 28, 2024
8 checks passed
binarybaron added a commit to UnstoppableSwap/core that referenced this pull request Dec 3, 2024
This pull requests
- Adds rust native support for the `asb` to listen on an onion service. Previously we were depedent on a seperately running `torc` client. Instead we now use [arti](https://tpo.pages.torproject.net/core/arti/), a rust implementation of the tor protocol.
- Removes the `tor.control_port` and `tor.socks5_port` property from the config of the `asb`
- Adds a new `tor.register_hidden_service` boolean property to the config of the `asb` which when enabled automatically runs a hidden service at startup
- Adds a new `tor.hidden_service_num_intro_points` config property to specify how many introduction points to register the onion service at
- Adds support for the `cli` to dial onion addresses

This is dependent on umgefahren/libp2p-tor#24

Closes #16
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 this pull request may close these issues.

Add support for listening on hidden service
2 participants