Architecture
Technology stack
Section titled “Technology stack”- VLESS+Reality (Xray-core) — the primary protocol. It impersonates a real TLS website: anyone probing the server sees that site’s genuine certificate (preferably a site hosted next to your server). Only clients with the right key enter the VPN tunnel.
- XHTTP (Xray-core) — a TLS path on your domain, or on the server’s IP with a Let’s Encrypt IP certificate when there is no domain.
- WSS (Xray-core) — a TLS path on your own domain, added in domain mode. With Cloudflare proxying the domain, it and XHTTP travel through the CDN and survive an IP block.
- Hysteria2 (Xray-core) — the UDP/443 last resort for lossy networks, wrapped in salamander obfuscation so it doesn’t look like QUIC. On by default (
--no-hysteria2turns it off). - Control service and web panel — Meridian’s own service (
meridian serve, running asctld) on the control server. It keeps users, traffic, revisions, privacy settings, and backups in one SQLite file, serves every subscription format and connection page, and hosts the built-in web panel (owner console). It runs as a systemd unit, with no Docker and no database server. - Node agent — a small static Rust binary on every exit and routing gateway. It dials the control service over HTTPS on 443, verifies the signed document it receives, and runs Xray as a separate service. Nodes open no management port.
- nginx — owns public TCP/443. Its stream module routes connections by SNI without terminating TLS; its http module terminates TLS for the control service, connection pages, subscriptions, and domain paths. Certificates come from Let’s Encrypt via acme.sh.
- Realm — the TCP forwarder on relay servers.
- uTLS — client connections copy a browser’s TLS Client Hello (Chrome, with Firefox copies as backup entries), so they look like ordinary browser traffic.
The first reviewed deployment seeds the subscription title, refresh interval, public owner contact and server billing from the fleet configuration. After that the panel and CLI edit these values in the control service. Each save checks the version it was reviewed against. Saving these settings works even if an exit is offline. A later topology apply preserves the edits; the deployer still owns network configuration and access rules. An upgrade preserves values already saved in the control service. An owner edit before the first reviewed apply protects that field without discarding the remaining initial values.
Read the current version with GET /api/settings/presentation (fleet.read). Send only the edited fields with PATCH /api/settings/presentation (settings.presentation) and expected_version. A stale review returns HTTP 409. The change event records the field names without their values.
Service topology
Section titled “Service topology”Single server (meridian deploy IP)
Section titled “Single server (meridian deploy IP)”The public boxes in this diagram describe URL routes handled by ctld: the page-path root redirects legacy UUID links, while /sub/ serves browser pages, app configs, and shared assets.
nginx stream does not terminate TLS. It reads the SNI from the Client Hello and forwards the raw TCP stream. The control service, connection pages, and subscriptions are served with a Let’s Encrypt certificate for the server’s IP (short-lived, renewed automatically).
Shared links use one address: /<page-path>/sub/<token>. Browsers receive the connection page; apps receive their configurations. The control service’s web panel, API, and agent endpoint sit on a separate secret path that shared links never reveal.
The service renders each page, its config.json, and its manifest from current users, endpoints, branding, and exit countries. Every person has a page, including those added in the web panel. Person responses use Cache-Control: no-store and noindex; shared package assets use a content version under /<page-path>/sub/~pwa/. nginx supplies Referrer-Policy and compression, and the service supplies the page’s CSP and other browser protections. Legacy /<page-path>/<uuid>/ links redirect to the current subscription URL. Applying the upgrade retires the old page files and service workers.
Domain mode
Section titled “Domain mode”The domain carries only the VPN paths; the control service, web panel, and pages stay on the IP certificate.
Relays
Section titled “Relays”A relay forwards raw TCP from a domestic IP to the exit’s Reality listener. Encryption is end to end between client and exit; the relay never sees plaintext. Relays carry Reality only. meridian setup can also build multi-hop relay chains and routing gateways that pick an exit (or a health-checked pool of exits) by rule, or send matching traffic directly from the gateway.
Control service and agents
Section titled “Control service and agents”Every connection points at the control service; nothing connects to a node. Each agent dials out over HTTPS on 443, waits for a new document, and reports what it applied and the traffic it counted. The control service signs every node document with the fleet’s own key, and the agent refuses one that doesn’t verify, so a forged or replayed document changes nothing. A new node joins with a single-use enrollment token that Meridian hands it over SSH, then holds a certificate from the fleet’s own authority.
Traffic is counted once per report, even when a report is resent. By default the service keeps lifetime totals and last seen, without client IP addresses. Optional Privacy settings add daily person/server totals with retention and device fingerprints or full device details.
How Reality works
Section titled “How Reality works”- Each exit has an x25519 keypair. Clients get the public key; the private key stays on the server.
- The client connects on port 443 with a TLS Client Hello naming the camouflage target (e.g.
www.google.com). - To an observer, this is an ordinary HTTPS connection to that site.
- A prober without the key is passed through to the real site and sees its valid certificate.
- A client with valid authentication gets the VLESS tunnel.
- uTLS makes the Client Hello match Chrome’s, defeating TLS fingerprinting.
State model
Section titled “State model”- Topology —
~/.config/meridian/cluster.ymlholds reviewed servers, roles, protocols, routing, the service address and credentials, and durable apply state. People live in SQLite in the control service. - People — the control service owns accounts, display names, credentials, status, limits, expiry and memberships in SQLite; CLI and console changes are immediate.
- Revisions — the control service records every reviewed apply: who made it, its plan, and whether it applied.
meridian fleet historylists them. - Snapshots: CLI changes save an encrypted snapshot on the computer that ran the command. Changes made in the panel can be newer than that copy. See Recovery.
- Saved servers —
~/.config/meridian/servers.jsonholds SSH connection details.
Plan and apply
Section titled “Plan and apply”Meridian compiles topology into firewall rules, nginx routes, certificates, Realm services, agents, node documents, endpoints and service settings. plan observes them and apply reconciles the reviewed hash with checkpoints and a service lease. People are created and removed directly through the service.
After the new plan converges, apply retires resources that left topology. All people remain service-owned. Loading an older version 4 fleet lifts its people into an adoption record: the next reviewed apply discloses the move, preserves existing accounts and creates any missing seeds after committing. The finish is safe to repeat. A control server moves through restore or leaves with teardown.
Clients’ status, limits, and expiry belong to you, from the CLI or the web panel; applies never change them.
Port assignments
Section titled “Port assignments”| Port | Service | Scope |
|---|---|---|
| 443/TCP | nginx stream (SNI router) | Public |
| 443/UDP | Xray Hysteria2 (on by default) | Public |
| 80/TCP | nginx (ACME challenges) | Public |
| 8443 | nginx http (control service, pages, subscriptions) | Internal |
| 8444 | nginx http, PROXY-protocol listener | Internal |
| 3000 | Control service (web panel, API, agents, subscriptions, pages) | localhost |
| 10000+ | Xray Reality (per-exit) | host network, firewalled |
| 20000+ | Xray WSS (domain mode, per-exit) | host network, firewalled |
| 30000+ | Xray XHTTP (per-exit) | host network, firewalled |
Backend Xray ports are reached through nginx; UFW blocks them from the internet. Agents only dial out, so no node opens a management port. Relay servers open only SSH and their listen port.
Services
Section titled “Services”Unit and directory names are neutral, so a host reading systemctl or /opt sees nothing that names VPN or proxy software. meridian check and meridian doctor show the role behind each name. Servers need no Docker.
On the control server:
ctld— the control service,meridian servefrom a pinned install in/opt/ctld, on127.0.0.1:3000behind nginx
On every exit and routing gateway (the control server too, when it is also an exit):
netagent— the node agentnetcore— Xray, started and configured by the agent
On every relay:
netfwd-*— one Realm service per relay hop
The agent is a static binary for x86-64 and ARM64 servers. Meridian upgrades it in place when a new release brings a new build, and keeps the node’s identity.
Teardown
Section titled “Teardown”On the last controller, meridian teardown IP checks a confirmed off-server backup before deleting the live fleet database. It only removes verified Meridian resources and refuses ambiguous shared installations; it does not remove 3.x deployments.
File locations
Section titled “File locations”On the control server
Section titled “On the control server”/opt/ctld/— the control service’s pinned install/etc/ctld/config.json— its configuration/var/lib/ctld/— its database (users, traffic, revisions, backup keys)/etc/nginx/stream.d/meridian-v4-*.conf— SNI routing/etc/nginx/sites-available/meridian-v4-*.conf— TLS sites and reverse proxy/etc/ssl/meridian/— certificates
On each exit and routing gateway
Section titled “On each exit and routing gateway”/usr/local/bin/netagent— the agent/etc/netagent/— its enrollment and the Xray configuration it writes/var/lib/netagent/— its keys, certificate, and state/usr/local/lib/netagent/— Xray
On each relay
Section titled “On each relay”/etc/netfwd/— Realm configuration, run from/usr/local/bin/netfwdbynetfwd-*systemd services. Relay hosts carry no Meridian-named units, paths, or firewall comments (fw-*)
On your machine
Section titled “On your machine”~/.config/meridian/cluster.yml— topology, control service access, keys~/.config/meridian/cluster.yml.bak— backup taken before destructive operations~/.config/meridian/servers.json— saved SSH servers~/.config/meridian/setup.json—meridian setupprogress (no secrets)~/.config/meridian/snapshots/— encrypted snapshots of the control service~/.config/meridian/device.key— this machine’s key for those snapshots~/.config/meridian/ssh/meridian_ed25519— managed SSH key, when generated~/.config/meridian/cache/— update-check cache
The directory follows $XDG_CONFIG_HOME when it is set, and MERIDIAN_HOME overrides it. While ~/.config/meridian/ doesn’t exist, Meridian also uses ~/.meridian-v4/ or ~/.meridian/ when either holds a fleet (it has a servers.json). Meridian 3.x state in ~/.meridian/ is never touched.
Several fleets can share one machine as contexts (meridian context). That directory is the default context; another context keeps its own cluster.yml, backup, servers.json, setup.json, snapshots, and device key in contexts/NAME/, while the SSH key, the update-check cache, the language choice, and the local Xray runtime stay shared. --context, then MERIDIAN_CONTEXT, then the saved current-context choose one; MERIDIAN_HOME pins a single fleet.
Access profiles
Section titled “Access profiles”Named access profiles are part of reviewed topology and compile to stable authentication-inbound references. The service owns membership in a separate table and activates one canonical grant map for node composition, delivery, and previews. Applies preserve membership; the default profile grants the whole fleet. Public aliases sharing an inbound share enforcement. Losing access uses the existing generation-bound flow-block receipts, without storing connection observations.
Delivery policies
Section titled “Delivery policies”Reviewed delivery intent owns named, bounded destination rules and DNS choices. One client representation compiles Xray JSON, Mihomo, Stash, and sing-box; Base64 cannot carry those settings. Fleet and access-profile defaults use the same resolver, with conflicting profile defaults refused. LAN handling and fingerprint isolation remain explicit. Clients use their already-installed pinned geodata, without remote rule-set fetching. See Client routing.
- App response rules — reviewed
delivery.response_rulesselect formats, refusals, typed headers, and app policy overrides before the built-in selector. The service, CLI tester, and console preview share one pure decision and the delivery-policy resolver; request headers stay transient.
