Start
Architecture Built
What is inside the client, how the parts depend on each other, and which public addresses it contacts. Server-side programs are out of scope: this documentation describes the client.
Overview #
The KoG client is the DDNet and TClient game client plus a small set of additions in separate kog_* files. The additions do two things: they keep the client up to date from a signed manifest, and they let you log in to your KoG account through your browser. Everything else is the code of the game client that the fork is based on.
Outside your computer the client talks to exactly three places that belong to KoG or its tooling, plus the game servers you choose to join and the server list inherited from DDNet:
client.kog.tw: signed update manifests (static files).github.com: the release files that a manifest points to.- The KoG account service at
https://kog.tw: the login, seen from the client as an OAuth 2.0 / OpenID Connect provider. The client knows its public endpoints and nothing else about it.
Diagram source as text (Mermaid)
flowchart LR
subgraph PC["Your computer: the KoG client"]
UI["Settings and menus"]
UPD["Updater<br/>checks against compiled-in<br/>public keys"]
LOG["Login component"]
STORE["Key store<br/>OS keychain or key file"]
HTTP["HTTP layer"]
end
BR["Your web browser"]
CT["client.kog.tw<br/>signed manifests"]
GH["github.com<br/>release files"]
ACC["KoG account service<br/>kog.tw"]
SRV["Game servers"]
UI --> UPD
UI --> LOG
UPD --> HTTP
LOG --> HTTP
LOG --> STORE
HTTP -->|"manifest, signature"| CT
HTTP -->|"files, checked by hash"| GH
HTTP -->|"token, public device key"| ACC
LOG <-->|"login page, loopback callback"| BR
BR <-->|"you log in"| ACC
LOG -.->|"planned: join proof"| SRV
classDef planned stroke-dasharray:6 4
class SRV plannedComponents #
Paths are relative to kog-client.
| Component | Files | What it does | State |
|---|---|---|---|
| Manifest rules | src/engine/shared/kog_update.cpp, kog_update.h | Parses update.json, checks the signature (Ed25519, with Monocypher) and every rule: channel, sequence, expiry, version, halt, rollout, minimum version, allowed hosts and paths. Plain functions without network or disk access, so they can be tested alone. | Built |
| Public keys | src/engine/client/kog_update_pubkey.h | The keys of each channel, compiled into the client. Stable still has placeholders. | Partly built |
| Updater | src/engine/client/updater.cpp, updater.h | Fetches manifest and signature, downloads files, replaces them only after the checks pass, keeps the previous version. Compiled only with -DAUTOUPDATE=ON. | Built |
| Fail-safe | src/engine/shared/kog_failsafe.cpp | Start marker and the decision to restore the previous version after two starts that did not reach the start screen; remembers a bad version. | Built |
| Login helpers | src/engine/shared/kog_login.cpp, kog_login.h | PKCE, the callback parser, the loopback listener, the allowed endpoint origins, the bytes of the join challenge and their signature. | Built |
| Login component | src/game/client/components/kog/kog_login.cpp | The state machine of the login (discovery, browser, token, user info, device registration, removal) and the decision whether to answer a challenge. | Built |
| Key store | src/engine/client/kog_keystore.cpp | Keeps the device private key: macOS Keychain, Windows Credential Manager, otherwise a file with mode 0600. | Built |
| Capabilities and hello | src/game/client/components/kog/kog_hello.cpp, src/engine/shared/kog_protocol.h | Only the console command kog_version and reserved names. No message is sent. | Planned |
| Settings and menus | src/game/client/components/menus_settings_ddnet.cpp | The account box, the update channel selection, the switches. | Built |
| Settings variables | src/engine/shared/config_variables_kog.h | Every kog_* and cl_kog_* setting with its default. | Built |
| HTTP layer | src/engine/http.h, src/engine/shared/http_curl.cpp | The one place that makes HTTPS requests (libcurl). The updater and the login use it; the login switches off redirects for its token requests. | Built |
Design rules that follow from this layout #
- Checks are separate from effects. The rules that decide whether a manifest or a callback is acceptable live in
engine/sharedand are covered by unit tests (src/test/kog_update_test.cpp,kog_login_test.cpp,kog_failsafe_test.cpp). The updater and the login component only do the I/O. - Trust does not depend on the network path. A manifest is accepted because of its signature, not because of the host or TLS. See the update channel.
- Nothing changes on the game connection yet. The client defines no new network message; the planned ones are on the protocol page.
- Nothing secret leaves the machine. The device private key is made on your computer and stays in the key store. See login.
Not verified. This page was written from reading the source. The unit tests above were not re-run for it, and the interplay of the parts (for example the updater and the key store in one session) has no end-to-end test.