feat: Urutau 1.0.0, lightweight threat intelligence and web analytics
Release / Plan (reuse the published image?) (push) Successful in 4s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 1m29s
CI / Tests (Linux, race detector) (push) Failing after 1m48s
CI / Dependency audit (push) Successful in 21s
Release / ci (push) Failing after 1m50s
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Skipped
Release / Gitea release (push) Skipped

Always-on Go service (stdlib only) that follows the Traefik JSON access
log, the sshd log and the fail2ban log of a host, classifies attacks,
scores sources, keeps bounded aggregates with snapshots, and serves an
embedded dashboard with live updates, offline geolocation (DB-IP Lite),
privacy-friendly traffic analytics, an exportable blocklist and
token-authenticated federation between instances.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-14 16:13:34 -03:00
commit b4a2c2c9ec
99 files changed
+15403

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
#!/usr/bin/env node
// Regenerates internal/server/web/world.js (simplified world map, one SVG path
// per country, plus country centroids) from the public-domain Natural Earth data
// shipped in the npm package "world-atlas" and a REST Countries style JSON
// (cca2, ccn3, latlng). Only needed when the map should change.
//
// node scripts/gen-world.mjs countries-110m.json countries.json > internal/server/web/world.js
import { readFileSync } from 'node:fs';
const [topoFile, cFile] = process.argv.slice(2);
const topo = JSON.parse(readFileSync(topoFile, 'utf8'));
const countries = JSON.parse(readFileSync(cFile, 'utf8'));
const byNum = new Map(countries.map((c) => [String(c.ccn3).padStart(3, '0'), c]));
const W = 2000, LAT_TOP = 84, LAT_BOTTOM = -58;
const H = Math.round((W * (LAT_TOP - LAT_BOTTOM)) / 360);
const px = (lon) => ((lon + 180) / 360) * W;
const py = (lat) => ((LAT_TOP - Math.max(LAT_BOTTOM, Math.min(LAT_TOP, lat))) / (LAT_TOP - LAT_BOTTOM)) * H;
const { scale, translate } = topo.transform;
const arcs = topo.arcs.map((arc) => {
let x = 0, y = 0;
return arc.map(([dx, dy]) => { x += dx; y += dy; return [x * scale[0] + translate[0], y * scale[1] + translate[1]]; });
});
const arcPts = (i) => (i >= 0 ? arcs[i] : arcs[~i].slice().reverse());
const ring = (idx) => {
const pts = [];
for (const i of idx) { const a = arcPts(i); pts.push(...(pts.length ? a.slice(1) : a)); }
return pts;
};
const paths = {}, cent = {};
for (const g of topo.objects.countries.geometries) {
const c = byNum.get(String(g.id).padStart(3, '0'));
if (!c || c.cca2 === 'AQ') continue;
const polys = g.type === 'Polygon' ? [g.arcs] : g.type === 'MultiPolygon' ? g.arcs : [];
let d = '';
for (const poly of polys) {
for (const r of poly) {
const pts = ring(r).map(([lo, la]) => [Math.round(px(lo)), Math.round(py(la))]);
const out = [];
for (const p of pts) { const l = out[out.length - 1]; if (!l || l[0] !== p[0] || l[1] !== p[1]) out.push(p); }
if (out.length < 4) continue;
let s = `M${out[0][0]} ${out[0][1]}`, px0 = out[0][0], py0 = out[0][1];
for (const [x, y] of out.slice(1)) {
// a ring crossing the antimeridian jumps across the map: start a new subpath instead of drawing a line over it
s += Math.abs(x - px0) > W / 2 ? `M${x} ${y}` : `l${x - px0} ${y - py0}`;
px0 = x; py0 = y;
}
d += s + 'z';
}
}
if (d) paths[c.cca2] = d;
}
for (const c of countries) if (c.latlng?.length === 2) cent[c.cca2] = [Math.round(px(c.latlng[1])), Math.round(py(c.latlng[0]))];
process.stdout.write(`/* Generated by scripts/gen-world.mjs from Natural Earth (public domain). */\nwindow.URUTAU_WORLD = ${JSON.stringify({ w: W, h: H, paths, centroids: cent })};\n`);