Let the owner change regions by place name, without a restart

The p2p node can now add and drop regions while running (SetRegions):
topics, validators, subscriptions and per-region peer discovery start and
stop with them, and a newly followed region catches up by sync.

PUT /api/v1/regions (owner token) applies a change and the node saves it in
regions.json, which wins over --region from then on. The owner's browser
gets a "Regions" page: search a place by name (GeoNames cities, offline,
CC BY 4.0), follow its cell plus any cell within about 40 km.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-18 10:28:16 +01:00
co-authored by Claude Sonnet 5.5
parent e7bec4fb63
commit fd439710df
24 changed files with 70080 additions and 42 deletions
+16
View File
@@ -28,6 +28,14 @@ Owners publish from the same screen: "New listing" takes a title, price and
pasted coordinates (only a ~1 km area is published, never the address), and
listings can be edited, renewed (30 days, manually) or deleted there.
**Regions** are the areas a node keeps listings for (3-character geohash cells,
about 100 to 150 km wide). `--region` sets them the first time. After that the
owner changes them in the browser: "My listings", then "Regions". Search a place
by name (Bonn, Cologne, München, …); the page offers the place's own cell and any
cell within about 40 km, and the change applies at once, without a restart. The
choice is kept in `regions.json` in the data directory and wins over `--region`
from then on (delete the file to go back to the flag).
Nodes find each other through a bootstrap list in DNS (`allmende.stinnesbeck.com`),
the peers they met last time, a DHT per region, and mDNS on the local network.
Add your own bootstrap peers with `--bootstrap /ip4/<addr>/tcp/<port>/p2p/<peer id>`
@@ -91,3 +99,11 @@ needs. `nix flake check` builds the package and boots a NixOS VM that tests the
module. After changing `go.mod`, update `vendorHash` in `nix/package.nix`.
Licensed under the [GNU AGPL-3.0](LICENSE): free for everyone, and it stays free.
## Third-party data
The place names the region picker searches (`web/static/places.tsv`) come from
[GeoNames](https://www.geonames.org/) (cities with more than 15,000 inhabitants),
licensed [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), with a few
German names added by hand. `web/scripts/places.mjs` rebuilds the file from
GeoNames' `cities15000.txt`. The page credits GeoNames wherever places are searched.