interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / visits / README.md
| 1 | # visits: the owner's analytics, first party, in seeded Omega |
| 2 | |
| 3 | Who visited INTERPLANE and what they looked at, from forged's own access log. No cookie, no |
| 4 | script, no outside service: the visitor's browser is never asked for anything. The figures stay |
| 5 | on the machine that served the requests and are shown only inside the owner's private network. |
| 6 | |
| 7 | Status: IMPLEMENTED and EXERCISED on the Spark host (gates below; the reducer also ran on the live |
| 8 | log). 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 |
| 19 | OMV=$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 | |
| 28 | The log line is `<epoch> <address> <method> <path> <status> <bytes> <ms>`, with or without the two |
| 29 | fields `<agent> <referrer>` after it; any other shape is |
| 30 | counted as skipped. A visitor is one network address. A project is the first two segments of the |
| 31 | path (`/owner/repo`), cut at `?`; the home page is `/`. The page shows totals, requests and |
| 32 | visitors by UTC day, the 25 most visited projects and the 40 most active visitors with their first |
| 33 | and last request. `visits.tsv` carries the same figures as `T`, `A`, `D`, `P` and `V` lines. |
| 34 | |
| 35 | forged logs the request's `User-Agent` and `Referer` as fields 8 and 9 (at most 200 bytes each, a |
| 36 | space as `+`, `-` when absent); lines written before that have seven fields and still count. A |
| 37 | crawler or tool is a request whose agent contains one of the words of `kws` in `visits.om`, in |
| 38 | any letter case (among them `bot`, `crawl`, `googleother`, `curl` and `python`; `kws` is the list, |
| 39 | and the gate checks its own copy against it). Any |
| 40 | other name counts as a browser. The name is whatever the client sent: a tool can call itself a |
| 41 | browser, so the split is a lower bound on crawlers and tools, not proof of people. An address that |
| 42 | ever used a crawler or tool name is listed as one. The list came from the log: on the first minutes |
| 43 | of agent logging (2026-11-09) Google's general crawler, which calls itself `GoogleOther`, was 525 |
| 44 | of 553 named requests and has none of the four usual words in it. The `A` line is: requests from |
| 45 | crawlers and tools, from browsers, with no name, from seven-field lines, then visitors that are |
| 46 | crawlers or tools and visitors that are browsers; each `V` line ends with `c`, `o` or `-`. |
| 47 | |
| 48 | Limits: 65,536 visitors, 8,192 projects, 512 days, a line of at most 4,095 bytes; a visitor or |
| 49 | project that does not fit its table is counted under "not listed" on the page. A request whose UTC day is |
| 50 | before the first request's day or 512 or more days after it stays in the totals and is counted as |
| 51 | outside the day table (the last field of the `T` line). The per-day and per-project visitor counts |
| 52 | use sets of at most 2,097,152 day-visitor and 1,048,576 project-visitor pairs; a pair past a full |
| 53 | set 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 |
| 70 | mkdir -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 |
| 73 | chmod 755 ~/.local/share/interplane-owner/visits ~/.local/share/interplane-owner/owner |
| 74 | cp visits/visits.css galaxy/tokens.css ~/forge-data/owner/ |
| 75 | cp infra/spark/interplane-visits.service infra/spark/interplane-owner.service ~/.config/systemd/user/ |
| 76 | systemctl --user daemon-reload && systemctl --user enable --now interplane-visits.service interplane-owner.service |
| 77 | ``` |
| 78 | |
| 79 | Undo: `systemctl --user disable --now interplane-visits.service interplane-owner.service` and |
| 80 | remove `~/forge-data/owner`. |
| 81 | |
| 82 | ## Gates |
| 83 | |
| 84 | ```sh |
| 85 | sh visits/tests/run.sh # the reducer: prints RESULT pass=<count> fail=0 when every case holds |
| 86 | bash visits/tests/owner.sh # the server, on 127.0.0.1 port 18492: the same RESULT form |
| 87 | ``` |
| 88 | |
| 89 | The reducer's oracle is awk, sort and uniq over the same 6,037-line log (6,000 requests, half of |
| 90 | them in the seven-field form, 31 addresses, 9 projects, 37 lines of seven kinds that must be |
| 91 | skipped); `visits.tsv` must equal it. Negative controls: a mutant that counts every request as a |
| 92 | new daily visitor does not match, a mutant that drops the group marks does not show the grouped |
| 93 | total, a mutant that matches names in lower case only does not match, and a mutant that tries only |
| 94 | the first word of the list is caught by a log with one request per word. Each word with its first |
| 95 | or its last byte removed must count as a browser, so a match that skips a byte fails. The page groups |
| 96 | digits in threes (1,417,491), checked on the total and on every day row; `visits.tsv` keeps plain numbers. The |
| 97 | server gate compares the three files byte for byte (one of 405,000 bytes), checks the headers, |
| 98 | 404 and 405, and that six addresses outside loopback and the tailnet are refused; its negative |
| 99 | control shows a mutant without the address rule does start on 0.0.0.0. |
| 100 | |
| 101 | On the live log of 2026-11-09 (1,371,189 lines, 186 MB) the reducer took 0.89 s and 16 MB. |
| 102 | |
| 103 | The Spark's ingress filter drops tailnet ports it does not list. The line that lets the owner's |
| 104 | two 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, |
| 106 | 100.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. |