interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / visits / README.md

113 lines · 6941 bytes Raw Blame History Rendered
1# visits: the owner's analytics, first party, in seeded Omega
2
3Who visited INTERPLANE and what they looked at, from forged's own access log. No cookie, no
4script, no outside service: the visitor's browser is never asked for anything. The figures stay
5on the machine that served the requests and are shown only inside the owner's private network.
6
7Status: IMPLEMENTED and EXERCISED on the Spark host (gates below; the reducer also ran on the live
8log). Not installed as a service.
9
10## Units
11
12| Unit | What it is |
13|---|---|
14| `visits.om` | its own program: reads the log, writes `visits.tsv` and `visits.html` (mode 0600) |
15| `owner.om` | composed after `seed/net/http.om` and `seed/net/notls.om`: serves the page privately |
16| `visits.css` | the page's stylesheet; colours only through `tokens.css` |
17
18```sh
19OMV=$HOME/canon/omega-mv; OMC=$OMV/seed/out/omc # the omc whose sha256 is PIN in visits/tests/run.sh
20$OMC < visits/visits.om > visits
21{ printf 'om2\n'; cat $OMV/seed/net/http.om $OMV/seed/net/notls.om visits/owner.om; } | $OMC > owner
22./visits ~/forge-data/logs/forged.log # writes visits.tsv and visits.html in the working directory
23./owner 100 64 0 2 18191 # http://100.64.0.2:18191/ inside the tailnet
24```
25
26## What is counted
27
28The log line is `<epoch> <address> <method> <path> <status> <bytes> <ms>`, with or without the two
29fields `<agent> <referrer>` after it; any other shape is
30counted as skipped. A visitor is one network address. A project is the first two segments of the
31path (`/owner/repo`), cut at `?`; the home page is `/`. The page shows totals, requests and
32visitors by UTC day, the 25 most visited projects and the 40 most active visitors with their first
33and last request. `visits.tsv` carries the same figures as `T`, `A`, `D`, `P` and `V` lines.
34
35forged logs the request's `User-Agent` and `Referer` as fields 8 and 9 (at most 200 bytes each, a
36space as `+`, `-` when absent); lines written before that have seven fields and still count. A
37crawler or tool is a request whose agent contains one of the words of `kws` in `visits.om`, in
38any letter case (among them `bot`, `crawl`, `googleother`, `curl` and `python`; `kws` is the list,
39and the gate checks its own copy against it). Any
40other name counts as a browser. The name is whatever the client sent: a tool can call itself a
41browser, so the split is a lower bound on crawlers and tools, not proof of people. An address that
42ever used a crawler or tool name is listed as one. The list came from the log: on the first minutes
43of agent logging (2026-11-09) Google's general crawler, which calls itself `GoogleOther`, was 525
44of 553 named requests and has none of the four usual words in it. The `A` line is: requests from
45crawlers and tools, from browsers, with no name, from seven-field lines, then visitors that are
46crawlers or tools and visitors that are browsers; each `V` line ends with `c`, `o` or `-`.
47
48Limits: 65,536 visitors, 8,192 projects, 512 days, a line of at most 4,095 bytes; a visitor or
49project that does not fit its table is counted under "not listed" on the page. A request whose UTC day is
50before the first request's day or 512 or more days after it stays in the totals and is counted as
51outside the day table (the last field of the `T` line). The per-day and per-project visitor counts
52use sets of at most 2,097,152 day-visitor and 1,048,576 project-visitor pairs; a pair past a full
53set is not counted as a new visitor, and that is not shown (live 2026-11-09: 704 visitors).
54
55## Privacy, stated plainly
56
57- The files are mode 0600 and the folder is the owner's.
58- `owner` starts only on a loopback address (127.x.x.x) or a tailnet address (100.64.0.0/10) and
59 exits 1 for any other, so the page cannot be bound to a public interface by mistake. It serves
60 exactly three files, sends `Cache-Control: no-store` and `X-Robots-Tag: noindex`, and allows no
61 script.
62- Nothing is encrypted and nothing depends on the file format being hard to read: Omega and this
63 format are public. The data is private because of where it lives and who can reach it.
64- Network addresses are personal data in some places. They are already in the server's log; this
65 adds a summary of them for the owner and sends them nowhere.
66
67## Install (after merge)
68
69```sh
70mkdir -p ~/.local/share/interplane-owner && mkdir -m 700 -p ~/forge-data/owner
71$OMC < visits/visits.om > ~/.local/share/interplane-owner/visits
72{ printf 'om2\n'; cat $OMV/seed/net/http.om $OMV/seed/net/notls.om visits/owner.om; } | $OMC > ~/.local/share/interplane-owner/owner
73chmod 755 ~/.local/share/interplane-owner/visits ~/.local/share/interplane-owner/owner
74cp visits/visits.css galaxy/tokens.css ~/forge-data/owner/
75cp infra/spark/interplane-visits.service infra/spark/interplane-owner.service ~/.config/systemd/user/
76systemctl --user daemon-reload && systemctl --user enable --now interplane-visits.service interplane-owner.service
77```
78
79Undo: `systemctl --user disable --now interplane-visits.service interplane-owner.service` and
80remove `~/forge-data/owner`.
81
82## Gates
83
84```sh
85sh visits/tests/run.sh # the reducer: prints RESULT pass=<count> fail=0 when every case holds
86bash visits/tests/owner.sh # the server, on 127.0.0.1 port 18492: the same RESULT form
87```
88
89The reducer's oracle is awk, sort and uniq over the same 6,037-line log (6,000 requests, half of
90them in the seven-field form, 31 addresses, 9 projects, 37 lines of seven kinds that must be
91skipped); `visits.tsv` must equal it. Negative controls: a mutant that counts every request as a
92new daily visitor does not match, a mutant that drops the group marks does not show the grouped
93total, a mutant that matches names in lower case only does not match, and a mutant that tries only
94the first word of the list is caught by a log with one request per word. Each word with its first
95or its last byte removed must count as a browser, so a match that skips a byte fails. The page groups
96digits in threes (1,417,491), checked on the total and on every day row; `visits.tsv` keeps plain numbers. The
97server gate compares the three files byte for byte (one of 405,000 bytes), checks the headers,
98404 and 405, and that six addresses outside loopback and the tailnet are refused; its negative
99control shows a mutant without the address rule does start on 0.0.0.0.
100
101On the live log of 2026-11-09 (1,371,189 lines, 186 MB) the reducer took 0.89 s and 16 MB.
102
103The Spark's ingress filter drops tailnet ports it does not list. The line that lets the owner's
104two devices reach the page is in `/etc/atlas/ingress.nft` (added 2026-11-09, backup
105`ingress.nft.bak-owner-20261109T224604Z`): `iifname "tailscale0" ip saddr { 100.64.0.1,
106100.64.0.4 } tcp dport 18191 accept`.
107
108## Not done
109
110- The referrer is logged but not reported yet.
111- The reducer re-reads the whole log on each run.
112- Static pages nginx serves itself are not in forged's log; after the galaxy becomes the home page,
113 the home page is.