Methanium Transport Protocol
  • Rust 77.2%
  • TypeScript 15.6%
  • JavaScript 6.6%
  • Nix 0.4%
  • HTML 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Rasensprenger 07c9837a69
All checks were successful
CI / checks (pull_request) Successful in 7m19s
Update Rust crate tokio to v1.53.1
2026-08-05 23:02:14 +02:00
.cargo Doc update 2026-06-28 04:17:42 +02:00
.forgejo/workflows General Upgrade, NEW: WebServers, Better Docs 2026-07-18 14:48:21 +02:00
client Fix ping tracker Clippy warning 2026-07-28 22:57:08 +02:00
codec (fix): broken connections 2026-07-27 21:37:41 +02:00
common General Upgrade, NEW: WebServers, Better Docs 2026-07-18 14:48:21 +02:00
crypto [Fix] Wasm & Webserver 2026-07-19 20:16:17 +02:00
docs [Add] TCP server to core MTP (HTTP/1.1 & HTTP/2) compatibility 2026-07-21 00:43:00 +02:00
example Update Rust crate tokio to v1.53.1 2026-08-05 23:02:14 +02:00
files General Upgrade, NEW: WebServers, Better Docs 2026-07-18 14:48:21 +02:00
host Merge branch 'master' of ssh://git.methanium.net/methanium/mtp 2026-07-28 19:57:27 +02:00
mtp-webserver Apply disabled server idle timeout 2026-07-29 01:22:49 +02:00
src Expose native ping RTT in WASM SDK 2026-07-28 02:46:41 +02:00
test General Upgrade, NEW: WebServers, Better Docs 2026-07-18 14:48:21 +02:00
transport Revert "(fix): disable QUIC GSO on Android" 2026-08-05 16:25:01 +02:00
type-map General Upgrade, NEW: WebServers, Better Docs 2026-07-18 14:48:21 +02:00
wasm Fix native ping connection lifecycle 2026-07-28 22:26:45 +02:00
web-client/public Brought Example up to spec 2026-07-19 02:01:58 +02:00
.gitignore (feat): add max message size to wasm 2026-06-28 13:08:37 +02:00
Cargo.lock (fix) vers 2026-07-27 22:24:03 +02:00
Cargo.toml (fix) vers 2026-07-27 22:24:03 +02:00
clippy.toml (feat): rename example-usage to just example 2026-06-27 03:20:25 +02:00
deny.toml Merge 2026-06-25 22:08:44 +02:00
example-type-maps.yaml General Upgrade, NEW: WebServers, Better Docs 2026-07-18 14:48:21 +02:00
flake.lock (fix): nix related stuff 2026-06-28 18:48:49 +02:00
flake.nix (fix) vers 2026-07-27 22:24:03 +02:00
package.json (fix) vers 2026-07-27 22:24:03 +02:00
pnpm-lock.yaml General Upgrade, NEW: WebServers, Better Docs 2026-07-18 14:48:21 +02:00
pnpm-workspace.yaml (feat): redesign WASM module, add TypeScript SDK, migrate to pnpm 2026-06-27 23:44:27 +02:00
README.md [Add] TCP server to core MTP (HTTP/1.1 & HTTP/2) compatibility 2026-07-21 00:43:00 +02:00
renovate.json Add renovate.json 2026-08-05 20:16:23 +02:00
rustfmt.toml Merge 2026-06-25 22:08:44 +02:00
tsconfig.json General Upgrade, NEW: WebServers, Better Docs 2026-07-18 14:48:21 +02:00

Methanium Transport Protocol

MTP is a modular transport protocol built on QUIC. It provides versioned type maps, a binary codec, native and browser clients, host and WebTransport server implementations, and optional cryptographic authentication and end-to-end encryption.

Security assumptions, certificate handling, authentication, cryptographic primitives, key storage, and known limitations: Security.

Area-specific guides:

MTPWebServer owns TCP TLS (HTTP/1.1 and HTTP/2) plus UDP QUIC (HTTP/3 and WebTransport) on one numeric port. It must not bind its UDP address and port as MTPHost: their QUIC ALPN protocols remain incompatible (h3 for the web server, native MTP for the host).

Browser SDK

The JavaScript package is mtp.

  • mtp exports the SDK-first MTPClient API and codec helpers.
  • mtp/raw exports generated WASM bindings for lower-level integrations.
  • mtp/vite exports the Vite integration that builds app-specific bindings.
  • mtp/type-map exports generated TypeScript type-name unions.

Use the WASM client guide for installation, type-map configuration, credentials, certificate pins, requests, subscriptions, pipes, and protocol pings. Use the SDK methods before raw bindings because the raw API does not provide the wrapper's validation, persistence, timeout, logging, or lifecycle handling.

The SDK exposes crypto helpers and frame codec helpers from the main mtp export. The security guide describes the available algorithms and their limitations.

Getting Started

Add the umbrella crate with the features required by the application:

[dependencies]
mtp = { path = "..", features = ["client", "crypto"] }

Feature summary:

Feature Pulls in Enables
crypto mtp::crypto AEAD, signatures, KEM, KDF, hashing
host mtp::host, codec registry QUIC host and version negotiation
client mtp::client QUIC client connections
webserver mtp::webserver HTTPS server with HTTP/1.1, HTTP/2, HTTP/3, and WebTransport MTP sessions

The core crates are always available: codec, transport, common, and type_map. See the native client and native host guides for configuration and usage. See Security for security boundaries.

Sub-crates

The mtp facade re-exports the following modules: mtp::codec, mtp::transport, mtp::common, mtp::type_map, mtp::crypto, mtp::host, and mtp::client.

Codec

The codec encodes and decodes MTP frames using Communication Types and Data Types resolved through a version-specific type map. It supports containers, integers, booleans, floats, strings, arrays, bytes, null values, and optional signed or encrypted containers. See Type Map for mapping configuration and Connector for negotiated codecs.

Transport

The transport crate wraps QUIC with wtransport. Sender and Receiver exchange framed messages over unidirectional streams. The transport supports a persistent stream and a single-stream-per-message mode, with configurable message limits, timeouts, queues, and stream concurrency.

Certificate verification is controlled by client configuration. Use system roots or explicit certificate and SPKI pinning for production. Development self-signed and insecure modes: Security.

Host

The host crate provides MTPHost, registry-backed version negotiation, optional authentication, and MTPConnection handles. Authentication policies and the challenge-response protocol: Native Host and Security.

Client

The native client provides unauthenticated connections, authenticated login, and registration when the crypto feature is enabled. See Native Client.

The browser client uses the mtp SDK over WebTransport. See WASM Client.

Common

Common defines shared errors such as CodecError and CommunicationError, as well as protocol-level types used by the other crates.

Type Map

The type-map build script reads YAML and generates CommunicationType and DataType enums at compile time. The runtime crate provides TypeMap, Version, ID types, and the multi-version Registry when the registry feature is enabled. See Type Map.

Crypto

mtp-crypto provides AEAD encryption, Ed25519 and ML-DSA-65 signatures, X25519 plus ML-KEM-768 hybrid KEM support, HKDF, SHA-256, keyrings, encrypted containers, and certificate generation for development. Feature flags and security boundaries: Security.

Examples

The example/ workspace contains native client, native server, key-generation, WebTransport server, and browser client examples. The example server stores its generated development certificate and host keys locally; use the certificate pin it prints when connecting the example client.