-
Notifications
You must be signed in to change notification settings - Fork 71
feat: Implement Hysteria2 client with full protocol support #87
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
base: master
Are you sure you want to change the base?
Conversation
cfal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I'd love to revisit this in a future release. Ideally, I'm hoping for a more general client solution for QUIC protocols rather than something Hysteria2-specific with full support for chaining. In the meantime, I've added SOCKS5 UDP associate support and fixed UDP routing in the 0.2.5 release.
src/socks_handler.rs
Outdated
| let socks_udp_relay = SocksUdpRelay::new(udp_socket); | ||
|
|
||
| return Ok(TcpServerSetupResult::MultiDirectionalUdp { | ||
| stream: Box::new(socks_udp_relay), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that server_stream ends up dropped here - it needs to stick around until UDP proxying is completed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your reply. I have resolved all the conflicts. Please review it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cfal Thank you for your feedback! I understand your requirements.
I will refactor the code as follows:
Maintain/enhance the generic QUIC client support in SocketConnectorImpl (the current TransportConfig::Quic)
Extract the QUIC endpoint creation logic into a reusable common module.
Allow Hysteria2SocketConnector to add protocol-specific layers (HTTP/3 authentication, frame encapsulation, etc.) on top of the generic QUIC client.
This way, other protocols (such as the TUIC client) can also reuse the generic QUIC client capabilities. Do you think this approach is acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kitty-eu-org thanks for taking the time in this PR. there is no need for protocol-specific layers. we should have generic QUIC support through SocketConnectorImpl instead of protocol == hysteria2 - as well as through the client proxy chain, as TCP/UDP does.
right now, you can specify eg a client chain of shadowsocks followed by vless, and TCP will connect through both (proxy TCP through shadowsocks to vless, proxy TCP through vless), and UDP connections will connect through both (proxy TCP through shadowsocks to vless, proxy UDP-over-TCP through vless). and you can have different rules + chains for different hostnames/IPs.
i have not looked into this yet as well because i'm considering switching to tokio-quiche, and i think this is can be a complex change. i don't want to discourage you from working on this, but getting this fully working might not be easy and require some time.
…width, udp_enabled)
Description
This PR implements a complete Hysteria2 client following the official https://github.com/apernet/hysteria/blob/master/PROTOCOL.md. The implementation is based on the official Go client and includes full support for TCP proxy, UDP relay, congestion control (BBR/Brutal), and Fast Open.
Features Implemented
Core Protocol:
Advanced Features:
Code Quality:
Changes
Protocol Compliance
This implementation follows the official https://github.com/apernet/hysteria/blob/master/PROTOCOL.md: