English
hysteria
Hysteria v1 (sing-box's protocol/hysteria on top of sing-quic/hysteria, protocol version 3): a QUIC connection whose first stream carries the hellos (authentication and speeds), then a stream per TCP connection or UDP session, and QUIC datagrams for UDP.
| Crate | ours-mod-hysteria, modules/protocols/hysteria |
| Binary features | hysteria-inbound, hysteria-outbound (hysteria enables both) (enables tls and ours-mod-tls/quic) |
| Crate features | none |
requires
dial, tls — the UDP socket is opened through a Dialer; QUIC's TLS is built from the tls block through ours_quic::tls::Factory, which tls publishes (rustls, without uTLS/REALITY/kTLS, roots from the certificate section); the inbound builder takes the services for it.
provides
Provide::Blocks: inbound —tls; outbound —tls,dial.Provide::Inbound/Provide::Outbound { key: "hysteria" }, the schemasinbounds.hysteria,outbounds.hysteria.
Syntax: hysteria.
Dependencies
ours-quic (QUIC endpoints of the proxy protocols: the UDP socket, obfuscation, port hopping), ours-quinn-ext (what quinn lacks: datagrams, congestion control), ours-tls-options, ours-bufpool, ours-api, ours-codec, bytes, arc-swap.
Design
src/protocol.rs— the control stream's hellos, a stream's request and response, the UDP message.src/udp.rs— UDP over QUIC datagrams: every flow is a session numbered by the server and held by the stream that requested it.src/outbound.rs— one QUIC connection for all streams and flows; when it is lost — a new one with a hello.src/inbound.rs— the QUIC server: serves streams after a hello with a known user.src/options.rs.
Reload
Users reload in place, as in http.
Tests
modules/protocols/hysteria/tests/hysteria.rs — TCP and UDP, XPlus, a wrong password; unit tests in protocol.rs.