Skip to content

transport ​

The transport point: the layer under a protocol (VLESS, Trojan) that turns one connection into the protocol's byte stream, hiding WebSocket frames, an HTTP Upgrade, HTTP requests or a gRPC message stream. The protocol writes and reads bytes and knows nothing about the transport. The interface protocols and transports meet on is the contract ours-transport-api; the module keeps the point and the transport over QUIC. The HTTP/2 layer of the HTTP-based transports is ours_proto::h2 (the h2 feature of ours-proto).

Crateours-mod-transport, modules/transports/transport
Binary featurenone, always in the build
Crate featuresquic — the transport over QUIC (src/quic.rs, ours-quic, ours-transport-api/quic), the variant quic of the point; the binary enables it with transport-xhttp; without it a transport over QUIC is refused

requires ​

dial, tls. It is required by the transports (transport-*, they extend the point) and by the protocols that take a transport from the blocks (trojan, vless).

provides ​

  • Provide::Point("transport"). The variants are added by the transport modules: Provide::Block { block: "transport", key: "ws" | "http" | "grpc" | "httpupgrade" | "xhttp" } and the schemas transport.<kind>.
  • Provide::Extension { point: "transport", key: "quic" }, a ours_transport_api::Quic<ListenOptions>: dial gives what dials HTTP/3 for an outbound's transport, listen — the QuicListener of an inbound whose transport takes QUIC; both take the QUIC TLS (ours_quic::tls::Factory) from the services. vless takes it from Extensions. Built without quic, the variant is there and refuses: «a transport over QUIC needs the transport feature quic» (a module provides the same in every build).

Neither the protocol nor the transport names the other: the protocol says what it needs (Caps), the transport — what it gives.

What the module keeps (src/lib.rs, src/quic.rs) ​

  • MODULE and the schema of the transport block (the transport.<kind> schemas of the variants).
  • src/quic.rs (feature quic) — the variant quic: the HTTP/3 dial and the listener over QUIC; without the feature, the refusing variant in src/lib.rs.

Dependencies ​

ours-transport-api, ours-api, ours-config, ours-json, ours-tls-options; with quic — ours-quic, ours-runtime, tokio, tracing.

Tests ​

A unit test in src/lib.rs (the variant quic is found by its type); the interface is tested in ours-transport-api, QUIC — by transport-xhttp and the interop scenarios of vless.

Syntax: transports.

GPL-3.0-or-later