server

command module
v1.8.2-0...-f9bde3f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Server

The server module represents the core of the LAN Server. It is a simple web server that listens to the game's API requests. The server reimplements the minimum required API surface to allow the game to work in LAN mode.

Minimum system requirements

Stable
  • Windows: 7 or equivalent (10 or higher recommended).
  • Linux: kernel 3.2 (5.10 or higher recommended, see here for more details).
  • macOS: Ventura v13 (Sequoia v15 or higher recommended).

Admin rights or firewall permission to listen on port 443 (https) will likely be required depending on the operating system.

Experimental
  • BSD-based (OpenBSD, DragonFly BSD, FreeBSD and NetBSD).
  • Solaris-based (Solaris and Illumos).
  • AIX.

Note: For the full list see minimum requirements for Go 1.27.

Domains

Main
  • aoe-api.reliclink.com: legacy domain for AoE I: DE, AoE II: DE, AoE III: DE and AoE IV: AE.
  • *.worldsedgelink.com: current domain for all games.
  • aoe-api.worldsedgelink.com and andromeda-live-releaseNN-api.worldsedgelink.com are served from the same listener as the rest, which is what makes the public /community/ API reachable on its official host.
AoE 2: DE - Steam macOS
  • arthurlive-api.worldsedgelink.com: legacy exclusive domain.
  • arthurlive-release<N>-api.worldsedgelink.com: current exclusive domain. N starts at 1 and the releases beyond the statically known ones are discovered via DNS when internet access is available.
Playfab
  • *.playfabapi.com: currently used in AoM for Arena of the Gods content.
Partially proxied
  • api.ageofempires.com: except text moderation and the MatchContent endpoints (multiplayer savegame and replay upload/download) so it works normally even without internet.
  • cdn.ageofempires.com: except server status so it always shows online.

Note proxied domains only override part of the official functionality but retain the rest of it.

Configuration

Certificate

