MEHTOR NETWORKING

MEHS Core

MEHS (Multiplexed Encrypted Hybrid Stack) is a client and server networking core for carrying TCP, UDP, and DNS traffic through an authenticated, encrypted connection. Use it as a local proxy, as a system-wide tunnel, or embed the client in a supported host application.

Documentation / Knowledge base

Everything you need to use MEHS

Start with the client or server guide, then explore configuration, platform integration, network behavior, and the complete protocol reference. All guides are available here.

Search all guides by topic, option, or error.

Getting started & configuration

Platform & application integration

Network & protocol reference

Ready-to-edit configuration files

Client JSON example / Server JSON example / TLS fingerprint example. Replace placeholder credentials before deployment.

Downloads / Live release feed

Latest release

Client and server packages from the most recently published release. Use matching releases on both ends and verify archives with the attached checksums.

Loading releases…

All releases & platform downloads
01 / Overview

What MEHS provides

MEHS connects applications on a client device to a configured MEHS server. The client handles authentication, transport setup, local traffic entry points, connection recovery, and reporting status to its host. The server applies its access and transport policies and makes outbound connections for authorized flows.

Local proxy

Expose SOCKS5 for TCP and optional UDP, plus HTTP CONNECT for TCP. The default SOCKS listener is 127.0.0.1:1080; HTTP CONNECT is disabled unless requested.

Device tunnel

Use TUN mode to route selected device traffic through MEHS. Configure routes and LAN exclusions to match the host network. This mode requires elevated network permissions.

Embedded client

Integrate the runtime through its C-compatible interface in a native or Flutter host, then read its status and stop it as part of the application lifecycle.

02 / Network behavior

Transports and traffic modes

TLS over TCP

MEHS's standard data transport. It uses TLS 1.3 and is appropriate for networks where TCP connectivity is available.

QUIC

Uses a QUIC data endpoint over UDP. The server must enable QUIC and the network must permit it. Select it explicitly or use automatic transport selection.

Automatic selection

When enabled, the client measures eligible paths, chooses according to current network quality and server policy, and can keep a standby path for live migration.

HTTP-shaped profiles

mehs-data/1 is the default profile. xhttp, trusttunnel, and notmehs are MEHS profiles; they require matching server settings and do not provide compatibility with third-party products. Unknown profiles fail instead of silently falling back.

In proxy mode, SOCKS5 TCP and HTTP CONNECT carry TCP traffic. SOCKS5 UDP ASSOCIATE is optional and must be enabled for applications that need UDP. In TUN mode, the client accepts IP traffic from the virtual interface and supports TCP, UDP, and DNS flows.

03 / Getting started

Run the client

Download the client package for the target platform from the MEHS releases page. Obtain a client ID, secret, and server certificate trust file from the server administrator. Keep the client secret out of shell history, process arguments, logs, and support reports.

Local proxy mode

Set the secret in the environment, then start the client with the control endpoint and local listener addresses:

export MEHS_CLIENT_SECRET='your-client-secret'
mehs --control vpn.example.com:8443 --client-id laptop \
  --ca-file ca.pem --transport auto \
  --socks-bind 127.0.0.1:1080 --http-bind 127.0.0.1:8080 \
  --remote-dns

Point an application at the SOCKS5 or HTTP proxy. For example, with curl:

curl --socks5-hostname 127.0.0.1:1080 https://example.com/

Add --udp-associate for SOCKS5 applications that use UDP, such as calls or games. Remote DNS is optional; when enabled, proxied destination names are resolved by the server. The client's own control and data endpoints are still resolved locally.

TUN mode

Run as root or administrator and provide LAN exclusions appropriate for your network:

sudo -E mehs --control vpn.example.com:8443 --client-id laptop \
  --ca-file ca.pem --transport auto --mode tun \
  --tun-exclude 192.168.0.0/16 \
  --tun-exclude 10.0.0.0/8 \
  --tun-exclude 172.16.0.0/12

By default, TUN mode routes all IPv4 and IPv6 traffic through the tunnel. Use --tun-route CIDR to select prefixes, --tun-exclude CIDR to leave prefixes on the normal network, and --tun-no-routes when the host manages routes. The control/data server endpoints must remain reachable outside the tunnel. On Windows, place the matching-architecture wintun.dll next to mehs.exe.

Transport options: --transport tcp selects TLS/TCP, --transport quic selects QUIC, and --transport auto measures both when the server allows both. The data endpoint defaults to the control host on the next port; use --data HOST:PORT to override it.
04 / Settings

Configuration essentials

Use a schema-versioned client JSON file with --session-config PATH. Schema version 1 is strict: unknown fields are rejected, and configuration is validated at startup. Command-line values can override the corresponding session settings. Configuration is read at startup; disconnect and reconnect to apply static changes.

Setting What it controls Typical starting value
mode Transport policy: automatic, TLS/TCP, or QUIC. auto
client_mode Local proxy listeners or a TUN interface. proxy
tcp_connection_count, udp_connection_count Number of data links in each carrier pool; zero disables that pool. 1 each
connect_timeout_seconds Maximum setup time for a candidate connection. 15 seconds
keepalive_seconds, health_check_seconds Idle-path keepalive and health-check intervals. 15 / 30 seconds
migration_drain_timeout_seconds Maximum time to drain the previous path after migration. 60 seconds
inf_reconnect Whether to remove the normal post-start retry limit. false
tun Interface name, MTU, routes, exclusions, and route management. MTU 1400

