Crate sosistab[][src]

Expand description

What is Sosistab?

Sosistab is an unreliable, obfuscated datagram transport over UDP and TCP, designed to achieve high performance even in extremely bad networks. It is originally designed for Geph, a resilient anti-censorship VPN, but it can be used for reliable communication over radios, game networking, etc. It also comes with a QUIC-like multiplex protocol that implements multiple TCP-like reliable streams over the base sosistab layer. This multiplex protocol is ideal for applications requiring a mix of reliable and unreliable traffic. For example, VPNs might do signaling and authentication over reliable streams, while passing packets through unreliable datagrams.

NOTE: Sosistab is still in heavy development. Expect significant breaking API changes before version 1.0 is released.

Features

  • State-of-the-art reliable streaming protocol with selective ACKs and BIC-based congestion control. Notably, it has better fairness and performance in modern networks than protocols like KCP that ape 1980s TCP specifications.
  • Strong, state-of-the-art (obfs4-like) obfuscation. Sosistab servers cannot be detected by active probing, and Sosistab traffic is reasonably indistinguishable from random. We also make a best-effort attempt at hiding side-channels through random padding.
  • Strong yet lightweight authenticated encryption with chacha20-poly1305
  • Deniable public-key encryption with triple-x25519, with servers having long-term public keys that must be provided out-of-band. Similar to decent encrypted transports like TLS and DTLS — but not to the whole Shadowsocks/Vmess family of protocols — different clients have different session keys and cannot spy on each other.
  • Reed-Solomon error correction that targets a certain application packet loss level. Intelligent autotuning and dynamic batch sizes make performance much better than other FEC-based tools like udpspeeder. This lets Sosistab turns high-bandwidth, high-loss links to medium-bandwidth, low-loss links, which is generally much more useful.
  • Avoids last-mile congestive collapse but works around lossy links. Shamelessly unfair in permanently congested WANs — but that’s really their problem, not yours. In any case, permanently congested WANs are observationally identical to lossy links, and any solution for the latter will cause unfairness in the former.

Use of async

Sosistab uses the “futures” traits and the smolscale executor. In practice, this means that Sosistab is compatible with any executor, but unless your program uses smolscale, Sosistab will run on a separate thread pool from the rest of your program. This comes with less overhead than you imagine, and generally it’s fine to use Sosistab with e.g. async-std or Tokio.

In the future, we will consider adding hyper-like traits to enable integration of Sosistab with other executors.

Modules

Structs

Represents an immutable buffer.

Represents a mutable buffer optimized for packet-sized payloads.

Configuration of a client.

A sosistab listener.

Statistics for a sosistab listener.

A multiplex session over a sosistab session, implementing both reliable “streams” and unreliable messages.

RelConn represents a reliable stream, multiplexed over a [Multiplex]. It implements [AsyncRead], [AsyncWrite], and Clone, making using it very similar to using a TcpStream.

This struct represents a session: a single end-to-end connection between a client and a server. This can be thought of as analogous to TcpStream, except all reads and writes are datagram-based and unreliable. Session is thread-safe and can be wrapped in an Arc to be shared between threads.

A generic statistics gatherer, logically a string-keyed map of f64-valued time series. It has a fairly cheap Clone implementation, allowing easy “snapshots” of the stats at a given point in time. The Default implementation creates a no-op that does nothing.

A time-series that is just a time-indexed vector of f32s that automatically decimates and compacts old data.

Enums

Underlying protocol for a sosistab session.

Functions

connect_tcpDeprecated

Connects to a remote server over UDP.

connect_udpDeprecated

Connects to a remote server over UDP.

Type Definitions