Expand description
Conflict reports from installers: two selected packages wrote the same file, the later one won, and only the operator can fix the catalogue.
An unauthenticated write, so the body is capped, every field validated, nothing echoed, the rate limited per client and overall, and storage is append-only lines. Nothing stored identifies a user: the client address the limiter needs stays in memory.
Modules§
- cidr 🔒
- client_
address 🔒 - overlap_
summary 🔒 - rate_
limiter 🔒 - report_
file 🔒 - report_
log 🔒 - validation 🔒
Structs§
- Cidr
- An IP network written as
10.0.0.0/24, or a single address. - Limits
- Token buckets: each client may burst
client_burstreports and then earnsclient_per_hour, the server as a whole likewise, andmax_clientsbounds what a flood of addresses can take. - Rate
Limiter - Record
- One stored line, stamped with the server’s clock since a client’s is never trusted.
- Reports
- Where reports go, whose
X-Forwarded-Forto believe, and the limiter. - Validated
- What a report that passed validation stores.
Constants§
- MAX_
BODY_ BYTES - A real report is a few hundred bytes.
- MAX_
CONFLICTS - Kept from one report; the rest count as dropped.
- MAX_
FILE_ BYTES - About a Windows path: anything longer is not a game file.
- MAX_
INSTALLER_ LEN - MAX_
PACKAGES - MIN_
PACKAGES - A conflict needs two writers, and nobody sends nine by accident.
- SUMMARY_
DAYS - How far back
manifest genlooks.
Functions§
- client_
ip - The client a request comes from, for rate limiting.
- file_
name conflicts-YYYY-MM-DD.jsonlfor the dayunixfalls on; ISO dates sort as text, which the overlap summary relies on.- overlap_
warnings - One warning per pair of packages reported overlapping in the last
SUMMARY_DAYS, so a user’s bad day becomes something the operator sees when publishing; unreadable files and lines are skipped, since this is advice. - utc_
date - The UTC calendar date of a unix timestamp, by Howard Hinnant’s
civil_from_days, to spare a date crate. - validate
- A bad game, installer or an empty result rejects the report; a bad conflict is dropped and counted, so one malformed entry does not cost the rest.