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

Support proxy and onion #392

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

eval-exec
Copy link
Collaborator

@eval-exec eval-exec commented Dec 18, 2024

This PR introduces and supports Onion3 multiaddr for tentacle-multiaddr and adds socks5 proxy support for tentacle dialing. It also allows tentacle to connect to a Tor server to reach an onion address.

A breaking change introduced is:

  1. Changing

    pub(crate) type TcpSocketConfig =
        Arc<dyn Fn(TcpSocket) -> Result<TcpSocket, std::io::Error> + Send + Sync + 'static>;

    to:

    pub(crate) type TcpSocketTransformer =
        Arc<dyn Fn(TcpSocket) -> Result<TcpSocket, std::io::Error> + Send + Sync + 'static>;
    
    pub(crate) struct TcpSocketConfig {
        pub(crate) socket_transformer: TcpSocketTransformer,
        pub(crate) proxy_config: Option<ProxyConfig>,
    }
  2. Adding an Onion variant to the TransportType enum and implementing OnionTransport.

  3. Allow runtime::connect to use a socks5 proxy for connecting to the target address.

  4. Add runtime::connect_onion to connect to a target address of the Multiaddr type, rather than just a SocketAddr, since tentacle cannot convert an onion address into a SocketAddr.

@eval-exec eval-exec force-pushed the exec/proxy-and-onion branch 3 times, most recently from 0b06264 to 36312c5 Compare December 18, 2024 08:05
@eval-exec eval-exec marked this pull request as ready for review December 18, 2024 08:10
@eval-exec eval-exec requested a review from driftluo as a code owner December 18, 2024 08:10
@eval-exec eval-exec force-pushed the exec/proxy-and-onion branch 8 times, most recently from d41cd7a to 0312d4b Compare December 19, 2024 05:54
@eval-exec eval-exec marked this pull request as draft December 19, 2024 05:55
@eval-exec eval-exec force-pushed the exec/proxy-and-onion branch 4 times, most recently from 6b1f15f to f620bfe Compare December 23, 2024 08:13
@eval-exec eval-exec force-pushed the exec/proxy-and-onion branch 2 times, most recently from 73e178c to a341d27 Compare February 20, 2025 04:58
@eval-exec eval-exec force-pushed the exec/proxy-and-onion branch 2 times, most recently from 0bd891a to f338466 Compare March 4, 2025 08:34
Signed-off-by: Eval EXEC <execvy@gmail.com>
Signed-off-by: Eval EXEC <execvy@gmail.com>
@eval-exec eval-exec force-pushed the exec/proxy-and-onion branch 4 times, most recently from 3f8d867 to 4000bf1 Compare March 12, 2025 07:25
@eval-exec eval-exec force-pushed the exec/proxy-and-onion branch 4 times, most recently from 35f76e1 to 624171d Compare March 13, 2025 04:52
@eval-exec eval-exec marked this pull request as ready for review March 13, 2025 06:31
@@ -162,7 +166,7 @@ mod os {

fn listen(self, address: Multiaddr) -> Result<Self::ListenFuture> {
match find_type(&address) {
TransportType::Tcp => {
TransportType::Tcp | TransportType::Onion => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

onion should return Err(TransportErrorKind::NotSupported(address))

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you, Fixed.

Signed-off-by: Eval EXEC <execvy@gmail.com>
Signed-off-by: Eval EXEC <execvy@gmail.com>
Signed-off-by: Eval EXEC <execvy@gmail.com>
Signed-off-by: Eval EXEC <execvy@gmail.com>
…ocket and return a Result<TcpSocket>

Signed-off-by: Eval EXEC <execvy@gmail.com>
Signed-off-by: Eval EXEC <execvy@gmail.com>
Signed-off-by: Eval EXEC <execvy@gmail.com>
Signed-off-by: Eval EXEC <execvy@gmail.com>
Signed-off-by: Eval EXEC <execvy@gmail.com>
@eval-exec eval-exec force-pushed the exec/proxy-and-onion branch from 624171d to 268b79b Compare March 14, 2025 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

2 participants