The easiest way to generate a self-signed certificate is by running the bin/genCert executable (more info here or you may leave that to the launcher if you are hosting and running the launcher on same PC.

Self-signed certificate

The self signed certificate pair (selfsigned_cert.pem and selfsigned_key.pem) is generated specifically for non-AoM and non-AoE IV games.

Default

The default certificate pair (cert.pem and key.pem) serves as the default and for AoM and AoE IV. It is signed by cacert.pem certificate authority.

You can use your own certificate by (re)placing the cert.pem and key.pem files in the resources/certificates directory.

Main

The few configuration options are available in the config.toml file. The file is self-explanatory and should be easy to understand.

Login

The configuration file sent to the client upon login is login.json inside the game subdirectory in resources/config. Some options are easy to understand while others might require researching.

News

The news returned by /game/news/getNews are defined per game in resources/config/<game>/news.toml. See News for the file format and how to add items.

Custom files

The /api/MatchContent/ endpoints serve multiplayer savegames and replays: the host uploads the file, the remaining players download it to restore the match. Without them the game fails with "Failed to upload/download custom files".

Files are stored under a per-game folder (by default <TEMP>\ageServer\custom-files\<game>), evicted least recently first to stay under the accumulated quota, and swept after the configured TTL. A .part file is used while uploading; it is renamed into place once the matchId is known, so a crash mid-upload leaves at most an orphan .part that is purged on the next startup.

The TTL is what removes a file, not a clean exit: stopping the server leaves the payloads on disk, and a later startup removes whatever it finds older than the TTL. The index is not persisted, so after a restart those leftovers are no longer reachable and are only reclaimed by that later startup. Up to MaxFileSize the endpoints run outside the global body-size cap, and the upload raises the read deadline for its own request; bodies larger than 4 KiB are left out of the communication log rather than base64-encoded into a multi-megabyte line.

See the [CustomFiles] section of config.toml.

Cloud

The game connects to a static cloud to download assets. The server is configured to replace the original calls to itself. The configuration file is cloudfilesIndex.json inside the game subdirectory in resources/config and the corresponding files reside in the cloud directory.

Age of Empires III: Definitive Edition only
Chat Channels

The chat channels are defined in the chatChannels.json file.

Other static responses

The server also serves some static responses for the game to work. The files are located in the responses base directory.

Age of Empires: Definitive Edition
  • Item Definitions: Definitions of items. Includes rewards, challenges and other items.
Age of Empires II: Definitive Edition
Age of Empires III: Definitive Edition
Age of Empires IV: Anniversary Edition
Age of Mythology: Retold
Main
Playfab

Starting and configuring Online-like Battle Servers

See Battle Servers for how to set up and start manually-configured Online-like Battle-servers. See Battle Server Manager for how to do so automatically.

Embedded Battle Server

The server can run a battle server internally (embedded) instead of as a separate process. This is configured per game under Games.<game>.EmbeddedBattleServer in config.toml. See Battle Servers for details.

When started, the embedded battle server starts on server startup and stops on shutdown. It appears in the game's battle server list like any external battle server.

StartIfMissing (default: "true"): Controls when the embedded battle server auto-starts if no external battle server is configured (via [[Games.<game>.BattleServers]]) and none is detected by the battle-server-manager. Accepted values:

  • "true" (default): always start if missing
  • "false": never auto-start
  • "required": start if missing for age4/athens, otherwise false

No explicit configuration is needed - it will use sensible defaults. To disable, set StartIfMissing = "false" in [Games.<game>.EmbeddedBattleServer] or configure an external battle server.

Replays

The game uploads the replay of a finished match itself. The server hands the client an upload URL in reportMatch (multiplayer) and in the report step of createOrReportSinglePlayer (single player, isComplete=1), accepts the upload on /cloudfiles/ (the same endpoint that serves the downloads, with the same signature scheme), and confirms it in finalizeReplayUpload. The stored file is then offered for download from the match history.

Cloud files live under resources/responses/cloud/<game>/:

Folder Contents
builtin/ Assets shipped with the server, indexed from config/<game>/cloudfilesIndex.json. Never evicted.
replays/ Replays uploaded by the game. Subject to [Replays] limits and expiry.

Neither folder is configurable. The [Replays] section controls the upload:

Key Description
Enabled Whether to accept replay uploads.
MaxFileSize Maximum size of a single replay (default 32MB). A larger PUT answers 413.
MaxTotalSize Maximum accumulated size per game (default 1GB). The oldest replays are evicted first.
Expiry How long a replay is kept since its last write. 0 or a negative value (e.g. -1s) keeps them forever.

Known deviation from the official service. The official backend stores one blob per (matchId, player, kind); this server stores one per (matchId, kind). When several players of the same match upload, the last upload wins and the history lists a single replay per match instead of one per player. This keeps storage bounded on a LAN server and is deliberate, not an oversight.

Command Line

CLI is available with similar options as the configuration. You can see the available options with server -h.

API endpoints

For documentation on how what each endpoints does, please refer to LibreMatch documentation. Other endpoints are mostly self-explanatory.

Community API

The public /community/ API is served alongside /game/. It is the object-shaped counterpart of the game API: the same data, but as JSON objects with named fields instead of the positional arrays the game client parses. Third-party tools (LibreMatch's rlink client, overlays, statistics pages) use it.

No authentication. Unlike /game/, these routes do not require sessionID and are not wrapped by SessionMiddleware; the official service is public too. Only the prefix /community/ is affected, and /game/ keeps its 401 behaviour.

18 endpoints are registered across 20 paths (two of them are served under both capitalisations, see below), including the ones that can only answer with a stub. No documented path returns 404:

Endpoint Data
GET /community/news/getNews complete
GET /community/leaderboard/getAvailableLeaderboards complete
GET /community/achievement/getAvailableAchievements complete
GET /community/leaderboard/getLeaderBoard2 complete
GET /community/leaderboard/GetPersonalStat complete
GET /community/leaderboard/GetAvatarStatForProfile complete (connected users only)
GET /community/leaderboard/getRecentMatchHistory complete
GET /community/leaderboard/getMatchHistory complete (not in the OpenAPI spec)
GET /community/leaderboard/getReplayFiles complete (not in the OpenAPI spec)
GET /community/advertisement/findAdvertisements complete
GET /community/CommunityEvent/getAvailableCommunityEvents complete
GET /community/external/proxysteamuserrequest partial: no Steam key, so steamResults is empty
GET /community/achievement/getAchievements stub by design: empty arrays per profile
GET /community/item/getInventoryByProfileIDs stub faithful to the official: empty arrays per profile
GET /community/clan/find stub: clans: []
GET /community/clan/getClanInfoFull stub: clan: null
GET /community/item/getItems stub: 404 in the official service
GET /community/leaderboard/getStatGroupsByProfileIDs stub: 404 in the official service

Two paths are served under both capitalisations, GetAvailableLeaderboards and GetPersonalStat, because the spec and the live service disagree on those two. No other alias is registered: a path that is not evidenced by the spec or by a live response would be untested surface, so the capitalisation is copied literally everywhere else.

Endpoints in stub are a deliberate decision, not a bug. They return the exact outer shape of the endpoint with result.code = 0 so a client can parse them:

  • the clan endpoints wait for a clan model (the server has none);
  • getAchievements stays empty because serving achievements to the game client grants them on Xbox, and the server does not persist progress;
  • proxysteamuserrequest has no Steam Web API key and does not proxy outbound requests (the request parameter would otherwise be a server-side request forgery vector);
  • getItems and getStatGroupsByProfileIDs are listed in the wiki but the official service answers 404, so they are registered for robustness only.

title and hosts. Each title has its own official host and the title query parameter must match it: aoe-api.worldsedgelink.com serves age1–age4, while AoM is served from andromeda-live-releaseNN-api.worldsedgelink.com (and the athens-live-api alias) with title=athens. Both hosts are served by this server from the same listener. A title this listener does not serve answers HTTP 200 with result.code = 2 instead of the official 404, so the failure is diagnosable and a documented path never disappears. The title is resolved once by a middleware that stores the game in the request context, so the handlers read it exactly like the /game ones do (models.G(r)); a rejected title never reaches a handler.

Field deviations (documented so nobody reads them as data loss):

  • country, clanlist_name, highestrank, highestranklevel, regionrank, regionranktotal, disputes, drops and steamlobbyid have no source in this server and are served as "", 0 or -1;
  • newsimage/newsbody carry the raw text because this server has no localisation table, so the locstringid fields are -1;
  • matchurls[].profile_id is the match creator, not the player that uploaded the replay: the stored index keeps one replay per (matchId, kind) and does not record the uploader;
  • replay URLs carry no SAS signature, unlike the official service.

Privacy note. findAdvertisements lists the LAN lobbies with the same visibility the game client gets, and it deliberately never exposes lobby passwords, observer passwords or the internal advertisement IP. Keep in mind that anything reaching port 443 of this server sees those lobbies. On a single-LAN deployment this is the same exposure the game client already has.

The implementation notes, field-by-field contracts and the reasoning behind each decision are in docs/community-api-implementation.md.

Ranked ladder

For Age of Empires II: Definitive Edition the 1.16.0 client expects a profile to appear in the 1v1 ranked ladder as soon as it logs in. The server therefore creates the corresponding ladder row with the default rating (1000) and 0 games for every profile that logs in. The ladder listing and its rankTotal include those rows: a profile with 0 games is shown at the default rating until it plays its first ranked match. This is a deliberate product decision, not a missing filter.

Docker

See Docker for information.

Exit Codes

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
embedded
Package embedded runs ageBattleServer inside the age server process.
Package embedded runs ageBattleServer inside the age server process.
ip
routes/community/achievement
Package achievement implements the two public achievement endpoints.
Package achievement implements the two public achievement endpoints.
routes/community/advertisement
Package advertisement implements the public lobby listing.
Package advertisement implements the public lobby listing.
routes/community/clan
Package clan implements the two public clan endpoints.
Package clan implements the two public clan endpoints.
routes/community/communityEvent
Package communityEvent implements the public community-event endpoint.
Package communityEvent implements the public community-event endpoint.
routes/community/external
Package external implements the public Steam-proxy endpoint.
Package external implements the public Steam-proxy endpoint.
routes/community/item
Package item implements the public inventory endpoints.
Package item implements the public inventory endpoints.
routes/community/leaderboard
Package leaderboard implements the public ladder, profile-stat and match history endpoints.
Package leaderboard implements the public ladder, profile-stat and match history endpoints.
routes/community/news
Package news implements the public news endpoint.
Package news implements the public news endpoint.
routes/community/shared
Package shared holds the pieces every /community endpoint needs: the result envelope, the object types of the responses, the encoders for profiles and ladder rows, input parsing and the stub helper.
Package shared holds the pieces every /community endpoint needs: the result envelope, the object types of the responses, the encoders for profiles and ladder rows, input parsing and the stub helper.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL