Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
dependencies ▾

Modern-Apps.git / vpn / docs / MAVPN.md

MAVPN.md3.2 KiBRenderedCodeRaw
1# The `.mavpn` bundle format (`mavpn/1`)
2
3A `.mavpn` file is how a VPN provider ships a whole catalogue of WireGuard
4servers to this app in one file, instead of one hand-imported `.conf` at a
5time. Importing it adds every server to the tunnel list (with provider,
6country and city attached) and to the *Browse by location* picker.
7
8## Layout
9
10A `.mavpn` file is a plain ZIP archive:
11
12```
13manifest.json
14servers/<name>.conf
15servers/<name>.conf
16...
17```
18
19- `manifest.json` โ€” at the ZIP root, UTF-8 JSON (below).
20- `servers/*.conf` โ€” stock WireGuard *wg-quick* configs, one per server,
21 exactly as `wg-quick`, the WireGuard apps and this app's `.conf` import
22 already accept (`[Interface]` + `[Peer]`). Do not invent a new config
23 dialect: the app feeds these files to its existing WireGuard parser.
24
25## `manifest.json`
26
27```json
28{
29 "format": "mavpn/1",
30 "provider": "Example VPN",
31 "servers": [
32 {
33 "id": "de-fra-1",
34 "country": "DE",
35 "city": "Frankfurt",
36 "file": "servers/de-fra-1.conf",
37 "endpoint": "fra1.example.invalid:51820"
38 },
39 {
40 "id": "us-nyc-1",
41 "country": "US",
42 "city": "New York",
43 "file": "servers/us-nyc-1.conf"
44 }
45 ]
46}
47```
48
49| Field | Required | Meaning |
50|---|---|---|
51| `format` | yes | Must be `"mavpn/1"`. A different major is rejected, so `mavpn/2` can break compatibility safely. Unknown extra fields are ignored within major 1. |
52| `provider` | yes | Human-readable provider name, shown in the tunnel list and picker. |
53| `servers[].id` | yes | Stable, unique per bundle: letters, digits, `.`, `_`, `-`. Re-importing a bundle updates the server with the same provider + `id` instead of duplicating it. |
54| `servers[].country` | yes | ISO 3166-1 alpha-2 country code, upper-case (`"DE"`, `"US"`). Drives the flag and the localised country name in the picker. |
55| `servers[].city` | yes | Human-readable city name, shown as-is. |
56| `servers[].file` | yes | The server's config inside the ZIP: `servers/<name>.conf`. Must exist. |
57| `servers[].endpoint` | no | Display/activation override for the config's `Endpoint`. When present it wins over the `.conf`; use it when the public endpoint differs from the one baked into the config. |
58
59## Limits and safety (enforced on import)
60
61- At most 256 ZIP entries, 200 servers, 1 MiB per entry, 8 MiB total
62 uncompressed, 256 KiB of manifest.
63- Entry paths must stay inside the bundle: absolute paths, `..`/`.` segments
64 and backslash separators are rejected.
65- Every referenced `.conf` must parse as a WireGuard config with an
66 `[Interface]` `PrivateKey` and a `[Peer]` `PublicKey`. Configs with more
67 than one `[Peer]` section are rejected: the tunnel is single-peer, and
68 merging peers would connect to one peer with another's routes.
69- Configs are stored only in app-private storage
70 (`files/mavpn-bundles/<bundle>/`) and in the app's encrypted config
71 database. Private keys are never logged.
72
73## Producing a bundle
74
75- `vpn/tools/generate_sample_mavpn.py` writes a demo bundle with fictional
76 `*.example.invalid` endpoints and clearly fake, `EXAMPLE`-labelled keys โ€”
77 never ship it as a real provider bundle.
78- Providers: zip the manifest and configs with any ZIP tool, e.g.
79 `zip -r provider.mavpn manifest.json servers/`.