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

InetAddr: Use onion addresses instead of public keys #31

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TheCharlatan
Copy link
Contributor

@TheCharlatan TheCharlatan commented Nov 17, 2022

I'm opening this PR to discuss the format of the Tor address variants. This change reflects how I would reason about them. I'm curious what the original reasoning behind the design of the type was. If there is another / better approach to this, I'm very open to implement that instead.

Define new Tor enum inner types for the InetAddr PartialSocketAddr, and InetSocketAddr types. Replace the usage of the TorPublicKeyV3 with OnionAddressV3. While the two types are interchangeable, OnionAddressV3 is the human-readable format. For encoding purposes, OnionAddressV3 is converted to TorPublicKeyV3 in order to save some space.

Additionally, adds port numbers to the PartialSocketAddr and InetSocketAddr tor variants. This allows users to specify a specific port on which an onion address is listening.

Define new Tor enum inner types for the `InetAddr` `PartialSocketAddr`, and
`InetSocketAddr` types. Replace the usage of the `TorPublicKeyV3` with
`OnionAddressV3`. While the two types are interchangeable,
`OnionAddressV3` is the human-readable format. For encoding purposes,
`OnionAddressV3` is converted to `TorPublicKeyV3` in order to save some
space.

Additionally, adds port numbers to the `PartialSocketAddr` and
`InetSocketAddr` tor variants. This allows users to specify a specific
port on which an onion address is listening.
@dr-orlovsky
Copy link
Member

dr-orlovsky commented Nov 18, 2022

I have recently discovered that the whole design I have in iner2_addr does not allow to efficiently work with Tor or SOCKS5 proxies. That's why I have already started a redesign of the address system API in https://github.com/Internet2-WG/rust-cyphernet/tree/master/src/addr

Please have a look there and let me know what do you think.

Example usage can be found here: https://github.com/Internet2-WG/rust-netservices/blob/master/nsh/src/main.rs

Specifically, this piece uses the address system:
https://github.com/Internet2-WG/rust-netservices/blob/6b40268ef7ae5780f958cdbd7a0a45fa4d309e2b/nsh/src/main.rs#L44-L56

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.

2 participants