Skip to content

feat(client): allow passing outgoing traffic through a SOCKS5 proxy#86

Merged
Itsusinn merged 2 commits intoItsusinn:mainfrom
fokx:client-over-socks5
Feb 2, 2026
Merged

feat(client): allow passing outgoing traffic through a SOCKS5 proxy#86
Itsusinn merged 2 commits intoItsusinn:mainfrom
fokx:client-over-socks5

Conversation

@fokx
Copy link

@fokx fokx commented Jan 28, 2026

This could be useful if you want to reach the target tuic-server through another proxy. And usually external tools such as proxychains-ng does not support sockifying UDP traffic.

The SOCKS5 proxy should support UDP. So there is a small pitfall when you use a SOCKS5 proxy that is another tuic-server with an SOCKS5 outbound enabled and its allow_udp is set as false, because UDP over SOCKS5 outbound of tuic-server is not implemented.

@Itsusinn Itsusinn requested a review from Copilot January 28, 2026 19:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for routing outgoing TUIC client traffic through a SOCKS5 proxy, addressing scenarios where external tools like proxychains-ng cannot handle UDP traffic sockification.

Changes:

  • Added SOCKS5 proxy configuration to the relay config with optional username/password authentication
  • Implemented custom SOCKS5 UDP socket adapter for Quinn endpoint to handle UDP-over-SOCKS5
  • Added SOCKS5 handshake logic with authentication and UDP ASSOCIATE support

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tuic-client/src/config.rs Added ProxyConfig struct and proxy field to Relay config with test coverage
tuic-client/src/error.rs Added Socks5 error variant for SOCKS5-related errors
tuic-client/src/connection/socks5.rs Implemented Socks5UdpSocket adapter implementing Quinn's AsyncUdpSocket trait
tuic-client/src/connection/mod.rs Integrated SOCKS5 proxy support into endpoint creation with handshake and conditional rebinding
tuic-tests/tests/integration_tests.rs Updated integration tests to include proxy: None field

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fokx added 2 commits February 2, 2026 20:41
This could be useful if you want to reach the target tuic-server through another proxy. And usually external tools such as [proxychains-ng does not support sockifying UDP traffic](rofl0r/proxychains-ng#570).

The SOCKS5 proxy should support UDP. So there is a small pitfall when you use a SOCKS5 proxy that is another tuic-server with an SOCKS5 outbound enabled and its `allow_udp` is set as false, because UDP over SOCKS5 outbound of tuic-server is not implemented.
…ipv6 socks5 server; add address unmapping in UdpSession::send and recv
@fokx fokx force-pushed the client-over-socks5 branch from 60d2e62 to 8401c9f Compare February 2, 2026 13:34
@Itsusinn Itsusinn added the enhancement New feature or request label Feb 2, 2026
@Itsusinn Itsusinn merged commit 2dabc25 into Itsusinn:main Feb 2, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants