NSL-SH/mesh-router-root
À propos
A distributed mesh networking solution for self-hosted infrastructure. Mesh Router powers NSL.SH, a free domain and routing layer that connects public gateways to private self-hosted services, even behind NAT. This repository acts as the root entry point for the NSL.SH or MeshRouter ecosystem.
Systèmes et infrastructureProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalMesh Router and NSL.SH
A distributed mesh networking solution for self-hosted infrastructure named NSL.SH
This repository serves as the root "bookmark" for all Mesh Router projects, bringing together the various components that make up the mesh networking ecosystem.
Sponsors
This project is made possible by:
| Sponsor | Description |
|---|---|
| Yundera | Easy to use cloud server for open source container applications |
| NSL.SH | Free domain for open source projects |
Overview
Mesh Router enables secure, distributed routing of traffic between public servers and private instances. It supports both direct IP routing (for low latency) and WireGuard VPN tunneling (for instances behind NAT).
┌─────────────────────────────────────────┐
│ mesh-router-gateway │
│ (public entry point) │
└──────────────────┬──────────────────────┘
│
┌─────────────┴─────────────┐
│ │
▼ ▼
┌──────────────────┐ ┌──────────────────┐
│ Direct Route │ │ VPN Tunnel │
│ (Public IP via │ │ (WireGuard via │
│ agent) │ │ tunnel) │
└──────────────────┘ └──────────────────┘
│ │
▼ ▼
┌──────────────────────────────────────────────┐
│ PCS Instance │
│ (self-hosted services) │
└──────────────────────────────────────────────┘
Components
| Component | Description | Documentation |
|---|---|---|
| mesh-router-backend | Express.js API for domain management and IP resolution | README |
| mesh-router-gateway | OpenResty reverse proxy gateway for wildcard domain routing | README |
| mesh-router-tunnel | WireGuard-based VPN tunneling for NAT traversal | README |
| mesh-router-agent | Lightweight agent for direct IP registration | README |
| mesh-dashboard | Web dashboard for mesh network management | README |
| mesh-router-nameserver | Authoritative DNS for the nsl.sh zone |
README |
| mesh-router-perf | Performance testing service | README |
On the box — everything below is deployed by the template (see What runs on a box):
| Component | Description | Documentation |
|---|---|---|
| mesh-router-template-root | The box template: install.sh, the nightly self-check, and the mesh / auth / maison stacks it deploys |
README |
| mesh-router-caddy | Local reverse proxy (caddy-docker-proxy) routing each hostname to a container by its caddy_* labels |
README |
| mesh-console | The box's local status and control page | README |
| mesh-router-auth | auth-registrar: registers OIDC clients with the box's Authelia for gated apps | README |
| auth-console | Web UI of the auth stack (Dex + Authelia): who can sign in |
README |
| mail-gateway | SMTP gateway: apps send mail, it relays over HTTPS | README |
| maison | The dashboard and app manager (replaces CasaOS): installs store apps, backups, domains | README, docs |
| files | Web file manager for the box (replaces FileBrowser) | README |
| mesh-router-guard | Packet-level enforcement of CrowdSec bans: the firewall bouncer owning the inet nsl-guard nft table (guard stack) |
README |
What runs on a box
There are two templates, and a managed Yundera PCS runs both: the Yundera layer
installs and drives the FOSS mesh template unmodified. A self-serve box (install.sh)
runs the mesh template alone.
Yundera/template-root /DATA/AppData/yundera managed PCS only
admin app, kopia backup, Yundera login connector, identity push, its own migrations
└── ensure-mesh-installed.sh writes the mesh .env contract, picks the mesh version,
│ runs the mesh self-check every night
▼
mesh-router-template-root /DATA/AppData/mesh every box
stack mesh → /DATA/AppData/mesh tunnel, agent, caddy, smtp, mesh-console
stack auth → /DATA/AppData/auth dex, authelia, auth-registrar, auth-console
stack maison → /DATA/AppData/maison maison (AppShield gate) + maison-app (the dashboard)
└── store apps → /DATA/AppData/<app>
stack guard → /DATA/AppData/guard crowdsec + mesh-router-guard (IP bans), MESH_GUARD=on only
All stacks share the external pcs network; requests arrive through the tunnel or
agent, and caddy routes each hostname by container labels.
Where each version is chosen
| What | Pinned in | Reaches a box |
|---|---|---|
| The maison image | mesh-router-template-root/stacks/maison/docker-compose.yml (ghcr.io/yundera/maison:<x.y.z>) |
next self-check after the template change lands on the box's channel |
| The guard images (crowdsec, mesh-router-guard) | mesh-router-template-root/stacks/guard/docker-compose.yml |
same, on boxes with MESH_GUARD=on |
| The mesh template | the update channel: MESH_UPDATE_CHANNEL (stable / main); on a managed PCS, template-root picks the branch (or MESH_REF) |
nightly self-check |
| Store apps | the app stores; each app updates from Maison's per-app Update | when the user (or Settings › Updates) applies it |
So shipping a Maison release is: tag maison (the image is built on the tag push —
push tags one at a time, GitHub skips tag events when more than three are pushed at
once), then bump the image in mesh-router-template-root on main, then stable.
Gateway Modes
The OpenResty gateway (mesh-router-gateway) is the gateway layer: our nameservers answer
dash names (<app>-<user>.<zone>) with every healthy gateway, which terminates TLS with its
own *.<zone> certificate and proxies to the box directly (agent) or through the WireGuard
tunnel. Dot names of a live user zone resolve straight to the box. The Cloudflare Worker
gateway (mesh-router-gateway-cf, now archived) and its "CF Worker Only" / "CF + Fallback"
modes were retired on staging 2026-11-09 and on prod 2026-11-16.
- Gateway Modes Guide - The gateway layer, and what was retired
- Data Flow - How traffic flows through the gateway
- Security in Transit - Certificates and encryption
Debugging & API Reference
Debugging Headers
Use these headers to debug routing issues:
X-Mesh-Trace
Add X-Mesh-Trace: 1 request header to see the routing path in the response:
curl -s -D- -o /dev/null -H "X-Mesh-Trace: 1" https://app.alice.domain.com/ | grep -i x-mesh-route
# Response: x-mesh-route: agent,pcs
Route path segments (set by the gateway):
handoff/retry,handoff- Handed to the gateway that reaches the box (no route of its own / own tunnel route failed to connect)agent- Route from mesh-router-agent (direct)tunnel- Route from mesh-router-tunnel (WireGuard)tunnel-routed- Tunnel route reached at the box's WireGuard address on the gateway hostpcs- Final destination
The Worker's segments (cf-worker, ip-dns, ip-dns-fail, sslip.io, nip.io,
gateway-fallback) no longer appear since its retirement.
X-Mesh-Force
Force a specific routing path for testing:
curl -H "X-Mesh-Force: direct" https://app.alice.domain.com/ # Prefer agent routes
curl -H "X-Mesh-Force: tunnel" https://app.alice.domain.com/ # Prefer tunnel routes
Backend API
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST |
/routes/:userid/:sig |
Ed25519 | Register routes |
GET |
/routes/:userid |
Public | Get routes for user |
DELETE |
/routes/:userid/:sig |
Ed25519 | Delete all routes |
GET |
/resolve/v2/:domain |
Public | Resolve domain to routes |
GET |
/available/:domainName |
Public | Check domain availability |
Example - resolve a domain:
curl https://backend.domain.com/resolve/v2/alice
# Response: {"userId":"...","routes":[...],"routesTtl":580}
See mesh-router-backend/README.md for full API documentation.
Architecture
Architecture diagrams and design documents are available in the doc/architecture folder:
Getting Started
Clone this repository with all submodules:
git clone --recursive https://github.com/Yundera/mesh-router-root.git
Or if you've already cloned:
git submodule update --init --recursive
Refer to each component's README for specific setup instructions.
Submodule pointers here are bookmarks, not releases. This repository only lists the projects to clone; a submodule pointer that lags its repository's
main(or a tag) is expected and harmless. Nothing ships from these pointers: each component is released from its own repository, so after committing in a submodule there is no need to bump it here.git submodule update --remotebrings every checkout to its upstream tip.
Local Development
To run the complete Mesh Router stack locally, see the dev/ folder which includes:
- Docker Compose configuration for all services
- Example environment file
- Caddy reverse proxy configuration
- Step-by-step setup instructions
cd dev
cp .env.example .env
# Edit .env with your credentials
docker compose up -d
See dev/README.md for detailed instructions.
License
See LICENSE for details.
Explorer des projets similaires
Chargement…