Skip to main content

Module reports

Module reports 

Source
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_burst reports and then earns client_per_hour, the server as a whole likewise, and max_clients bounds what a flood of addresses can take.
RateLimiter
Record
One stored line, stamped with the server’s clock since a client’s is never trusted.
Reports
Where reports go, whose X-Forwarded-For to 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 gen looks.

Functions§

client_ip
The client a request comes from, for rate limiting.
file_name
conflicts-YYYY-MM-DD.jsonl for the day unix falls 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.