Generate and serve DN42 registry snapshots in the RIR statistics exchange
format. The project treats each object source value from the DN42 registry as
a registry and publishes files under /stats/<registry>/.
The default registry source is the public Origami mirror:
https://git.origami.pub/Bingxin/dn42-registry.git
The generated output follows the APNIC RIR statistics exchange format where it fits DN42 data:
delegated-<registry>-yyyymmdddelegated-<registry>-latest- matching
.md5checksum files version|registry|serial|records|startdate|enddate|utcoffsetregistry|*|type|*|count|summaryregistry|cc|type|start|value|date|status
All generated file names and file contents are lowercase.
The code uses only the Python standard library. Python 3.11 or newer is recommended.
python -m venv .venv
. .venv/bin/activate
pip install -e .This clones or updates the DN42 registry into .cache/dn42-registry and writes
output to public/stats.
dn42-rir-statistics generate --output-dir publicUse a local registry checkout instead:
dn42-rir-statistics generate --registry-dir /path/to/dn42-registry --output-dir publicValidate generated files:
dn42-rir-statistics validate --output-dir publicThe HTTP server publishes public as the document root, so statistics are
available below /stats/<registry>/.
dn42-rir-statistics web --output-dir public --host 0.0.0.0 --port 8000Example URL:
http://127.0.0.1:8000/stats/dn42/delegated-dn42-latest
The rsync command starts a read-only rsync daemon with a stats module pointing
at public/stats. It requires the system rsync binary.
dn42-rir-statistics rsync --output-dir public --host 0.0.0.0 --port 8730Example client command:
rsync rsync://127.0.0.1:8730/stats/dn42/delegated-dn42-latest .The combined server generates at startup, starts HTTP and rsync, and regenerates once per day at the configured UTC time.
dn42-rir-statistics serve \
--output-dir public \
--web-host 0.0.0.0 \
--web-port 8000 \
--rsync-host 0.0.0.0 \
--rsync-port 8730 \
--daily-at 03:00Disable rsync when the binary is not installed:
dn42-rir-statistics serve --no-rsyncBuild the image locally:
docker build -t dn42-rir-statistics:local .Run the combined daily server:
docker run --rm \
--name dn42-rir-statistics \
-p 8000:8000 \
-p 8730:8730 \
-v dn42-rir-data:/data \
dn42-rir-statistics:localThe container stores generated files and the DN42 registry cache under /data.
By default it runs:
dn42-rir-statistics serve \
--output-dir /data/public \
--cache-dir /data/cache/dn42-registry \
--web-host 0.0.0.0 \
--web-port 8000 \
--rsync-host 0.0.0.0 \
--rsync-port 8730 \
--rsync-config /data/rsyncd.conf \
--daily-at 03:00Override the command to change ports, schedule, or source registry:
docker run --rm -p 8080:8080 -v dn42-rir-data:/data dn42-rir-statistics:local \
serve \
--output-dir /data/public \
--cache-dir /data/cache/dn42-registry \
--web-host 0.0.0.0 \
--web-port 8080 \
--rsync-host 0.0.0.0 \
--rsync-port 8730 \
--rsync-config /data/rsyncd.conf \
--daily-at 06:00The included compose.yaml is a local example. Update the image value before
using it as a published deployment reference.
docker compose up -d --buildGenerated files are available at:
http://127.0.0.1:8000/stats/dn42/delegated-dn42-latest
rsync://127.0.0.1:8730/stats/dn42/delegated-dn42-latest
The workflow in .github/workflows/container.yml builds multi-architecture
images for linux/amd64 and linux/arm64, then pushes them to GHCR on pushes
to main, master, tags matching v*, and manual runs. Pull requests build
the image without pushing it.
The published image name is derived from the repository name and lowercased:
ghcr.io/<owner>/<repository>
Repository settings must allow GitHub Actions to write packages. The workflow
uses the built-in GITHUB_TOKEN; no separate registry token is required for
normal same-repository GHCR publishing.
- APNIC RIR statistics exchange format: https://www.apnic.net/about-apnic/corporate-documents/documents/resource-guidelines/rir-statistics-exchange-format/
- DN42 registry mirror: https://git.origami.pub/Bingxin/dn42-registry