Repository navigation
feat: show country flags of connection endpoints - #571
Conversation
The Connections page offers to download DB-IP's free IP to Country Lite database (CC BY 4.0) on desktop and Android, then shows each endpoint's flag. Host names resolve through system DNS, falling back to DNS over HTTPS when the system answers with reserved addresses, as a proxy's fake-IP mode does.
Ketch takes a CountryLookup (DbIpCountryDatabase on desktop, Android and ketch server) that fills ActiveConnection.country, offered as the CountryDatabase controller and over GET /api/countries and POST /api/countries/download (net.countries). A remote device therefore downloads its own database, and the Connections page asks each shown device to download one.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e81ef2effc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
The Connections page shows each endpoint's country flag. Countries come from the engine that owns the connection, so a remote device downloads and uses its own database.
ActiveConnection.country(ISO code) and aCountryDatabasecontroller (status(),download()), listed asKetchFeatures.COUNTRIES(net.countries).Ketch(countries = ...)takes aCountryLookup;ConnectionRegistryfillscountryas it samples.DbIpCountryDatabase(JVM/Android) downloads DB-IP's monthly IP to Country Lite (CC BY 4.0, ~5 MB) only on request, reads it at start (~160 ms, ~10 MB), and resolves host names through the system, then Cloudflare DNS over HTTPS when the system only answers with addresses without a country (a proxy's fake-IP198.18.0.0/15).GET /api/countriesandPOST /api/countries/download;RemoteKetch.controller(CountryDatabase)uses them and fails closed against older servers.ketch serverget a database (dbip-country-lite.csv.gzin the config directory; AndroidnoBackupFilesDir). iOS has none. The CLI native image is built with--enable-url-protocols=https.Snapshots
Sample connections carry countries in these snapshots; the sample devices have no database, so the button is not shown.
Testing
CountryTableTest(IPv4/IPv6 ranges, IPv4-mapped IPv6, reserved ranges),ConnectionRegistryTest.samples_nameEachHostsCountryRemoteCountriesTest: a realKetchServer+RemoteKetchdownload the server's database and seecountryon its connections; a server without one fails closedDbIpCountryDatabaseagainst db-ip.com: 8.8.8.8 → US, a Facebook IPv6 → IE,webtorrent.io(fake-IP DNS) → US via DoH,www.baidu.com→ CN