Server policy takes precedence over client transport and connection-pool requests. The client applies policy corrections or rejects disallowed settings rather than assuming a requested value was accepted. Start with one TCP and one QUIC candidate; increasing pool sizes increases resource use and does not guarantee faster performance.

Download the client configuration example and consult the complete configuration reference for defaults, bounds, profiles, and all accepted fields.

05 / Server

Prepare a MEHS server

The reference server package targets Debian 13 Linux x86_64. Start from the server example configuration, set the TLS certificate and private-key paths, replace every sample client credential, and choose which transports the server will permit.

sudo install -o root -g root -m 600 mehs-server.json /etc/mehs/server.json
sudo MEHS_SERVER_CONFIG=/etc/mehs/server.json /usr/local/bin/mehs-server

Network access

Allow the configured control listener and TCP data listener through the firewall. If QUIC is enabled, allow its UDP data listener as well. Default example ports are TCP 8443 for control and TCP 8444 for data; QUIC commonly uses UDP 8444.

Credentials and trust

Use strong, unique client secrets and a certificate valid for the server hostname. Configure clients to verify the server certificate with an appropriate CA or trust bundle. Never put secrets in logs or unprotected configuration files.

Outbound policy

By default, the server blocks private, loopback, and link-local destinations. Review outbound policy before deployment and only allow additional destinations when needed.

The example configuration is a starting point, not a production-ready deployment. See the server administration guide and the server configuration example.

06 / Embedding

Integrate with an application

The client package includes a C-compatible API and platform libraries. The runtime entry point accepts the same command-line options as the standalone client, starts asynchronously, and returns a handle for status polling and shutdown. Pass credentials through the dedicated secret parameter rather than embedding them in the argument list.

API Purpose
mehs_runtime_start Start a client session and receive a runtime handle.
mehs_runtime_status Read JSON status: state, phase, transport, proxy/TUN details, errors, and recent log messages.
mehs_runtime_stop Stop the session, clean up managed TUN routes, and release the runtime handle. Call once.
mehs_config_validate_json Validate a schema-versioned session configuration before saving or starting.
mehs_protocol_version, mehs_core_version Read the protocol version and client release string.

Status states include starting, running, reconnecting, stopped, and failed. Treat failed as terminal: display the secret-free error, stop the handle, correct the configuration or network issue, then start a new runtime. Poll at a modest interval (about once per second), and always stop the runtime during application shutdown.

Host responsibilities: preserve secrets in the platform secure store, keep the server endpoint outside the TUN routes, coordinate VPN permissions and routing with the OS, and handle sleep/wake or network changes where the platform requires host notifications. The runtime wrapper reconnects after transport loss; separate lifecycle callbacks are available to integrations using the lower-level client handle.
07 / Day-to-day operation

Status, recovery, and troubleshooting

Connection lifecycle

Initial authorization, server policy negotiation, certificate validation, data-path authentication, and listener or TUN setup must all succeed before startup is ready. A failed initial connection is reported rather than silently retried.

Reconnect behavior

After an established session loses its data path, the client retries with increasing delays. By default, the retry budget is limited; a session that remains up for at least 60 seconds resets it. inf_reconnect: true removes the normal retry limit.

Useful diagnostics

Use --verbose for detailed, secret-free network and lifecycle diagnostics. Check the status phase and error, confirm the server certificate and client ID, verify the chosen endpoint/port, and confirm the server permits the selected transport.

  • Proxy does not connect: confirm the client is running, the application points to the correct loopback port, and local firewall rules permit that listener.
  • UDP does not pass in proxy mode: enable --udp-associate and ensure the application uses SOCKS5 UDP. HTTP CONNECT carries TCP only.
  • Names fail to resolve: enable --remote-dns for proxied destination names if the server supports domain destinations. This does not change local name resolution for the server endpoints.
  • TUN traffic stalls: verify elevated permissions, interface setup, routes, LAN exclusions, and that no other VPN is managing the default route. Keep the MEHS server endpoint on the physical network path.
  • QUIC fails: verify the server's QUIC listener and UDP firewall path, or select --transport tcp.
TUN cleanup: stop the runtime normally to remove managed routes. If the process is terminated unexpectedly, the next start removes stale routes on supported setups. On Android and iOS, the host VPN service or Network Extension also owns part of tunnel setup and teardown.
08 / Compatibility

Platform support

Platform availability and verification differ by feature. Check the support matrix before committing to a deployment target, especially for device-wide tunneling and mobile integrations.

Platform Client / proxy TUN notes
Linux x86_64 CLI and native client package; end-to-end proxy verification. Manually end-to-end verified; root or CAP_NET_ADMIN required.
Windows Client packages for x64, x86, and arm64; proxy end-to-end manually verified. Manually verified; administrator rights and matching wintun.dll required.
macOS Native client target available; runtime verification varies by feature. Implemented with utun, but not runtime-tested.
Android Native library package; Flutter embedding supported. Host-managed VpnService descriptor; device lifecycle is not runtime-tested.
iOS XCFramework for a Network Extension host. Packet Tunnel integration is available; physical-device host integration is not runtime-tested.

Linux server packages target Debian 13 x86_64. Exact feature verification and release compatibility details are maintained in the support matrix. Use the same release for the client and server.