MEHS / Knowledge base

Architecture

Data path

Application
    |
    +-- SOCKS5 (TCP CONNECT / UDP ASSOCIATE) / HTTP CONNECT
    |       |
    |       v
    |   proxy accepts and relays streams and datagrams
    |       |
    +-- IP traffic (TUN mode)
            |
        TUN device + userspace TCP/UDP stack
            |  (each connection / UDP flow becomes one MEHS flow)
            v
     MEHS session reliability
            |
     TCP/TLS or QUIC frame path
            |
      remote MEHS data peer

A client session maintains reliable send and receive state, processes acknowledgements and retransmissions, and relays accepted SOCKS5 or HTTP CONNECT traffic through an attached frame path. It sends a FlowOpen message containing an address or domain name and waits for destination-connect success before acknowledging the local proxy request. The server's TCP/TLS and optional QUIC data listeners authenticate the finalized client ID and epoch, open the requested TCP or UDP destination, and forward frames in both directions. Client data paths use corresponding authenticated handshakes, including optional ML-KEM-768/AES-256-GCM protection.

In TUN mode, the operating system's TCP and UDP connections terminate in a userspace stack, which opens one MEHS flow per connection; the server therefore needs no raw-IP gateway. A legacy packet-bridge mode instead forwards raw IP packets to a remote gateway and is not used by TUN mode. Reconnection uses backoff while keeping the TUN engine alive across reconnects; the same behavior is used by the command-line client and the Flutter embedding.

Current boundaries

Non-goals for the first milestone

Probe data flow

  1. The caller supplies authenticated, server-permitted candidate paths that support probing (for example, TCP echo or QUIC echo paths). Unpermitted or unauthenticated paths are never probed.
  2. For each path and round, the probe worker sends 5 numbered RTT probes and 3 throughput probes with bounded payload, a per-probe timeout, and a minimum interval between rounds per path. Failed probes count toward loss only.
  3. Results become candidate measurements and are passed to transport selection. Scoring weights are loss 50, RTT 30, jitter 15, and throughput 5. Migration requires at least 15% improvement over two windows, subject to a 10 s cooldown; the active path is reselected immediately if it fails (all probes lost or the path is missing). Rate-limited rounds reuse cached data and do not count as hysteresis windows.
  4. Platforms pass the lifecycle probe-enable state into each probe round. While sleeping, no probes are sent; after wake, probes run only until a healthy path is confirmed by the wake health check.
  5. Probes carry only sequence numbers and zero-filled payload. No secrets are logged or emitted in status events.