KoG Client

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 of the KoG client on your computer and the public places it talks to. Inside the client, the settings menus start the updater and the login component. Both use one HTTP layer. The updater reads signed manifests from client.kog.tw and files from GitHub releases, and checks them against public keys compiled into the client. The login component talks to the KoG account service at kog.tw through the HTTP layer and through your web browser, and keeps the device key in the operating system key store. A dashed arrow marks the planned join proof towards game servers.
The KoG client and the public addresses it talks to. Solid lines exist today; the dashed line is planned. Open the diagram alone
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 planned

Components #

Paths are relative to kog-client.

ComponentFilesWhat it doesState
Manifest rulessrc/engine/shared/kog_update.cpp, kog_update.hParses 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 keyssrc/engine/client/kog_update_pubkey.hThe keys of each channel, compiled into the client. Stable still has placeholders.Partly built
Updatersrc/engine/client/updater.cpp, updater.hFetches manifest and signature, downloads files, replaces them only after the checks pass, keeps the previous version. Compiled only with -DAUTOUPDATE=ON.Built
Fail-safesrc/engine/shared/kog_failsafe.cppStart 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 helperssrc/engine/shared/kog_login.cpp, kog_login.hPKCE, the callback parser, the loopback listener, the allowed endpoint origins, the bytes of the join challenge and their signature.Built
Login componentsrc/game/client/components/kog/kog_login.cppThe state machine of the login (discovery, browser, token, user info, device registration, removal) and the decision whether to answer a challenge.Built
Key storesrc/engine/client/kog_keystore.cppKeeps the device private key: macOS Keychain, Windows Credential Manager, otherwise a file with mode 0600.Built
Capabilities and hellosrc/game/client/components/kog/kog_hello.cpp, src/engine/shared/kog_protocol.hOnly the console command kog_version and reserved names. No message is sent.Planned
Settings and menussrc/game/client/components/menus_settings_ddnet.cppThe account box, the update channel selection, the switches.Built
Settings variablessrc/engine/shared/config_variables_kog.hEvery kog_* and cl_kog_* setting with its default.Built
HTTP layersrc/engine/http.h, src/engine/shared/http_curl.cppThe 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/shared and 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.

Edit this page on GitHub