Compare commits
146 Commits
core/phase-1
...
phase-4
| Author | SHA1 | Date | |
|---|---|---|---|
| d9871ae1b7 | |||
| aca9bd8d9f | |||
| 8efea92c01 | |||
| 25d4875b38 | |||
| 5023575680 | |||
| ea1ec11cd1 | |||
| 1905ff81ce | |||
| 3ca88e26cc | |||
| d058a72ed2 | |||
| facf4422c8 | |||
| 142f0bedf7 | |||
| 7f733102bf | |||
| 6f259e410a | |||
| af36e083ee | |||
| 6ce6bfdb79 | |||
| b492ccf5f9 | |||
| 43a0dfdadc | |||
| b0e92ff262 | |||
| a626c2559f | |||
| 7aa8b0ea62 | |||
| 805b4b8db5 | |||
| ec4a0086b9 | |||
| 6c11acdc6d | |||
| 82339f098f | |||
| 76a56311cf | |||
| a212d5d421 | |||
| 789d733b72 | |||
| 3ef0424454 | |||
| 1d6a96f971 | |||
| 1d4b567d96 | |||
| 737da4a3b1 | |||
| ee99051c29 | |||
| e12c25b85d | |||
| ee50b3451f | |||
| 00b506670f | |||
| d4da521a91 | |||
| f21876c473 | |||
| 1cc3599f10 | |||
| 8e3a3c01e4 | |||
| e95b86fdeb | |||
| 18169dcbc2 | |||
| 0b406069ee | |||
| c4777a5477 | |||
| c7eb190c3b | |||
| f9ef6e66c3 | |||
| 5e28394de5 | |||
| 9ae721b79f | |||
| 4692044099 | |||
| 08e24e5d40 | |||
| 1358649550 | |||
| d249bcf9f2 | |||
| 1f5e4a59a0 | |||
| d74079c66d | |||
| 84c1c81906 | |||
| ffffa62999 | |||
| 4150848842 | |||
| a278ef3b23 | |||
| 6b2ba163df | |||
| 66dcf75fea | |||
| 39dd8f0f47 | |||
| 7a2aee20eb | |||
| 0e9c2a7bc9 | |||
| dcdff4d414 | |||
| b9ab5006a8 | |||
| 7a32eeb411 | |||
| c2c6454302 | |||
| d035fd3165 | |||
| 7b906de79f | |||
| 6ba3fa4b17 | |||
| 5df34bfae6 | |||
| 7322bbd856 | |||
| 0213021bb1 | |||
| c45dafa2a3 | |||
| 4d87537a76 | |||
| 09b8313a04 | |||
| 057abbc954 | |||
| 457aea86ca | |||
| 23a283ece9 | |||
| ba3a060b2e | |||
| 503916492d | |||
| b24ffdf9db | |||
| 3bf5fa0e1a | |||
| bc336d1188 | |||
| e84eb1ba74 | |||
| 0749119f19 | |||
| e2a777882c | |||
| b85c38f615 | |||
| ca9bf3fdd4 | |||
| a61dfd854f | |||
| 9933f55242 | |||
| 3e326e85a0 | |||
| aed5fbfcff | |||
| f9dd2247f8 | |||
| 6237e721d6 | |||
| 12886a1d31 | |||
| c18ae154ad | |||
| 211b851c3e | |||
| a5190acc3b | |||
| 3d8f524d00 | |||
| 4054427b62 | |||
| 18da3f5d5a | |||
| dc23bfe842 | |||
| cde0c3ea3b | |||
| 7cb5715580 | |||
| cb04bff74e | |||
| 24009414de | |||
| 1adfa05640 | |||
| 83a857ad80 | |||
| afc3477b5c | |||
| 7863202e3a | |||
| 443d7457d2 | |||
| 432ae0f803 | |||
| 83b7b3b7d6 | |||
| cbb3e41ca7 | |||
| 17f26f94a3 | |||
| e28b084a19 | |||
| 421800ec18 | |||
| 85edfa7128 | |||
| 60fb4b63ee | |||
| 7d3af00720 | |||
| 43918943da | |||
| dd10557b87 | |||
| 339882ec96 | |||
| 00f8dffc6a | |||
| 99b2a3a1a5 | |||
| f382fe2f76 | |||
| 54574702ea | |||
| 2b66729f1b | |||
| 4448527b16 | |||
| b9e14c6aee | |||
| 98dad246d3 | |||
| fee35830d1 | |||
| c5380c65a6 | |||
| 7cc92ec42d | |||
| 2c06efead1 | |||
| 56982fc6b7 | |||
| aa0f66b5ac | |||
| 56209cc595 | |||
| 74d1bc02da | |||
| 6ce1fe9d2b | |||
| c0ed9c65c5 | |||
| 7c81945771 | |||
| 94ba18d38b | |||
| 73a9f3da45 | |||
| 027bf3a553 | |||
| db43af24a6 |
@@ -0,0 +1,2 @@
|
|||||||
|
# Local Fabrica runs: records, logs and artifacts (Fabrica core docs/FORMATS.md)
|
||||||
|
runs/
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Ianitor Domi declares itself to Fabrica (Fabrica core docs/FORMATS.md, "Fabrica: the app"; docs/fabrica.md): a server
|
||||||
|
# part only, the reverse proxy with its control plane and web UI, deployed by .fabrica/artifex/deploy.yaml through the
|
||||||
|
# server's fabrica-deploy@ianitor, which is also how it updates. Its Aula page comes from the release of a `v*` tag
|
||||||
|
# (.fabrica/artifex/release.yaml), started on the hub for the pushed tag: no desktop part, as Ianitor has no installer
|
||||||
|
# to bump and tag. Fabrica's Apps screen shows one card: Deploy, then the Custos card. The colour is the murex accent
|
||||||
|
# (packages/ui/src/tokens.css, --accent).
|
||||||
|
name: Ianitor
|
||||||
|
icon: globe
|
||||||
|
color: "#e0a3dc"
|
||||||
|
aula: true
|
||||||
|
tagPrefix: v
|
||||||
|
parts:
|
||||||
|
server:
|
||||||
|
pipeline: deploy
|
||||||
|
input: ianitor
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Ianitor Domi onto the server (Fabrica docs/04_deploy.md): `fabrica deploy ianitor`, or Fabrica's Apps → Ianitor →
|
||||||
|
# Deploy. The NixOS runner starts fabrica-deploy@ianitor: the server's clone is fast-forwarded, the flake input
|
||||||
|
# `ianitor` updated (inputs.ianitor.nixosModules.ianitor, docs/deploy/configuration-server.patch), the system
|
||||||
|
# switched, the health check asked, and the switch rolled back if it does not answer. After a deploy run
|
||||||
|
# deploy/test-access.sh from a LAN machine (CLAUDE.md).
|
||||||
|
name: deploy
|
||||||
|
on:
|
||||||
|
manual: true
|
||||||
|
runner: nixos
|
||||||
|
steps:
|
||||||
|
- id: approve
|
||||||
|
approve: "Deploy Ianitor ${{ commit }} to the server?"
|
||||||
|
- id: switch
|
||||||
|
needs: [approve]
|
||||||
|
deploy: ianitor
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Ianitor Domi: the web UI's e2e suite on Fabrica's e2e runner (docs/fabrica.md part 6; Fabrica docs/20_tests.md,
|
||||||
|
# docs/31_runners_here.md): the built UI against the demo control plane, Playwright headless in the installed Edge,
|
||||||
|
# the records, traces and videos kept with the run. Manual: no push webhook reaches the hub yet. The e2e runner's
|
||||||
|
# runner.json sets PLAYWRIGHT_BROWSERS_PATH (Playwright's ffmpeg for the videos; on D: or F:, never C:).
|
||||||
|
name: e2e
|
||||||
|
on:
|
||||||
|
manual: true
|
||||||
|
runner: windows-e2e
|
||||||
|
steps:
|
||||||
|
- id: install
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
- id: web
|
||||||
|
needs: [install]
|
||||||
|
run: fabrica tests run --target web
|
||||||
|
artifacts: [".fabrica/runs/tests/**"]
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# Ianitor Domi: the five test layers (ROADMAP §5) on a push to main, or by hand. Layer 1 (the differential
|
||||||
|
# suite against Caddy) runs inside the workspace tests; layer 2 is scripts/conformance.sh (h2spec, testssl.sh);
|
||||||
|
# layer 3 tests/fuzz/run.sh (cargo-fuzz, 2 minutes a target; any crash fails); layer 4 the NixOS VM tests;
|
||||||
|
# layer 5 scripts/bench.sh (load and a 5-minute soak against Caddy; results kept as artifacts).
|
||||||
|
# Runner: label `nixos`, on a host with /dev/kvm and Nix's `kvm` system feature (the VM tests; on Hyper-V,
|
||||||
|
# nested virtualisation on), outbound HTTPS (crates.io, cache.nixos.org) and about 20 GB free. Every tool comes
|
||||||
|
# from the flake's `ci` shell, so the runner needs only Nix with flakes.
|
||||||
|
name: layers
|
||||||
|
on:
|
||||||
|
push: [main]
|
||||||
|
manual: true
|
||||||
|
runner: nixos
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: "never"
|
||||||
|
CARGO_BUILD_JOBS: "8"
|
||||||
|
steps:
|
||||||
|
- id: workspace-tests
|
||||||
|
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c cargo test --workspace --no-fail-fast
|
||||||
|
- id: conformance
|
||||||
|
needs: [workspace-tests]
|
||||||
|
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c scripts/conformance.sh
|
||||||
|
artifacts: ["bench/conformance/*"]
|
||||||
|
- id: fuzz
|
||||||
|
needs: [workspace-tests]
|
||||||
|
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c tests/fuzz/run.sh 120
|
||||||
|
- id: vm-apply-reverts
|
||||||
|
nix: .#checks.x86_64-linux.vm-apply-reverts
|
||||||
|
- id: vm-engine-switch
|
||||||
|
nix: .#checks.x86_64-linux.vm-engine-switch
|
||||||
|
- id: vm-intermediate-renewal
|
||||||
|
nix: .#checks.x86_64-linux.vm-intermediate-renewal
|
||||||
|
- id: vm-control-loopback
|
||||||
|
nix: .#checks.x86_64-linux.vm-control-loopback
|
||||||
|
- id: vm-sockets
|
||||||
|
nix: .#checks.x86_64-linux.vm-sockets
|
||||||
|
- id: load
|
||||||
|
needs: [conformance, fuzz]
|
||||||
|
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c scripts/bench.sh fabrica-runner
|
||||||
|
artifacts: ["bench/results/**"]
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
# Ianitor Domi: the Gitea release of a v* tag (docs/release.md, docs/fabrica.md). Ianitor ships no binary (the server
|
||||||
|
# builds it with Nix and the deploy pipeline switches it in), so a release is the source archive of the tag, its notes,
|
||||||
|
# the screenshots of the web UI, the Aula page and the Nix pin, all under a SHA256SUMS signed by domi-release through
|
||||||
|
# Custos; release-notes.md is also the release's text on Gitea.
|
||||||
|
# The Windows runner (the Fabrica app on Mark's PC) runs it: `fabrica`, node and pnpm are on every step's PATH.
|
||||||
|
# No Gitea webhook to the hub yet: a pushed tag is started on demand (the hub's POST /api/runs, ref v<version>).
|
||||||
|
# The web UI's e2e suite (apps/web/playwright.config.ts) runs the main flows and takes the pictures in the installed
|
||||||
|
# Edge against the demo control plane with invented data, at a fixed instant; `fabrica aula shots` checks and copies
|
||||||
|
# them (.fabrica/aula.yaml, `file:` shots) and `fabrica aula page` builds the landing page from them and the brief.
|
||||||
|
# Playwright's ffmpeg (the flows' videos) is in PLAYWRIGHT_BROWSERS_PATH, set here so the step does not depend on the
|
||||||
|
# runner's environment: F:\ms-playwright on Mark's PC, never C:. Nothing is downloaded during a release; a runner
|
||||||
|
# without it fails the e2e step with Playwright's "Executable doesn't exist" naming the path.
|
||||||
|
# `pin` publishes the Nix build's NAR hashes (.fabrica/nix/pin.json, written by scripts/nix-pin.sh on Linux at a
|
||||||
|
# clean commit and committed before the tag) as ianitor-nix.json, and refuses a pin made from other code than the
|
||||||
|
# tag's (its recorded source tree must be the tag's); that check is the gate, since pipelines cannot depend on one
|
||||||
|
# another. The `verify-nix` pipeline rebuilds the tag on the NixOS runner and compares (docs/verify.md).
|
||||||
|
name: release
|
||||||
|
on:
|
||||||
|
tag: "v*"
|
||||||
|
manual: true
|
||||||
|
runner: windows
|
||||||
|
env:
|
||||||
|
PLAYWRIGHT_BROWSERS_PATH: 'F:\ms-playwright'
|
||||||
|
steps:
|
||||||
|
- id: version
|
||||||
|
run: node scripts/check-version.mjs ${{ version }}
|
||||||
|
- id: install
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
- id: check
|
||||||
|
needs: [install]
|
||||||
|
run: pnpm --filter web check
|
||||||
|
- id: test
|
||||||
|
needs: [install]
|
||||||
|
run: pnpm --filter web test
|
||||||
|
- id: e2e
|
||||||
|
needs: [check, test]
|
||||||
|
run: pnpm --filter web test:e2e
|
||||||
|
- id: pictures
|
||||||
|
needs: [e2e]
|
||||||
|
run: pnpm --filter web aula:shots
|
||||||
|
- id: source
|
||||||
|
needs: [version]
|
||||||
|
run: node scripts/pack-source.mjs ${{ version }}
|
||||||
|
artifacts: ["target/release/ianitor-*-src.tar.gz"]
|
||||||
|
- id: notes
|
||||||
|
run: fabrica notes
|
||||||
|
artifacts: ["target/notes/release-notes.md", "target/notes/release-notes.json"]
|
||||||
|
- id: shots
|
||||||
|
needs: [pictures]
|
||||||
|
run: fabrica aula shots
|
||||||
|
artifacts: ["target/aula/aula-*.png", "target/aula/aula.json"]
|
||||||
|
- id: page
|
||||||
|
needs: [notes, shots]
|
||||||
|
run: fabrica aula page
|
||||||
|
artifacts: ["target/aula/aula-page.json", "target/aula/aula-page.html"]
|
||||||
|
- id: pin-test
|
||||||
|
run: node --test scripts/release-pin.test.mjs
|
||||||
|
- id: pin
|
||||||
|
needs: [version, pin-test]
|
||||||
|
run: node scripts/release-pin.mjs ${{ version }} ${{ tag }} ${{ commit }}
|
||||||
|
artifacts: ["target/nix/ianitor-nix.json"]
|
||||||
|
- id: approve
|
||||||
|
needs: [source, page, pin]
|
||||||
|
approve: "Publish Ianitor ${{ tag }}: its source, notes, screenshots and Nix pin?"
|
||||||
|
- id: publish
|
||||||
|
needs: [approve]
|
||||||
|
publish:
|
||||||
|
gitea-release: true
|
||||||
|
files:
|
||||||
|
- "**/ianitor-*-src.tar.gz"
|
||||||
|
- "**/release-notes.md"
|
||||||
|
- "**/release-notes.json"
|
||||||
|
- "**/aula-*.png"
|
||||||
|
- "**/aula.json"
|
||||||
|
- "**/aula-page.json"
|
||||||
|
- "**/ianitor-nix.json"
|
||||||
|
sums: domi-release
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Ianitor Domi: the verifiable build (docs/verify.md). On a v* tag the NixOS runner builds .#ianitor and
|
||||||
|
# .#ianitor-web from the tag (the run record keeps each output's store path and NAR hash), rebuilds each output
|
||||||
|
# derivation once more, and compares with the pin the release publishes (.fabrica/nix/pin.json at the tag: the
|
||||||
|
# source tree, nixpkgs and every hash); any difference fails the run. Runner: label `nixos`, Nix with flakes,
|
||||||
|
# node and jq from the `ci` shell; no KVM needed.
|
||||||
|
name: verify-nix
|
||||||
|
on:
|
||||||
|
tag: "v*"
|
||||||
|
manual: true
|
||||||
|
runner: nixos
|
||||||
|
steps:
|
||||||
|
- id: ianitor
|
||||||
|
nix: .#ianitor
|
||||||
|
- id: web
|
||||||
|
nix: .#ianitor-web
|
||||||
|
- id: pin
|
||||||
|
needs: [ianitor, web]
|
||||||
|
run: nix --extra-experimental-features "nix-command flakes" develop .#ci -c scripts/nix-pin.sh --check
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
# Ianitor Domi's Aula page (docs/fabrica.md part 2, part 5; Fabrica docs/09_aula_pages.md, docs/19_web_shots.md).
|
||||||
|
# Every picture is taken by the web UI's own e2e suite (`pnpm --filter web aula:shots`, apps/web/e2e/specs/aula.spec.ts):
|
||||||
|
# the built UI in Edge against the demo control plane (apps/web/tests/demo.ts: hostnames under .test, addresses in the
|
||||||
|
# documentation ranges, people ada and felix), 1440 x 900, at a fixed instant in Europe/Prague. `fabrica aula shots`
|
||||||
|
# checks each file and publishes it as aula-<name>.png with aula.json; it starts no browser of its own.
|
||||||
|
shots:
|
||||||
|
- name: hosts
|
||||||
|
title: Every host, its health and where it sends traffic
|
||||||
|
section: Hosts
|
||||||
|
file: target/e2e/aula/hosts.png
|
||||||
|
- name: host
|
||||||
|
title: Editing a host
|
||||||
|
section: Hosts
|
||||||
|
file: target/e2e/aula/host.png
|
||||||
|
- name: engine
|
||||||
|
title: Pingora serving, Caddy ready as the fallback
|
||||||
|
section: Engines
|
||||||
|
file: target/e2e/aula/engine.png
|
||||||
|
- name: history
|
||||||
|
title: "History: going back to a kept version"
|
||||||
|
section: Changes
|
||||||
|
file: target/e2e/aula/history.png
|
||||||
|
- name: certificates
|
||||||
|
title: The Domi CA and the device certificates
|
||||||
|
section: Certificates
|
||||||
|
file: target/e2e/aula/certificates.png
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
A reverse proxy for a home server where every change is tried, watched and undone if it fails.
|
||||||
|
|
||||||
|
Each host says in plain words where its traffic goes, which certificate it uses and whether visitors sign in first. A change is checked, tried and watched for a minute, and goes back on its own if a host stops answering. Pingora serves, Caddy stands by built from the same routes, and a small Domi certificate authority issues the certificates for home-only hosts and devices.
|
||||||
|
|
||||||
|
- hosts: Every host with its health, its certificate and where it sends traffic.
|
||||||
|
- host: A host in plain words: upstreams, certificate, sign-in and health check.
|
||||||
|
- engine: Pingora serving, with Caddy built from the same routes and compared host by host.
|
||||||
|
- history: Every kept version in history, and exactly what restoring one would change.
|
||||||
|
- certificates: The Domi intermediate and the device certificates for phones, laptops and apps.
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
The first release of Ianitor Domi: a reverse proxy for a home server, built on Cloudflare's Pingora, with Caddy as a
|
||||||
|
tested fallback, a small Domi certificate authority, and a web UI where every change takes three clicks or fewer.
|
||||||
|
|
||||||
|
- **Hosts in plain words.** Add a host, say where its traffic goes, pick a Domi or Let's Encrypt certificate and
|
||||||
|
whether visitors sign in first (Authelia forward-auth). Each host is checked for health and shows healthy,
|
||||||
|
degraded or down.
|
||||||
|
- **Changes that undo themselves.** Every change is compiled, tried, and watched for 60 seconds; if a host stops
|
||||||
|
answering, it is reverted on its own. Routes live in a git repository, one file per host, with Undo and a
|
||||||
|
history you can restore any kept version from.
|
||||||
|
- **Two engines.** Pingora serves; Caddy is built from the same routes, compared host by host, and can take over at
|
||||||
|
runtime in about two seconds.
|
||||||
|
- **The Domi CA.** Certificates for hosts reached only from home, and device certificates (mTLS) for phones,
|
||||||
|
computers and Domi apps, from an intermediate whose root stays offline.
|
||||||
|
- **Share links**, signed and time-limited, for a single host.
|
||||||
|
- **NixOS-native.** A flake with the module and VM tests; deployed through Fabrica.
|
||||||
|
|
||||||
|
The changes below are the merges since the first commit; PR 3 to 5 are the control plane (phase 2), the decisions
|
||||||
|
on the open points, and the web UI, the Domi CA and the NixOS module (phase 3).
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Ianitor 0.2.0 gives Ianitor its own page on Aula.
|
||||||
|
|
||||||
|
- **The Domi CA from the shared crate domi-pki.** Ianitor's certificate authority is now the shared crate domi-pki
|
||||||
|
1.0.0, which Fabrica also uses. It keeps the same certificates, messages and key format.
|
||||||
|
- **A page on Aula** with a short description, five captioned screenshots, these notes, and the source of the version
|
||||||
|
as its download. All of them are under a `SHA256SUMS` signed by domi-release.
|
||||||
|
- **Screenshots and videos from the tests.** The web UI's flows run in a real browser against an invented home
|
||||||
|
server at a fixed time: add a host, undo, restore, share a link, switch the engine and issue a device certificate.
|
||||||
|
Each flow is recorded. The same run takes the screenshots, so they are the same in every release.
|
||||||
|
- **Tested in Fabrica.** The flows are Fabrica's `web` test target and its `e2e` pipeline.
|
||||||
|
|
||||||
|
Updates stay a deploy. Fabrica's Deploy moves the server to the new commit and switches back if the health check
|
||||||
|
does not answer.
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
id: j4yav1
|
||||||
|
title: Turn on the visual gate against v0.2.0
|
||||||
|
status: todo
|
||||||
|
priority: normal
|
||||||
|
labels: [fabrica, release]
|
||||||
|
created: 2026-11-19T01:25:43+01:00
|
||||||
|
updated: 2026-11-19T01:25:43+01:00
|
||||||
|
doc: docs/fabrica.md
|
||||||
|
---
|
||||||
|
Add Fabrica's visual step (docs/28_visual.md part 6) to .fabrica/artifex/release.yaml after shots: fabrica visual compare --shots target/aula --out target/visual --before ${{ tag }} --forge https://gitea.marek-novak.cz/mnovak/ianitor, custos: [gitea-token], and approve needs visual. Waits one release because v0.1.0's shots were taken at a moving clock, so every shot would differ (docs/fabrica.md part 5).
|
||||||
|
|
||||||
|
## Log
|
||||||
|
|
||||||
|
- 2026-11-19T01:25:43+01:00 mnovak: created
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
id: jd3x1h
|
||||||
|
title: Publish the showcase videos on Aula
|
||||||
|
status: todo
|
||||||
|
priority: normal
|
||||||
|
labels: [fabrica, aula]
|
||||||
|
created: 2026-11-19T01:25:17+01:00
|
||||||
|
updated: 2026-11-19T01:25:17+01:00
|
||||||
|
doc: docs/fabrica.md
|
||||||
|
---
|
||||||
|
The e2e suite records each main flow as target/e2e/videos/<flow>.webm (docs/fabrica.md part 5). Once Fabrica's docs/37 (aula.yaml `videos:`) is on Fabrica main, list them in .fabrica/aula.yaml, add **/aula-*.webm to the release's publish files and to Aula's entry if needed, and check the limits (WebM, at most 8 MiB and 60 s each, at most 6).
|
||||||
|
|
||||||
|
## Log
|
||||||
|
|
||||||
|
- 2026-11-19T01:25:17+01:00 mnovak: created
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# Ianitor Domi's Playwright tests (docs/fabrica.md part 6; Fabrica docs/20_tests.md): the web UI's main flows on the
|
||||||
|
# built UI and the demo control plane (apps/web/playwright.config.ts, project `web`), each recorded as a video.
|
||||||
|
# `fabrica tests run`, or Tests in the Fabrica app; the e2e pipeline (.fabrica/artifex/e2e.yaml) runs the same target
|
||||||
|
# on the e2e runner. No android target: Ianitor has no Android build. The Rust suites run in WSL2 and the Nix build.
|
||||||
|
dir: apps/web
|
||||||
|
gate: [web]
|
||||||
|
targets:
|
||||||
|
- name: web
|
||||||
|
kind: web
|
||||||
|
title: The web UI's main flows
|
||||||
|
project: web
|
||||||
@@ -65,8 +65,11 @@ expect_staged() {
|
|||||||
|
|
||||||
B='-----BEGIN'
|
B='-----BEGIN'
|
||||||
E='-----END'
|
E='-----END'
|
||||||
mkdir -p "$WORK/../ianitor-hook-src.$$" && SRC="$WORK/../ianitor-hook-src.$$"
|
# An absolute path next to $WORK (not "$WORK/..", which no longer resolves once $WORK is gone),
|
||||||
trap 'rm -rf "$WORK" "$SRC"' EXIT INT TERM
|
# removed first.
|
||||||
|
SRC="$(dirname "$WORK")/ianitor-hook-src.$$"
|
||||||
|
mkdir -p "$SRC" || exit 2
|
||||||
|
trap 'rm -rf "$SRC" "$WORK"' EXIT INT TERM
|
||||||
printf '%s RSA PRIVATE KEY-----\nMIIBOgIBAAJBAK\n%s RSA PRIVATE KEY-----\n' "$B" "$E" > "$SRC/pem"
|
printf '%s RSA PRIVATE KEY-----\nMIIBOgIBAAJBAK\n%s RSA PRIVATE KEY-----\n' "$B" "$E" > "$SRC/pem"
|
||||||
head -c 6291456 /dev/zero | tr '\000' 'a' > "$SRC/six-mb"
|
head -c 6291456 /dev/zero | tr '\000' 'a' > "$SRC/six-mb"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Ianitor Domi
|
||||||
|
|
||||||
|
*Ianitor* (Latin: the doorkeeper) is the reverse proxy of a home server. It decides which name goes to which
|
||||||
|
service, with which certificate, and who has to sign in first. Every change is tried before it stays.
|
||||||
|
|
||||||
|
- **Hosts in plain words.** Add a host, say where its traffic goes, and pick a Domi or Let's Encrypt certificate.
|
||||||
|
Choose whether visitors sign in first (Authelia forward-auth). Each host is checked for health and shows as
|
||||||
|
healthy, degraded or down.
|
||||||
|
- **Changes that undo themselves.** Every change is compiled, tried, and watched for 60 seconds. If a host stops
|
||||||
|
answering, the change is reverted on its own. Routes live in a git repository, one file per host, with Undo and a
|
||||||
|
history you can restore any kept version from.
|
||||||
|
- **Two engines.** Cloudflare's Pingora serves. Caddy is built from the same routes, compared with Pingora host by
|
||||||
|
host, and can take over at runtime in about two seconds.
|
||||||
|
- **The Domi certificate authority.** It issues certificates for hosts reached only from home, and device
|
||||||
|
certificates (mTLS) for phones, computers and Domi apps. They come from an intermediate whose root stays offline.
|
||||||
|
- **Share links**, signed and time-limited, for a single host.
|
||||||
|
- **Every action in three clicks or fewer**, in a dark web UI that only the signed-in owner reaches.
|
||||||
|
|
||||||
|
## For whom
|
||||||
|
|
||||||
|
For someone who runs services at home (a wiki, photos, music, cameras) and wants each one to have a name, a
|
||||||
|
certificate and a sign-in, without editing a proxy's config by hand and without a change that breaks the house.
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
Ianitor runs on NixOS. There is nothing to download and run: the server builds it from source with Nix.
|
||||||
|
|
||||||
|
1. Add the flake `git+https://gitea.marek-novak.cz/mnovak/Ianitor.git` as an input of the server's flake, and
|
||||||
|
import its module `nixosModules.ianitor`.
|
||||||
|
2. Set `services.ianitor`: `enable`, the edge's listen addresses, the routes repository, the share-link key file
|
||||||
|
and, for the Domi CA, `pki`. Keys and passwords come from files the system provides (sops, systemd
|
||||||
|
credentials), never from the Nix store. Then rebuild.
|
||||||
|
3. Open the UI's name in a browser and sign in through Authelia.
|
||||||
|
|
||||||
|
Ianitor can run beside an existing Caddy first, taking over one host at a time. Updates are a deploy: the server's
|
||||||
|
flake input moves to the new commit and the system switches, and switches back if the health check does not answer.
|
||||||
|
|
||||||
|
## System requirements
|
||||||
|
|
||||||
|
- NixOS on x86_64 Linux, with ports 80 and 443 for the edge.
|
||||||
|
- Authelia for sign-in to the UI and to the hosts that ask for it.
|
||||||
|
- A git server for the routes repository (any that takes a push over HTTPS).
|
||||||
|
|
||||||
|
## The files on this page
|
||||||
|
|
||||||
|
`ianitor-<version>-src.tar.gz` is the source of this version: every file in the repository at its tag. The
|
||||||
|
server's Nix build is made from the same tree. It is listed in `SHA256SUMS`, which verifies with domi-release.
|
||||||
|
The screenshots show invented hosts on an invented home server.
|
||||||
@@ -4,26 +4,40 @@ Ianitor is a reverse proxy built on Cloudflare's Pingora, with a small Domi CA,
|
|||||||
NixOS-native, with Caddy as a tested fallback. MPL-2.0. Plan, decisions and status: docs/ROADMAP.md — read it first.
|
NixOS-native, with Caddy as a tested fallback. MPL-2.0. Plan, decisions and status: docs/ROADMAP.md — read it first.
|
||||||
|
|
||||||
## Layout
|
## Layout
|
||||||
crates/core config model, schema, compilers (Pingora runtime + Caddy JSON), CA. Pure: no I/O, no network.
|
crates/core config model, schema, compilers (Pingora runtime + Caddy JSON), CA (Ianitor's view of the shared
|
||||||
|
crate domi-pki, pinned by tag). Pure: no I/O, no network.
|
||||||
crates/edge Pingora data plane. Reads compiled config, serves traffic. Never decides policy.
|
crates/edge Pingora data plane. Reads compiled config, serves traffic. Never decides policy.
|
||||||
crates/control API, git routes repo, apply/rollback, share links, PKI flows. Loopback only. Never serves public traffic.
|
crates/control API, git routes repo, apply/rollback, share links, PKI flows. Loopback only. Never serves public traffic.
|
||||||
apps/web Svelte 5 (runes, TypeScript strict). A client of the API; no logic.
|
apps/web Svelte 5 (runes, TypeScript strict). A client of the API; no logic.
|
||||||
packages/ui shared dark Domi theme.
|
packages/ui shared dark Domi theme, murex palette.
|
||||||
tests/diff same requests against Ianitor and Caddy, responses compared.
|
tests/diff same requests against Ianitor and Caddy, responses compared.
|
||||||
tests/support shared test fixtures (test CA, upstreams, mock Authelia, clients); test-only.
|
tests/support shared test fixtures (test CA, upstreams, mock Authelia, clients); test-only.
|
||||||
tests/fuzz cargo-fuzz targets.
|
tests/fuzz cargo-fuzz targets.
|
||||||
deploy/nixos NixOS module + VM tests.
|
deploy/nixos NixOS module + VM tests.
|
||||||
|
scripts version check, release pin, test layers 2 and 5 (conformance, bench), the Nix pin. Releases: docs/release.md.
|
||||||
|
bench layer 5 results as data (CSV/JSON), layer 2 outputs.
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
cargo test --workspace # quote test counts per crate; an exit code alone is not green
|
cargo test --workspace # quote test counts per crate; an exit code alone is not green
|
||||||
cargo run -p ianitor-control -- --dev
|
cargo run -p ianitor-control -- --dev
|
||||||
pnpm --filter web dev # 127.0.0.1 only, never --host
|
pnpm --filter web dev # 127.0.0.1 only, never --host
|
||||||
|
pnpm --filter web test:e2e # the web UI's flows in Edge on demo data, recorded -> target/e2e/videos (docs/fabrica.md)
|
||||||
|
pnpm --filter web aula:shots # the Aula screenshots from the same suite -> target/e2e/aula; then `fabrica aula shots`
|
||||||
|
node scripts/check-version.mjs X.Y.Z # Cargo.toml and both package.json carry the version
|
||||||
|
scripts/conformance.sh # layer 2: h2spec + testssl.sh, Ianitor vs Caddy (nix develop .#ci)
|
||||||
|
tests/fuzz/run.sh 60 # layer 3: cargo-fuzz, 60 s a target; crashes become regressions
|
||||||
|
scripts/bench.sh <label> # layer 5: load and soak vs Caddy -> bench/results
|
||||||
|
scripts/nix-pin.sh # rebuild check of the outputs; writes .fabrica/nix/pin.json before a tag
|
||||||
|
node --test scripts/release-pin.test.mjs # the release's pin gate (a pin must be of the tagged code)
|
||||||
nix build .#ianitor
|
nix build .#ianitor
|
||||||
nix flake check # includes NixOS VM tests (Linux + KVM)
|
nix flake check # includes NixOS VM tests (Linux + KVM)
|
||||||
|
|
||||||
On Windows, build and test in WSL2 Debian (ROADMAP §8.3: Pingora's Windows support is best effort; edge, diff and
|
On Windows, build and test in WSL2 Ubuntu (distro `Ubuntu`, 26.04, root; ROADMAP §8.3: Pingora's Windows support is
|
||||||
ACME tests are Linux-only). Use a Linux target dir, and put caddy, pebble and pebble-challtestsrv on PATH (`nix profile add nixpkgs#caddy nixpkgs#pebble`):
|
best effort; edge, diff and ACME tests are Linux-only). Rust from rustup in $HOME (stable; nightly for cargo-fuzz), a
|
||||||
wsl -d Debian -- bash -lc 'cd /mnt/f/Akce/Ianitor && CARGO_TARGET_DIR=$HOME/ianitor-target cargo test --workspace'
|
Linux target dir, and caddy, pebble and pebble-challtestsrv on PATH: with Nix, `nix profile add nixpkgs#caddy
|
||||||
|
nixpkgs#pebble`; without it (as now), `apt install pebble testssl.sh golang-go` and
|
||||||
|
`go install github.com/caddyserver/caddy/v2/cmd/caddy@v2.11.7` (apt's Caddy 2.6 is too old for the diff suite):
|
||||||
|
wsl -d Ubuntu -- bash -lc 'cd /mnt/f/Akce/Ianitor && PATH=$HOME/.cargo/bin:$HOME/go/bin:$PATH CARGO_TARGET_DIR=$HOME/ianitor-target cargo test --workspace'
|
||||||
One-time per clone: git config core.hooksPath .githooks (self-test: bash .githooks/test-pre-commit.sh)
|
One-time per clone: git config core.hooksPath .githooks (self-test: bash .githooks/test-pre-commit.sh)
|
||||||
|
|
||||||
## Rules
|
## Rules
|
||||||
@@ -31,13 +45,17 @@ One-time per clone: git config core.hooksPath .githooks (self-test: bash .gith
|
|||||||
- Never in git: target/, node_modules/, dist/, binaries, private keys, files over 5 MB. A pre-commit hook enforces it.
|
- Never in git: target/, node_modules/, dist/, binaries, private keys, files over 5 MB. A pre-commit hook enforces it.
|
||||||
- $GITEA_TOKEN never echoed or written anywhere. Secrets come only from Custos or systemd credentials, never the Nix store.
|
- $GITEA_TOKEN never echoed or written anywhere. Secrets come only from Custos or systemd credentials, never the Nix store.
|
||||||
- ianitor-control and every dev server listen on 127.0.0.1 only; only ianitor-edge binds public ports.
|
- ianitor-control and every dev server listen on 127.0.0.1 only; only ianitor-edge binds public ports.
|
||||||
|
- Disks (Mark's machine): never write, move or delete anything on C:, and nothing on D: either. Everything goes on F:
|
||||||
|
(build output, clones, caches, temp files, tools, WSL swap), under F:\C-Drive-Migration when it replaces a C: path.
|
||||||
|
The only file kept on C: is C:\Users\chode\.wslconfig (WSL reads it only there; it points swap to F:). Every agent's
|
||||||
|
brief repeats this rule.
|
||||||
- Route files, API bodies, CSRs, headers and share tokens are hostile input: typed Result, no unwrap() on input paths, no swallowed errors.
|
- Route files, API bodies, CSRs, headers and share tokens are hostile input: typed Result, no unwrap() on input paths, no swallowed errors.
|
||||||
- Every route change goes through the core compiler and the differential tests.
|
- Every route change goes through the core compiler and the differential tests.
|
||||||
- Tests first only where the risk is: parsing, CA, share tokens, forward-auth, apply/rollback, secret injection.
|
- Tests first only where the risk is: parsing, CA, share tokens, forward-auth, apply/rollback, secret injection.
|
||||||
- Workflow: branch → Gitea PR via API → short adversarial self-review in the PR body → merge --no-ff → push → verify hashes.
|
- Workflow: branch → Gitea PR via API → short adversarial self-review in the PR body → merge --no-ff → push → verify hashes.
|
||||||
- Server changes: prepare the Nix change and show the command; Mark runs nixos-rebuild himself. deploy/test-access.sh must pass.
|
- Server changes: prepare the Nix change and show the command; Mark runs nixos-rebuild himself. deploy/test-access.sh must pass.
|
||||||
- When reporting done, say which build is deployed and whether it changed visibly.
|
- When reporting done, say which build is deployed and whether it changed visibly.
|
||||||
- UI: dark Domi theme, every action ≤ 3 clicks, plain English; Latin only in the brand name.
|
- UI: dark Domi theme, murex palette; every action ≤ 3 clicks, plain English; Latin only in the brand name.
|
||||||
|
|
||||||
## Session end
|
## Session end
|
||||||
Update the Status table and the Handover section at the bottom of docs/ROADMAP.md. No separate handover file.
|
Update the Status table and the Handover section at the bottom of docs/ROADMAP.md. No separate handover file.
|
||||||
|
|||||||
Generated
+695
-11
File diff suppressed because it is too large
Load Diff
+16
-3
@@ -1,11 +1,20 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
resolver = "3"
|
resolver = "3"
|
||||||
members = ["crates/core", "crates/edge", "crates/control", "tests/diff", "tests/support"]
|
members = [
|
||||||
|
"crates/core",
|
||||||
|
"crates/edge",
|
||||||
|
"crates/control",
|
||||||
|
"tests/diff",
|
||||||
|
"tests/fuzz",
|
||||||
|
"tests/support",
|
||||||
|
]
|
||||||
|
# cargo-fuzz's own workspace (libFuzzer flags): tests/fuzz/fuzz.
|
||||||
|
exclude = ["tests/fuzz/fuzz"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.88"
|
rust-version = "1.89"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
@@ -13,11 +22,15 @@ publish = false
|
|||||||
ianitor-core = { path = "crates/core" }
|
ianitor-core = { path = "crates/core" }
|
||||||
ianitor-edge = { path = "crates/edge" }
|
ianitor-edge = { path = "crates/edge" }
|
||||||
ianitor-testkit = { path = "tests/support" }
|
ianitor-testkit = { path = "tests/support" }
|
||||||
|
# The Domi CA, shared with Fabrica (docs/32_coherence.md T3a); pinned by tag.
|
||||||
|
domi-pki = { git = "https://gitea.marek-novak.cz/mnovak/domi-pki", tag = "v1.0.0" }
|
||||||
serde = { version = "1.0.228", features = ["derive"] }
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
serde_json = "1.0.145"
|
serde_json = "1.0.145"
|
||||||
toml = "1.2.1"
|
toml = "1.2.1"
|
||||||
thiserror = "2.0.17"
|
thiserror = "2.0.17"
|
||||||
url = "2.5.7"
|
url = "2.5.7"
|
||||||
|
ring = "0.17.14"
|
||||||
|
base64 = "0.22.1"
|
||||||
tokio = { version = "1.48", features = ["full"] }
|
tokio = { version = "1.48", features = ["full"] }
|
||||||
bytes = "1.10"
|
bytes = "1.10"
|
||||||
http = "1.3"
|
http = "1.3"
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
# Ianitor Domi
|
||||||
|
|
||||||
|
[](docs/verify.md)
|
||||||
|
|
||||||
|
*Ianitor* is Latin for the doorkeeper: it decides who comes through the door (routing, TLS) and checks
|
||||||
|
credentials (certificates). Ianitor Domi is a reverse proxy for a home server, built on Cloudflare's
|
||||||
|
[Pingora](https://github.com/cloudflare/pingora), with a small certificate authority for your own devices, a web
|
||||||
|
UI, an API, and a NixOS module. MPL-2.0.
|
||||||
|
|
||||||
|
- **Routes in git.** One TOML file per host in a repository (`hosts/wiki.example.toml`), schema-checked. Every
|
||||||
|
change is a commit, applied live without `nixos-rebuild`, watched for 60 seconds, and reverted by itself if the
|
||||||
|
host stops answering. Undo is one click; any older state can be restored.
|
||||||
|
- **Two processes.** `ianitor-edge` serves traffic and decides nothing; `ianitor-control` (API and UI, loopback
|
||||||
|
and Unix sockets only) edits the routes and tells edge what to serve. Traffic keeps flowing when control stops.
|
||||||
|
- **TLS your way.** Let's Encrypt for public names; for everything internal, the Domi CA: the root stays offline,
|
||||||
|
the intermediate on the server is renewed yearly, device certificates enable mTLS for a host.
|
||||||
|
- **What a home server needs, and no more.** Forward-auth to Authelia (existing protected services keep working),
|
||||||
|
header rules whose values can be systemd credentials (never written anywhere), websockets, health checks,
|
||||||
|
share links (an expiring, optionally password-protected link to one path), a truncated, opt-in visit log.
|
||||||
|
- **Caddy as the fallback.** The same route model compiles to Caddy JSON too, and one click switches engines at
|
||||||
|
runtime. Differential tests send the same requests to both on every build, so the fallback stays honest.
|
||||||
|
|
||||||
|
It is one person's project for one home network, published because the approach may be useful to others. It is
|
||||||
|
not a general-purpose proxy: no HTTP/3, no load-balancing policies beyond round robin over healthy upstreams, no
|
||||||
|
plugin system. Status, decisions and what is not done: [docs/ROADMAP.md](docs/ROADMAP.md).
|
||||||
|
|
||||||
|
## Why Pingora
|
||||||
|
|
||||||
|
Pingora is a library, not a server: Ianitor owns the request path (host lookup, forward-auth, share links,
|
||||||
|
header rules, upstream choice) in plain Rust, and gets HTTP/1, HTTP/2, websockets, TLS (rustls) and connection
|
||||||
|
pooling from code that serves a large share of the web at Cloudflare. A memory-safe data plane with no config
|
||||||
|
language between the routes and the code was the point; speed was not, and the numbers below say so.
|
||||||
|
|
||||||
|
Caddy is excellent, and Ianitor keeps it as the fallback engine. What Ianitor adds on top is the workflow: routes
|
||||||
|
as reviewed commits with automatic rollback, a CA for the house, and a UI where every common action takes at most
|
||||||
|
three clicks.
|
||||||
|
|
||||||
|
## Benchmarks (honest ones)
|
||||||
|
|
||||||
|
Load and soak runs against Caddy 2 on the same machine, the same route and the same upstream
|
||||||
|
(`scripts/bench.sh`, ROADMAP §5 layer 5). Results are committed as data in [bench/](bench/), with the machine
|
||||||
|
described beside them; [bench/README.md](bench/README.md) summarises them, including where Caddy wins. Two caveats
|
||||||
|
apply to every number there: the load generator, the proxies and the upstream share one machine, and edge runs
|
||||||
|
Pingora with two worker threads (a home server's budget), so Caddy is also measured with `GOMAXPROCS=2`.
|
||||||
|
|
||||||
|
## Install (NixOS)
|
||||||
|
|
||||||
|
```nix
|
||||||
|
# flake.nix
|
||||||
|
inputs.ianitor.url = "git+https://gitea.marek-novak.cz/mnovak/Ianitor.git";
|
||||||
|
# configuration
|
||||||
|
imports = [ inputs.ianitor.nixosModules.ianitor ];
|
||||||
|
services.ianitor = {
|
||||||
|
enable = true;
|
||||||
|
edge.openFirewall = true;
|
||||||
|
shareLinkKeyFile = "/run/secrets/ianitor-share-link-key"; # never a store path; the module refuses one
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
Then `ianitor-control token create --name laptop --config /etc/ianitor/control.toml` for the API, or the web UI
|
||||||
|
behind Authelia ([docs/api.md](docs/api.md), "Sign-in"). Beside an existing Caddy, edge can sit behind it on a Unix
|
||||||
|
socket: [docs/deploy/beside-caddy.md](docs/deploy/beside-caddy.md). The CA: [docs/pki.md](docs/pki.md).
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
Five layers (ROADMAP §5), all in the `layers` pipeline (`.fabrica/artifex/layers.yaml`):
|
||||||
|
|
||||||
|
| Layer | What | Run it |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| 1 Differential | the same request corpus against Ianitor and Caddy, answers compared | `cargo test -p ianitor-diff` |
|
||||||
|
| 2 Conformance | h2spec and testssl.sh against both engines | `scripts/conformance.sh` |
|
||||||
|
| 3 Fuzzing | route files, header rules, share tokens, share-link paths, the CA's PEM and CSR parsing | `tests/fuzz/run.sh` |
|
||||||
|
| 4 NixOS VM tests | rollback, engine switch, CA renewal, loopback-only control, the sockets | `nix flake check` (KVM) |
|
||||||
|
| 5 Load and soak | against Caddy, results kept as data | `scripts/bench.sh` |
|
||||||
|
|
||||||
|
`cargo test --workspace` runs the unit, integration and layer 1 tests; most of them need Linux (Pingora's Windows
|
||||||
|
support is best effort), Caddy and Pebble on PATH: `nix develop .#ci`.
|
||||||
|
|
||||||
|
## Releases and verification
|
||||||
|
|
||||||
|
A release is a signed manifest, not a binary: `SHA256SUMS` signed by `domi-release` (through Custos) over the
|
||||||
|
release notes, screenshots of the UI and `ianitor-nix.json`, the NAR hashes of the Nix build at the tagged commit.
|
||||||
|
Anyone can rebuild the tagged commit and compare the hashes: [docs/verify.md](docs/verify.md). What is checked
|
||||||
|
so far is narrower than "reproducible": the output derivations are rebuilt once and compared, with dependencies
|
||||||
|
from the binary cache, and that has not run yet; the first pin needs a machine with Nix.
|
||||||
|
|
||||||
|
## Support
|
||||||
|
|
||||||
|
The source is free. If Ianitor is useful to you, you can **adopt a red panda**: support the project, and a fifth of
|
||||||
|
everything it receives goes to the [Red Panda Network](https://redpandanetwork.org), remitted once a year with the
|
||||||
|
receipt published. How it works and where it stands: [docs/support.md](docs/support.md).
|
||||||
|
|
||||||
|
## Licence
|
||||||
|
|
||||||
|
[MPL-2.0](LICENSE). Pingora is Apache-2.0; Caddy, used only as a separate fallback process, Apache-2.0.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
/** The suite's instant: the demo's answers and the page's Date both read it (a Monday morning in Prague). */
|
||||||
|
export const CLOCK = "2026-11-16T09:30:00+01:00";
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// What every e2e test gets: the demo started over, the page's clock at the suite's instant, `open`
|
||||||
|
// for a page of the UI, and afterwards a check that nothing the page showed looks real
|
||||||
|
// (tests/demo.ts realLooking: names outside .test, addresses outside the documentation ranges).
|
||||||
|
// A test with a `video` annotation has its recording kept as target/e2e/videos/<name>.webm.
|
||||||
|
|
||||||
|
import { mkdirSync } from "node:fs";
|
||||||
|
import { join, resolve } from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { test as base, expect, type Page } from "@playwright/test";
|
||||||
|
import { realLooking } from "../tests/demo";
|
||||||
|
import { CLOCK } from "./clock";
|
||||||
|
|
||||||
|
export const REPO = resolve(fileURLToPath(new URL(".", import.meta.url)), "../../..");
|
||||||
|
export const TARGET = join(REPO, "target", "e2e");
|
||||||
|
|
||||||
|
function url(): string {
|
||||||
|
const u = process.env.IANITOR_E2E_URL;
|
||||||
|
if (!u) throw new Error("IANITOR_E2E_URL is not set: run the suite through playwright.config.ts (its global setup serves the demo)");
|
||||||
|
return u;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Every text, field value and link the page shows (the body: the head's links are the build's own files). */
|
||||||
|
async function shown(page: Page): Promise<string[]> {
|
||||||
|
return page.evaluate(() => {
|
||||||
|
const out: string[] = [];
|
||||||
|
const walk = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
|
||||||
|
for (let n = walk.nextNode(); n; n = walk.nextNode()) if (n.textContent?.trim()) out.push(n.textContent);
|
||||||
|
document.body.querySelectorAll<HTMLInputElement | HTMLTextAreaElement>("input, textarea").forEach((i) => out.push(i.value));
|
||||||
|
document.body.querySelectorAll("[href]").forEach((a) => out.push(a.getAttribute("href") ?? ""));
|
||||||
|
return out;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export const test = base.extend<{ open: (path: string) => Promise<void> }>({
|
||||||
|
open: async ({ page, request }, use) => {
|
||||||
|
const res = await request.post(`${url()}/__demo/reset`);
|
||||||
|
expect(res.status()).toBe(204);
|
||||||
|
await page.clock.setFixedTime(new Date(CLOCK));
|
||||||
|
await use(async (path: string) => {
|
||||||
|
await page.goto(url() + path);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
test.afterEach(async ({ page }, info) => {
|
||||||
|
const video = info.annotations.find((a) => a.type === "video")?.description;
|
||||||
|
if (!page.isClosed()) {
|
||||||
|
const seen = (await shown(page)).flatMap(realLooking);
|
||||||
|
expect(seen, "the page showed something that looks real").toEqual([]);
|
||||||
|
}
|
||||||
|
const rec = page.video();
|
||||||
|
if (video && rec && info.status === info.expectedStatus) {
|
||||||
|
await page.close();
|
||||||
|
const dir = join(TARGET, "videos");
|
||||||
|
mkdirSync(dir, { recursive: true });
|
||||||
|
await rec.saveAs(join(dir, `${video}.webm`));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export { expect };
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The e2e suite's server (Playwright's global setup): builds the web UI (Vite, production) into a
|
||||||
|
// fresh temporary folder and serves it on 127.0.0.1 at a free port, with /api/v1 answered by the
|
||||||
|
// demo control plane (tests/demo.ts) at the suite's fixed instant. Any other path falls back to
|
||||||
|
// index.html, as in production. POST /__demo/reset starts the demo over (each test starts from the
|
||||||
|
// same invented server). The address reaches the tests as IANITOR_E2E_URL. Nothing here listens on
|
||||||
|
// anything but loopback, and the temporary folder is removed when the run ends.
|
||||||
|
|
||||||
|
import { existsSync, mkdtempSync, readFileSync, rmSync, statSync } from "node:fs";
|
||||||
|
import { createServer, type IncomingMessage, type Server } from "node:http";
|
||||||
|
import { tmpdir } from "node:os";
|
||||||
|
import { extname, join, normalize, resolve, sep } from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { build } from "vite";
|
||||||
|
import { demoApi } from "../tests/demo";
|
||||||
|
import { clock } from "../tests/mockApi";
|
||||||
|
import { CLOCK } from "./clock";
|
||||||
|
|
||||||
|
const web = resolve(fileURLToPath(new URL(".", import.meta.url)), "..");
|
||||||
|
|
||||||
|
const TYPES: Record<string, string> = {
|
||||||
|
".html": "text/html; charset=utf-8",
|
||||||
|
".js": "text/javascript; charset=utf-8",
|
||||||
|
".css": "text/css; charset=utf-8",
|
||||||
|
".json": "application/json",
|
||||||
|
".svg": "image/svg+xml",
|
||||||
|
".png": "image/png",
|
||||||
|
".ico": "image/x-icon",
|
||||||
|
".woff": "font/woff",
|
||||||
|
".woff2": "font/woff2",
|
||||||
|
".txt": "text/plain; charset=utf-8",
|
||||||
|
};
|
||||||
|
|
||||||
|
function body(req: IncomingMessage): Promise<Record<string, unknown>> {
|
||||||
|
return new Promise((ok) => {
|
||||||
|
const chunks: Buffer[] = [];
|
||||||
|
req.on("data", (c: Buffer) => chunks.push(c));
|
||||||
|
req.on("end", () => {
|
||||||
|
try {
|
||||||
|
ok(chunks.length ? (JSON.parse(Buffer.concat(chunks).toString("utf8")) as Record<string, unknown>) : {});
|
||||||
|
} catch {
|
||||||
|
ok({});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function serve(dist: string): Promise<Server> {
|
||||||
|
const index = readFileSync(join(dist, "index.html"));
|
||||||
|
let api = demoApi();
|
||||||
|
const server = createServer((req, res) => {
|
||||||
|
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
||||||
|
if (url.pathname === "/__demo/reset" && req.method === "POST") {
|
||||||
|
api = demoApi();
|
||||||
|
res.writeHead(204).end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (url.pathname === "/api/v1" || url.pathname.startsWith("/api/v1/")) {
|
||||||
|
void body(req).then((b) => {
|
||||||
|
const a = api(req.method ?? "GET", url.pathname.slice("/api/v1".length) + url.search, b);
|
||||||
|
res.writeHead(a.status, { "Content-Type": "application/json", "Cache-Control": "no-store" });
|
||||||
|
res.end(a.text ?? undefined);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let path: string;
|
||||||
|
try {
|
||||||
|
path = decodeURIComponent(url.pathname);
|
||||||
|
} catch {
|
||||||
|
res.writeHead(400).end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const file = normalize(join(dist, path));
|
||||||
|
if (file.startsWith(dist + sep) && existsSync(file) && statSync(file).isFile()) {
|
||||||
|
res.writeHead(200, { "Content-Type": TYPES[extname(file)] ?? "application/octet-stream" });
|
||||||
|
res.end(readFileSync(file));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
res.writeHead(200, { "Content-Type": TYPES[".html"], "Cache-Control": "no-store" });
|
||||||
|
res.end(index);
|
||||||
|
});
|
||||||
|
return new Promise((ok, fail) => {
|
||||||
|
server.once("error", fail);
|
||||||
|
server.listen(0, "127.0.0.1", () => ok(server));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function setup(): Promise<() => Promise<void>> {
|
||||||
|
clock.fixed = Date.parse(CLOCK);
|
||||||
|
const tmp = mkdtempSync(join(tmpdir(), "ianitor-e2e-"));
|
||||||
|
const remove = () => rmSync(tmp, { recursive: true, force: true, maxRetries: 10, retryDelay: 200 });
|
||||||
|
let server: Server;
|
||||||
|
try {
|
||||||
|
const dist = join(tmp, "dist");
|
||||||
|
await build({ root: web, logLevel: "warn", build: { outDir: dist, emptyOutDir: true } });
|
||||||
|
server = await serve(dist);
|
||||||
|
} catch (e) {
|
||||||
|
remove();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
const addr = server.address();
|
||||||
|
if (!addr || typeof addr === "string") throw new Error("the demo server has no port");
|
||||||
|
process.env.IANITOR_E2E_URL = `http://127.0.0.1:${addr.port}`;
|
||||||
|
console.log(`e2e: the built UI and the demo control plane on ${process.env.IANITOR_E2E_URL}`);
|
||||||
|
return async () => {
|
||||||
|
server.closeAllConnections();
|
||||||
|
await new Promise<void>((r) => server.close(() => r()));
|
||||||
|
remove();
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The release's screenshots (docs/release.md): each shot of tests/demo.ts SHOTS, 1440 × 900 at
|
||||||
|
// scale 1, saved as target/e2e/aula/<name>.png. .fabrica/aula.yaml lists the same files, which
|
||||||
|
// `fabrica aula shots` checks and publishes as aula-<name>.png with aula.json.
|
||||||
|
|
||||||
|
import { mkdirSync } from "node:fs";
|
||||||
|
import { join } from "node:path";
|
||||||
|
import { SHOTS } from "../../tests/demo";
|
||||||
|
import { TARGET, expect, test } from "../fixtures";
|
||||||
|
|
||||||
|
const dir = join(TARGET, "aula");
|
||||||
|
|
||||||
|
for (const shot of SHOTS) {
|
||||||
|
test(`aula: ${shot.name}`, async ({ page, open }) => {
|
||||||
|
await open(shot.path);
|
||||||
|
for (const sel of shot.click ?? []) await page.locator(sel).first().click();
|
||||||
|
await expect(page.locator(shot.wait).first()).toBeAttached();
|
||||||
|
// Nothing still loading, the fonts in, two frames drawn and transitions over.
|
||||||
|
await expect(page.locator("[aria-busy=true]")).toHaveCount(0);
|
||||||
|
await page.evaluate(() => document.fonts.ready.then(() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)))));
|
||||||
|
await page.waitForTimeout(400);
|
||||||
|
mkdirSync(dir, { recursive: true });
|
||||||
|
await page.screenshot({ path: join(dir, `${shot.name}.png`), animations: "disabled", caret: "hide" });
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The main flows of ROADMAP §4 in a real browser, on the built UI and the demo control plane, with
|
||||||
|
// the clicks counted as in the smoke test (tests/flows.test.ts). Each is recorded: the showcase
|
||||||
|
// videos (docs/fabrica.md part 5) are target/e2e/videos/<name>.webm.
|
||||||
|
|
||||||
|
import type { Locator, Page } from "@playwright/test";
|
||||||
|
import { expect, test } from "../fixtures";
|
||||||
|
|
||||||
|
function counter() {
|
||||||
|
let n = 0;
|
||||||
|
return {
|
||||||
|
click: async (l: Locator) => {
|
||||||
|
n++;
|
||||||
|
await l.click();
|
||||||
|
},
|
||||||
|
get count() {
|
||||||
|
return n;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A beat for the viewer of the video, so a screen is seen before the next click. */
|
||||||
|
const beat = (page: Page) => page.waitForTimeout(700);
|
||||||
|
const nav = (page: Page) => page.getByRole("navigation", { name: "Main" }).first();
|
||||||
|
|
||||||
|
test("Add a host: + Host → fill → Apply = 2 clicks, kept", { annotation: { type: "video", description: "add-host" } }, async ({ page, open }) => {
|
||||||
|
const c = counter();
|
||||||
|
await open("/");
|
||||||
|
await expect(page.getByRole("button", { name: "More for wiki.home.test" })).toBeVisible();
|
||||||
|
await beat(page);
|
||||||
|
await c.click(page.getByRole("button", { name: "Add a host" }));
|
||||||
|
await page.getByLabel("Hostname").pressSequentially("notes.home.test");
|
||||||
|
await page.getByLabel("Send traffic to").fill("http://192.0.2.60:8080");
|
||||||
|
await beat(page);
|
||||||
|
await c.click(page.getByRole("button", { name: "Apply" }));
|
||||||
|
await expect(page.locator("dialog.ia-panel")).toHaveCount(0, { timeout: 10_000 });
|
||||||
|
await expect(page.getByRole("button", { name: "More for notes.home.test" })).toBeVisible();
|
||||||
|
await beat(page);
|
||||||
|
expect(c.count).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Undo the last change = 1 click", { annotation: { type: "video", description: "undo" } }, async ({ page, open }) => {
|
||||||
|
const c = counter();
|
||||||
|
await open("/");
|
||||||
|
const undo = page.getByRole("button", { name: /^Undo: Added recipes\.home\.test/ });
|
||||||
|
await expect(undo).toBeVisible();
|
||||||
|
await beat(page);
|
||||||
|
const sent = page.waitForRequest((r) => r.method() === "POST" && r.url().endsWith("/api/v1/undo"));
|
||||||
|
await c.click(undo);
|
||||||
|
expect((await sent).postDataJSON()).toMatchObject({ target_change_id: "ch_0008" });
|
||||||
|
await beat(page);
|
||||||
|
expect(c.count).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Restore: History → pick → Restore = 3 clicks", { annotation: { type: "video", description: "restore" } }, async ({ page, open }) => {
|
||||||
|
const c = counter();
|
||||||
|
await open("/");
|
||||||
|
await expect(page.getByRole("button", { name: "Add a host" })).toBeVisible();
|
||||||
|
await c.click(nav(page).getByRole("link", { name: "History" }));
|
||||||
|
await beat(page);
|
||||||
|
await c.click(page.getByRole("button", { name: /Turned share links on for wiki\.home\.test/ }));
|
||||||
|
await expect(page.getByRole("button", { name: "Restore this version" })).toBeVisible();
|
||||||
|
await beat(page);
|
||||||
|
const sent = page.waitForRequest((r) => r.method() === "POST" && r.url().endsWith("/api/v1/restore"));
|
||||||
|
await c.click(page.getByRole("button", { name: "Restore this version" }));
|
||||||
|
await sent;
|
||||||
|
await beat(page);
|
||||||
|
expect(c.count).toBe(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Share link: ⋯ → Share link → Copy = 3 clicks, 7 days", { annotation: { type: "video", description: "share-link" } }, async ({ page, context, open }) => {
|
||||||
|
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
|
||||||
|
const c = counter();
|
||||||
|
await open("/");
|
||||||
|
await c.click(page.getByRole("button", { name: "More for wiki.home.test" }));
|
||||||
|
const minted = page.waitForRequest((r) => r.method() === "POST" && r.url().endsWith("/share-links"));
|
||||||
|
await c.click(page.getByRole("menuitem", { name: /Share link/ }));
|
||||||
|
expect((await minted).postDataJSON()).toMatchObject({ expires_in_s: 604800 });
|
||||||
|
const copy = page.getByRole("button", { name: "Copy link" });
|
||||||
|
await expect(copy).not.toHaveAttribute("aria-disabled", /.*/);
|
||||||
|
await beat(page);
|
||||||
|
await c.click(copy);
|
||||||
|
await expect(page.getByText("Copied")).toBeVisible();
|
||||||
|
await beat(page);
|
||||||
|
expect(c.count).toBe(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Switch engine: engine chip → Switch to Caddy = 2 clicks", { annotation: { type: "video", description: "engine" } }, async ({ page, open }) => {
|
||||||
|
const c = counter();
|
||||||
|
await open("/");
|
||||||
|
await c.click(page.getByRole("button", { name: /^Engine: Pingora/ }));
|
||||||
|
await expect(page.getByRole("button", { name: "Switch to Caddy" })).toBeVisible();
|
||||||
|
await beat(page);
|
||||||
|
await c.click(page.getByRole("button", { name: "Switch to Caddy" }));
|
||||||
|
await expect(page.getByText("Now serving with Caddy.")).toBeVisible({ timeout: 10_000 });
|
||||||
|
await beat(page);
|
||||||
|
expect(c.count).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Device certificate: Certificates → + Device → Issue = 3 clicks", { annotation: { type: "video", description: "device-certificate" } }, async ({ page, open }) => {
|
||||||
|
const c = counter();
|
||||||
|
await open("/");
|
||||||
|
await expect(page.getByRole("button", { name: "Add a host" })).toBeVisible();
|
||||||
|
await c.click(nav(page).getByRole("link", { name: "Certificates" }));
|
||||||
|
await beat(page);
|
||||||
|
await c.click(page.getByRole("button", { name: "Add a device certificate" }));
|
||||||
|
await page.getByLabel("Device name").fill("felix's tablet");
|
||||||
|
await c.click(page.getByRole("button", { name: "Issue" }));
|
||||||
|
await expect(page.getByLabel("Match code 47 19 83")).toBeVisible();
|
||||||
|
expect(c.count).toBe(3);
|
||||||
|
await expect(page.getByRole("button", { name: "Show QR code" })).toBeVisible({ timeout: 10_000 });
|
||||||
|
await beat(page);
|
||||||
|
});
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"types": ["node"],
|
||||||
|
"noEmit": true,
|
||||||
|
"allowImportingTsExtensions": false
|
||||||
|
},
|
||||||
|
"include": ["./**/*.ts", "../playwright.config.ts", "../tests/demo.ts", "../tests/mockApi.ts"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||||
|
<meta name="color-scheme" content="dark" />
|
||||||
|
<meta name="referrer" content="no-referrer" />
|
||||||
|
<title>Hosts — Ianitor Domi</title>
|
||||||
|
</head>
|
||||||
|
<body class="ia">
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="module" src="/src/main.ts"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+26
-3
@@ -1,10 +1,33 @@
|
|||||||
{
|
{
|
||||||
"name": "web",
|
"name": "web",
|
||||||
"version": "0.0.0",
|
"version": "0.2.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"description": "Ianitor Domi web UI (Svelte 5). Placeholder until phase 3.",
|
"description": "Ianitor Domi web UI (Svelte 5, runes, TypeScript strict). A pure client of the control API.",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node -e \"console.log('web: placeholder, the UI arrives in phase 3; nothing is listening')\""
|
"dev": "vite",
|
||||||
|
"build": "vite build",
|
||||||
|
"check": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings && tsc -p e2e/tsconfig.json",
|
||||||
|
"test": "vitest run",
|
||||||
|
"test:e2e": "playwright test --project=web",
|
||||||
|
"aula:shots": "playwright test --project=aula"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@ianitor/ui": "workspace:*"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@playwright/test": "1.56.1",
|
||||||
|
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
||||||
|
"@testing-library/svelte": "^5.2.6",
|
||||||
|
"@testing-library/user-event": "^14.6.1",
|
||||||
|
"@tsconfig/svelte": "^5.0.4",
|
||||||
|
"@types/node": "^22.20.5",
|
||||||
|
"jsdom": "^26.0.0",
|
||||||
|
"svelte": "^5.20.0",
|
||||||
|
"svelte-check": "^4.1.4",
|
||||||
|
"typescript": "^5.7.3",
|
||||||
|
"vite": "^6.1.0",
|
||||||
|
"vitest": "^3.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The web UI's end-to-end suite (docs/fabrica.md, part 5): the built UI in a real browser against
|
||||||
|
// the demo control plane (tests/demo.ts, invented data only), served on 127.0.0.1 by e2e/serve.ts.
|
||||||
|
// Two projects:
|
||||||
|
// web the main flows of ROADMAP §4, each recorded as a video (target/e2e/videos/<flow>.webm);
|
||||||
|
// Fabrica's `web` target (.fabrica/tests.yaml) and its e2e pipeline run this one.
|
||||||
|
// aula the release's screenshots (target/e2e/aula/<name>.png), which `fabrica aula shots` checks
|
||||||
|
// and publishes (.fabrica/aula.yaml, `file:` shots).
|
||||||
|
// Every page is drawn at a fixed instant in a fixed zone, so two takes of a screen are the same.
|
||||||
|
// On Windows the browser is the installed Edge (PW_CHANNEL names another, e.g. chrome): nothing is
|
||||||
|
// downloaded. Elsewhere it is Playwright's own Chromium. Videos need Playwright's ffmpeg, which lives
|
||||||
|
// in PLAYWRIGHT_BROWSERS_PATH (on F: on Mark's PC, never C:).
|
||||||
|
|
||||||
|
import { defineConfig, devices } from "@playwright/test";
|
||||||
|
|
||||||
|
const channel = process.env.PW_CHANNEL ?? (process.platform === "win32" ? "msedge" : undefined);
|
||||||
|
// Fabrica's live view (Fabrica docs/20_tests.md part 3): the port its Tests page watches.
|
||||||
|
const devtools = process.env.FABRICA_TESTS_DEVTOOLS ? [`--remote-debugging-port=${process.env.FABRICA_TESTS_DEVTOOLS}`] : [];
|
||||||
|
|
||||||
|
const desktop = {
|
||||||
|
...devices["Desktop Chrome"],
|
||||||
|
...(channel ? { channel } : {}),
|
||||||
|
viewport: { width: 1440, height: 900 },
|
||||||
|
deviceScaleFactor: 1,
|
||||||
|
locale: "en-GB",
|
||||||
|
timezoneId: "Europe/Prague",
|
||||||
|
launchOptions: { args: ["--lang=en-GB", ...devtools] },
|
||||||
|
};
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
testDir: "e2e/specs",
|
||||||
|
outputDir: "../../target/e2e/results",
|
||||||
|
globalSetup: "./e2e/serve.ts",
|
||||||
|
fullyParallel: false,
|
||||||
|
workers: 1,
|
||||||
|
retries: 0,
|
||||||
|
forbidOnly: !!process.env.CI,
|
||||||
|
// Generous: the release PC runs several apps' suites at once, and a loaded PC types and draws slowly
|
||||||
|
// (one Edge start took 45 s there, one flow 72 s). A real hang still ends.
|
||||||
|
timeout: 180_000,
|
||||||
|
expect: { timeout: 15_000 },
|
||||||
|
reporter: [["list"]],
|
||||||
|
use: { trace: "retain-on-failure" },
|
||||||
|
projects: [
|
||||||
|
{ name: "web", testMatch: "flows.spec.ts", use: { ...desktop, video: { mode: "on", size: { width: 1440, height: 900 } } } },
|
||||||
|
{ name: "aula", testMatch: "aula.spec.ts", use: desktop },
|
||||||
|
],
|
||||||
|
});
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// The shell (handoff §2.16): sidebar on desktop, top and bottom bars on phone, the routes,
|
||||||
|
// the banners every screen starts with, toasts and the signed-out dialog (§10).
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
import { Button, Dialog, Icon } from "@ianitor/ui";
|
||||||
|
import type { IconName } from "@ianitor/ui";
|
||||||
|
import EngineChip from "./components/EngineChip.svelte";
|
||||||
|
import EnginePopover from "./components/EnginePopover.svelte";
|
||||||
|
import TopBanners from "./components/TopBanners.svelte";
|
||||||
|
import { app, navigate, refresh, startPolling } from "./lib/app.svelte";
|
||||||
|
import { remembered } from "./lib/applies";
|
||||||
|
import Certificates from "./views/Certificates.svelte";
|
||||||
|
import History from "./views/History.svelte";
|
||||||
|
import Hosts from "./views/Hosts.svelte";
|
||||||
|
import RenewByHand from "./views/RenewByHand.svelte";
|
||||||
|
import Settings from "./views/Settings.svelte";
|
||||||
|
import SignedIn from "./views/SignedIn.svelte";
|
||||||
|
|
||||||
|
const route = $derived.by(() => {
|
||||||
|
const u = new URL(app.path, "http://x");
|
||||||
|
const p = u.pathname.replace(/\/+$/, "") || "/";
|
||||||
|
const seg = p.split("/").filter(Boolean).map(decodeURIComponent);
|
||||||
|
if (p === "/signed-in") return { view: "signed-in" as const };
|
||||||
|
if (seg[0] === "history") return { view: "history" as const, host: u.searchParams.get("host") ?? undefined, pick: seg[1] };
|
||||||
|
if (seg[0] === "certificates") return { view: seg[1] === "renew-by-hand" ? ("renew" as const) : ("certs" as const), newDevice: seg[1] === "new" };
|
||||||
|
if (seg[0] === "settings") return { view: "settings" as const, tab: seg[1] ?? "general" };
|
||||||
|
return { view: "hosts" as const, newHost: seg[0] === "hosts" && seg[1] === "new", edit: seg[0] === "hosts" && seg[2] === "edit" ? seg[1] : undefined };
|
||||||
|
});
|
||||||
|
|
||||||
|
const NAV: { href: string; label: string; icon: IconName; views: string[] }[] = [
|
||||||
|
{ href: "/", label: "Hosts", icon: "building", views: ["hosts"] },
|
||||||
|
{ href: "/history", label: "History", icon: "history", views: ["history"] },
|
||||||
|
{ href: "/certificates", label: "Certificates", icon: "shield", views: ["certs", "renew"] },
|
||||||
|
{ href: "/settings/general", label: "Settings", icon: "gear", views: ["settings"] },
|
||||||
|
];
|
||||||
|
const TITLES: Record<string, string> = { hosts: "Hosts", history: "History", certs: "Certificates", renew: "Certificates", settings: "Settings", "signed-in": "Signed in" };
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
document.title = `${TITLES[route.view] ?? "Hosts"} — Ianitor Domi`;
|
||||||
|
});
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
if (route.view === "signed-in") return;
|
||||||
|
const stop = startPolling();
|
||||||
|
// Resume an apply this tab was watching before a reload or a sign-in (§3).
|
||||||
|
const id = remembered();
|
||||||
|
if (id && route.view === "hosts") app.panel = { kind: "host", resume: id };
|
||||||
|
let ch: BroadcastChannel | undefined;
|
||||||
|
try {
|
||||||
|
ch = new BroadcastChannel("ianitor-auth");
|
||||||
|
ch.onmessage = (m) => {
|
||||||
|
if (m.data === "signed-in") {
|
||||||
|
app.signedOut = false;
|
||||||
|
void refresh();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} catch {
|
||||||
|
/* no BroadcastChannel: "I have signed in" still works */
|
||||||
|
}
|
||||||
|
return () => {
|
||||||
|
stop();
|
||||||
|
ch?.close();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
function go(e: MouseEvent, href: string) {
|
||||||
|
if (e.metaKey || e.ctrlKey || e.shiftKey) return;
|
||||||
|
e.preventDefault();
|
||||||
|
navigate(href);
|
||||||
|
}
|
||||||
|
|
||||||
|
function signIn() {
|
||||||
|
const w = window.open("/signed-in", "ianitor-sign-in");
|
||||||
|
if (!w) {
|
||||||
|
// The new tab was blocked: this tab goes to the sign-in, so an open form is saved first
|
||||||
|
// (sessionStorage, this tab only) and comes back after it (§10).
|
||||||
|
window.dispatchEvent(new Event("ianitor:save-draft"));
|
||||||
|
location.href = `/signed-in?back=${encodeURIComponent(app.path)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function signedInAgain() {
|
||||||
|
app.signedOut = false;
|
||||||
|
await refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
const viewer = $derived(app.overview?.viewer ?? null);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if route.view === "signed-in"}
|
||||||
|
<SignedIn />
|
||||||
|
{:else}
|
||||||
|
<a class="skip domi-btn" href="#main">Skip to content</a>
|
||||||
|
<div class="shell">
|
||||||
|
<nav class="sidebar" aria-label="Main">
|
||||||
|
<div class="ia-wordmark brand">IANITOR DOMI</div>
|
||||||
|
{#each NAV as n (n.href)}
|
||||||
|
<a href={n.href} class="nav" aria-current={n.views.includes(route.view) ? "page" : undefined} onclick={(e) => go(e, n.href)}><Icon name={n.icon} />{n.label}</a>
|
||||||
|
{/each}
|
||||||
|
<div class="foot ia-muted">
|
||||||
|
<p>{viewer?.via === "authelia" ? `Signed in as ${viewer.name} through Authelia` : viewer ? `Using the API token "${viewer.name}"` : "Signed in through Authelia"}</p>
|
||||||
|
<p>Control on 127.0.0.1 only</p>
|
||||||
|
{#if app.overview?.site?.auth_logout_url}<a class="domi-btn link" href={app.overview.site.auth_logout_url}>Sign out</a>{/if}
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<header class="topbar"><span class="ia-wordmark">IANITOR DOMI</span>{#if app.phone}<EngineChip />{/if}</header>
|
||||||
|
<main id="main" tabindex="-1">
|
||||||
|
<TopBanners />
|
||||||
|
{#if route.view === "hosts"}
|
||||||
|
<Hosts route={{ newHost: route.newHost, edit: route.edit }} />
|
||||||
|
{:else if route.view === "history"}
|
||||||
|
{#key route.host}<History host={route.host} pick={route.pick} />{/key}
|
||||||
|
{:else if route.view === "certs"}
|
||||||
|
<Certificates newDevice={route.newDevice} />
|
||||||
|
{:else if route.view === "renew"}
|
||||||
|
<RenewByHand />
|
||||||
|
{:else if route.view === "settings"}
|
||||||
|
<Settings tab={route.tab} />
|
||||||
|
{/if}
|
||||||
|
</main>
|
||||||
|
<nav class="bottombar" aria-label="Main">
|
||||||
|
{#each NAV as n (n.href)}
|
||||||
|
<a href={n.href} aria-current={n.views.includes(route.view) ? "page" : undefined} onclick={(e) => go(e, n.href)}><Icon name={n.icon} /><span>{n.label}</span></a>
|
||||||
|
{/each}
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if app.panel?.kind === "engine"}
|
||||||
|
<EnginePopover onclose={() => {
|
||||||
|
app.panel = null;
|
||||||
|
document.querySelector<HTMLElement>("[data-engine-chip]")?.focus();
|
||||||
|
}} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="ia-toasts" role="status" aria-live="polite">
|
||||||
|
{#each app.toasts as t (t.id)}<div class="ia-toast"><Icon name="check" />{t.text}</div>{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if app.signedOut}
|
||||||
|
<Dialog title="Your sign-in has ended" role="alertdialog" escape={false} closable={false} onclose={() => {}}>
|
||||||
|
<p>Sign in again; this page keeps what you typed.</p>
|
||||||
|
{#snippet footer()}
|
||||||
|
<Button onclick={signedInAgain}>I have signed in</Button>
|
||||||
|
<Button variant="primary" onclick={signIn} data-autofocus>Sign in</Button>
|
||||||
|
{/snippet}
|
||||||
|
</Dialog>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
|
||||||
|
.sidebar { background: var(--colonnade); border-right: 1px solid var(--hairline); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; }
|
||||||
|
.brand { padding: 4px 10px 18px; }
|
||||||
|
.nav { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; font-size: var(--fs-nav); text-decoration: none; border: 1px solid transparent; }
|
||||||
|
.nav:hover { background: var(--surface); color: var(--text); }
|
||||||
|
.nav[aria-current="page"] { background: var(--surface-2); color: var(--text); box-shadow: var(--inset-lit); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
|
||||||
|
.nav[aria-current="page"] :global(svg) { color: var(--accent); }
|
||||||
|
.foot { margin-top: auto; font-size: 0.82rem; display: flex; flex-direction: column; gap: 4px; padding: 0 10px; }
|
||||||
|
main { padding: var(--main-pad); display: flex; flex-direction: column; gap: 18px; min-width: 0; outline: none; }
|
||||||
|
.topbar, .bottombar { display: none; }
|
||||||
|
@media (max-width: 719.98px) {
|
||||||
|
.shell { grid-template-columns: minmax(0, 1fr); }
|
||||||
|
.sidebar { display: none; }
|
||||||
|
.topbar { display: flex; align-items: center; justify-content: space-between; background: var(--colonnade); border-bottom: 1px solid var(--hairline); padding: 10px 16px; }
|
||||||
|
.topbar .ia-wordmark { font-size: 12px; letter-spacing: 0.26em; }
|
||||||
|
main { padding: 18px 16px calc(90px + env(safe-area-inset-bottom)); gap: 14px; }
|
||||||
|
.bottombar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--colonnade); border-top: 1px solid var(--hairline); padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); z-index: 40; }
|
||||||
|
.bottombar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--phone-bar-h); border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; font-size: var(--fs-tab-phone); text-decoration: none; }
|
||||||
|
.bottombar a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
|
||||||
|
.bottombar a[aria-current="page"] :global(svg) { color: var(--accent); }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §7.1: the apply checklist, its countdown and the queued state.
|
||||||
|
import { Button, Icon, Progress } from "@ianitor/ui";
|
||||||
|
import type { ApplyView } from "../lib/types";
|
||||||
|
import { app, secondsLeft } from "../lib/app.svelte";
|
||||||
|
|
||||||
|
let { apply, oncancel }: { apply: ApplyView; oncancel?: () => void } = $props();
|
||||||
|
|
||||||
|
const engine = $derived(app.overview?.engine.running === "caddy" ? "Caddy" : "Pingora");
|
||||||
|
const watchSeconds = $derived(app.overview?.site?.watch_seconds ?? 60);
|
||||||
|
const left = $derived(apply.watch ? secondsLeft(apply.watch.ends_at) : watchSeconds);
|
||||||
|
const st = (k: string) => apply.steps.find((s) => s.key === k)?.state ?? "pending";
|
||||||
|
const merged = (a: string, b: string) => {
|
||||||
|
const x = st(a);
|
||||||
|
const y = st(b);
|
||||||
|
if (x === "failed" || y === "failed") return "failed";
|
||||||
|
if (x === "running" || y === "running") return "running";
|
||||||
|
if (x === "done" && (y === "done" || y === "skipped")) return "done";
|
||||||
|
return x;
|
||||||
|
};
|
||||||
|
const noWatch = $derived(apply.reason?.code === "apply.kept.no_watch");
|
||||||
|
const rows = $derived([
|
||||||
|
{ s: st("validate"), t: { pending: "Check the host file", running: "Checking the host file", done: "Checked the host file", failed: "The host file did not pass the check", skipped: "Check the host file" } },
|
||||||
|
{ s: merged("compile", "write"), t: { pending: "Build the Pingora and Caddy settings", running: "Building the Pingora and Caddy settings", done: "Built the Pingora and Caddy settings", failed: "Could not build the settings", skipped: "Build the Pingora and Caddy settings" } },
|
||||||
|
{ s: st("reload"), t: { pending: `Reload ${engine}`, running: `Reloading ${engine}`, done: `Reloaded ${engine}, no connections dropped`, failed: `${engine} did not take the new settings`, skipped: `Reload ${engine}` } },
|
||||||
|
{
|
||||||
|
s: st("watch"),
|
||||||
|
t: noWatch
|
||||||
|
? { pending: "Check that it answers", running: `Checking that it answers: ${left} s left`, done: "It answers", failed: "Health checks failed", skipped: "Nothing to watch: the host is removed." }
|
||||||
|
: { pending: `Watch health checks for ${watchSeconds} s`, running: `Watching health checks: ${left} s left`, done: `Health checks passed for ${watchSeconds} s`, failed: "Health checks failed", skipped: "Nothing to watch: the host is removed." },
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
const prefix: Record<string, string> = { done: "Done:", running: "Now:", pending: "Next:", failed: "Failed:", skipped: "Skipped:" };
|
||||||
|
const final = $derived(["kept", "reverted", "failed", "needs_attention"].includes(apply.state));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if apply.state === "queued"}
|
||||||
|
<p class="ia-status" data-s="running">
|
||||||
|
<Icon name="clock" />
|
||||||
|
<span>
|
||||||
|
Waiting for "{apply.queue?.waiting_for?.summary ?? "another change"}" to finish{apply.queue?.waiting_for?.seconds_left != null
|
||||||
|
? `, about ${apply.queue.waiting_for.seconds_left} s`
|
||||||
|
: ""}.
|
||||||
|
{#if (apply.queue?.position ?? 1) > 1}{(apply.queue?.position ?? 1) - 1} other changes are ahead of this one.{/if}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
{#if oncancel}<div><Button onclick={oncancel}>Cancel</Button></div>{/if}
|
||||||
|
{:else}
|
||||||
|
<ol class="steps">
|
||||||
|
{#each rows as r, i (i)}
|
||||||
|
<li class={r.s}>
|
||||||
|
{#if r.s === "done"}<Icon name="check" />{:else if r.s === "running"}<Icon name="clock" />{:else if r.s === "failed"}<Icon name="ring" />{:else}<span class="hollow" aria-hidden="true"></span>{/if}
|
||||||
|
<span><span class="sr-only">{prefix[r.s]}</span>{r.t[r.s as keyof typeof r.t]}</span>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
{#if st("watch") === "failed" && !final}
|
||||||
|
<li class="running"><Icon name="clock" /><span><span class="sr-only">Now:</span>Undoing the change</span></li>
|
||||||
|
{/if}
|
||||||
|
</ol>
|
||||||
|
{#if apply.state === "watching"}
|
||||||
|
<Progress label="Health watch" max={watchSeconds} now={watchSeconds - left} text="{left} seconds left" />
|
||||||
|
<p class="ia-hint">You can leave this screen. Other changes wait their turn; only one apply runs at a time.</p>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
|
||||||
|
.steps li { display: flex; gap: 10px; align-items: center; }
|
||||||
|
.steps li.pending { color: var(--muted); }
|
||||||
|
.steps li.running { color: var(--text); }
|
||||||
|
.steps li.running :global(svg) { color: var(--accent); }
|
||||||
|
.steps li.done { color: var(--text-2); }
|
||||||
|
.steps li.done :global(svg) { color: var(--kept); }
|
||||||
|
.steps li.failed :global(svg) { color: var(--down); }
|
||||||
|
.steps li.skipped { color: var(--muted); }
|
||||||
|
.hollow { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); margin: 2px; }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §7.4 and §7.5: the last-change bar with Undo (1 click), and the reverted / not
|
||||||
|
// applied banner that stands in for its first line.
|
||||||
|
import { Banner, Button, Details, Icon, Progress } from "@ianitor/ui";
|
||||||
|
import { ApiError, call, del, newKey, post, sentence } from "../lib/api";
|
||||||
|
import { app, refresh, secondsLeft, toast } from "../lib/app.svelte";
|
||||||
|
import { atTime, firstSentence, when } from "../lib/format";
|
||||||
|
import type { ApplyView } from "../lib/types";
|
||||||
|
|
||||||
|
let { onshowsteps, onedit }: { onshowsteps: (id: string) => void; onedit: (a: ApplyView, field?: string) => void } = $props();
|
||||||
|
|
||||||
|
const o = $derived(app.overview);
|
||||||
|
const last = $derived(o?.last_apply ?? null);
|
||||||
|
const active = $derived(o?.active_apply ?? null);
|
||||||
|
const undo = $derived(o?.undo ?? null);
|
||||||
|
let moved = $state<string | null>(null);
|
||||||
|
let undoing = $state(false);
|
||||||
|
let pushing = $state(false);
|
||||||
|
const dismissKey = $derived(last ? `apply:${last.id}` : "");
|
||||||
|
|
||||||
|
function runningHeading(summary: string, a: { kind: string; hosts: string[]; summary: string } | null): string {
|
||||||
|
if (!a) return summary;
|
||||||
|
const h = a.hosts[0] ?? "";
|
||||||
|
switch (a.kind) {
|
||||||
|
case "add": return `Adding ${h}`;
|
||||||
|
case "remove": return `Removing ${h}`;
|
||||||
|
case "edit": return `Changing ${h}`;
|
||||||
|
case "share_links": return `Turning on share links for ${h}`;
|
||||||
|
case "undo": return `Undoing: ${a.summary.replace(/^Undid: /, "")}`;
|
||||||
|
case "restore": return a.summary.replace(/^Restored /, "Restoring ");
|
||||||
|
default: return summary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function doUndo() {
|
||||||
|
if (!undo?.target) return;
|
||||||
|
undoing = true;
|
||||||
|
moved = null;
|
||||||
|
try {
|
||||||
|
await post("/undo", { target_change_id: undo.target.change_id });
|
||||||
|
await refresh();
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof ApiError && e.code === "undo.target_moved") {
|
||||||
|
moved = e.body.message;
|
||||||
|
await refresh();
|
||||||
|
} else {
|
||||||
|
moved = sentence(e);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
undoing = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function pushNow() {
|
||||||
|
pushing = true;
|
||||||
|
try {
|
||||||
|
await call("POST", "/repo/push", {}, { idem: newKey() });
|
||||||
|
} catch {
|
||||||
|
/* the bar shows the push state on the next poll */
|
||||||
|
} finally {
|
||||||
|
pushing = false;
|
||||||
|
await refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function cancel(id: string) {
|
||||||
|
try {
|
||||||
|
await del(`/applies/${encodeURIComponent(id)}`);
|
||||||
|
toast("Cancelled before it started. Nothing changed.");
|
||||||
|
await refresh();
|
||||||
|
} catch (e) {
|
||||||
|
moved = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const keptLine = $derived.by(() => {
|
||||||
|
if (!last || last.state !== "kept") return "";
|
||||||
|
const t = when(last.finished_at ?? last.created_at, app.now);
|
||||||
|
const code = last.reason?.code ?? "";
|
||||||
|
if (code === "apply.kept.no_watch") return `${last.hosts[0] ?? ""} has no health check, so Ianitor only checked that it answers.`;
|
||||||
|
const what = code === "apply.kept.removed" ? "removed" : code === "apply.kept.no_edge" ? "saved, nothing checked (development mode)" : `health checks passed for ${o?.site?.watch_seconds ?? 60} s`;
|
||||||
|
const push = last.push?.state === "pushed" ? `pushed to Gitea as ${last.commit_short}` : last.push?.state === "pending" ? "sending to Gitea" : last.commit_short ? `saved as commit ${last.commit_short}` : "";
|
||||||
|
return [t, what, push].filter(Boolean).join(" · ");
|
||||||
|
});
|
||||||
|
const pushFailed = $derived(last?.state === "kept" && last.push?.state === "failed");
|
||||||
|
const undoReason = $derived(undo?.blocked && undo.blocked.code !== "undo.nothing" ? undo.blocked.message : null);
|
||||||
|
// Ticks every second on the local clock (§7.2), not only on the 5 s poll.
|
||||||
|
const watchLeft = $derived(
|
||||||
|
active?.watch_ends_at ? secondsLeft(active.watch_ends_at) : active?.seconds_left != null ? active.seconds_left : null,
|
||||||
|
);
|
||||||
|
// The outcome's offer, by code (§7.5).
|
||||||
|
const offer = $derived.by(() => {
|
||||||
|
const c = last?.reason?.code ?? "";
|
||||||
|
if (/^apply\.reverted\.(not_found|redirect|sign_in)$/.test(c)) return { label: "Edit health check", field: "health_check.path" };
|
||||||
|
if (/^apply\.(interrupted|reverted\.edge_lost|interrupted\.queued)$/.test(c)) return { label: "Try again", field: last?.reason?.field ?? undefined };
|
||||||
|
if (/^apply\.failed\.(reload|build|edge_unreachable)$/.test(c)) return null;
|
||||||
|
if (last?.attempted_host) return { label: "Edit and try again", field: last?.reason?.field ?? undefined };
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
const pushLine = $derived.by(() => {
|
||||||
|
const p = last?.push;
|
||||||
|
const remote = "Gitea";
|
||||||
|
switch (p?.error_code) {
|
||||||
|
case "push.failed.rejected": return `Kept, but ${remote} has changes Ianitor does not have, so nothing was sent. Nothing is lost on this server.`;
|
||||||
|
case "push.failed.auth": return `Kept, but ${remote} refused Ianitor's access key. Check the key in Custos.`;
|
||||||
|
default: return `Kept, but not yet saved to ${remote}: ${remote} did not answer.${p?.next_try_at ? ` Ianitor tries again ${atTime(p.next_try_at, app.now)}.` : " Ianitor tries again by itself."}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const canPushNow = $derived(pushFailed && last?.push?.error_code !== "push.failed.rejected");
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if last && (last.state === "reverted" || last.state === "failed") && !app.dismissed.includes(dismissKey)}
|
||||||
|
{@const parts = firstSentence(last.reason?.message ?? "")}
|
||||||
|
<Banner tone="notice" ondismiss={() => (app.dismissed = [...app.dismissed, dismissKey])}>
|
||||||
|
{#snippet title()}<span class="ia-status" data-s="reverted"><Icon name="undo" /><span class="word">{last.state === "failed" ? "not applied" : "reverted"}</span></span> <strong>{parts[0]}</strong>{/snippet}
|
||||||
|
{#if parts[1]}Reason: {parts[1]}{/if}
|
||||||
|
{#if last.reason?.detail && last.reason.code.startsWith("apply.failed.")}<Details detail={last.reason.detail} />{/if}
|
||||||
|
{#snippet actions()}
|
||||||
|
{#if offer}<Button variant="outline" onclick={() => onedit(last, offer?.field)}>{offer.label}</Button>{/if}
|
||||||
|
{/snippet}
|
||||||
|
</Banner>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if last || active}
|
||||||
|
<section class="ia-bar" aria-label="Last change">
|
||||||
|
{#if active}
|
||||||
|
<div class="grow">
|
||||||
|
<div class="ia-status" data-s="running"><Icon name="clock" /><span class="word">{active.state === "queued" ? "waiting" : active.state === "watching" ? "watching" : "applying"}</span>
|
||||||
|
<span>{runningHeading(active.summary, active.kind ? active : null)}</span></div>
|
||||||
|
<div class="ia-sub">{active.state === "queued" ? "Waiting for another change to finish" : active.state === "watching" ? `${watchLeft ?? 0} s left` : "Checking and loading the change"}</div>
|
||||||
|
{#if active.state === "watching" && watchLeft != null}
|
||||||
|
{@const total = o?.site?.watch_seconds ?? 60}
|
||||||
|
<Progress label="Health watch" max={total} now={total - watchLeft} text="{watchLeft} seconds left" />
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{#if active.state === "queued"}<Button onclick={() => cancel(active.id)}>Cancel</Button>{:else}<button type="button" class="domi-btn link" onclick={() => onshowsteps(active.id)}>Show steps</button>{/if}
|
||||||
|
{:else if last}
|
||||||
|
<div class="grow">
|
||||||
|
{#if last.state === "kept"}
|
||||||
|
<div><span class="ia-status" data-s="kept"><Icon name="check" /><span class="word">kept</span></span> {last.summary}</div>
|
||||||
|
<div class="ia-sub" class:warn={pushFailed}>{pushFailed ? pushLine : keptLine}</div>
|
||||||
|
{:else if undo?.target}
|
||||||
|
<div>Undo: {undo.target.summary}</div>
|
||||||
|
{/if}
|
||||||
|
{#if undo?.effect && (last.state !== "kept" || undo?.target?.change_id !== last.change_id)}<div class="ia-sub">{undo.effect}</div>{/if}
|
||||||
|
{#if moved}<div class="ia-sub" role="status">{moved}</div>{/if}
|
||||||
|
{#if undoReason}<div class="ia-sub" id="undo-reason">{undoReason}</div>{/if}
|
||||||
|
{#if !undo?.target}<div class="ia-sub">Nothing to undo yet.</div>{/if}
|
||||||
|
</div>
|
||||||
|
{#if canPushNow}<Button onclick={pushNow} pending={pushing}>Try now</Button>{/if}
|
||||||
|
{#if undo?.target}
|
||||||
|
<Button icon="undo" onclick={doUndo} pending={undoing} disabled={!!undoReason || !undo.available}
|
||||||
|
describedby={undoReason ? "undo-reason" : undefined}
|
||||||
|
label="Undo: {undo.target.summary}.{undo.effect ? ' ' + undo.effect + '.' : ''}">Undo</Button>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
</section>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.warn { color: var(--degraded); }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §2.4: the engine chip (click 1 of the switch). On the main screen's header on a
|
||||||
|
// desktop, in the top bar on a phone (§2.16).
|
||||||
|
import { Icon } from "@ianitor/ui";
|
||||||
|
import { app } from "../lib/app.svelte";
|
||||||
|
|
||||||
|
const o = $derived(app.overview);
|
||||||
|
const engineName = $derived(o?.engine.running === "caddy" ? "Caddy" : "Pingora");
|
||||||
|
const engineLabel = $derived(
|
||||||
|
o?.engine.state === "switching" ? "Engine: switching" : `Engine: ${engineName}${o?.engine.state === "stopped" ? ", not answering" : ""}. Change engine`,
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if o}
|
||||||
|
<button type="button" class="ia-engine" data-engine-chip aria-haspopup="dialog" aria-expanded={app.panel?.kind === "engine"} aria-label={engineLabel}
|
||||||
|
onclick={() => (app.panel = app.panel?.kind === "engine" ? null : { kind: "engine" })}>
|
||||||
|
{#if o.engine.state === "switching"}<Icon name="clock" /> Engine Switching…{:else}
|
||||||
|
<span class="ia-status" data-s={o.engine.state === "stopped" ? "down" : "healthy"}><span class="ia-dot"></span></span>
|
||||||
|
<small class="desktop">Engine</small> {engineName}{#if o.engine.running === "caddy"} <small>(fallback)</small>{/if}{/if}
|
||||||
|
<Icon name="chevron" />
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@media (max-width: 719.98px) { .desktop { display: none; } }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §9: the engine popover. Click 1 is the chip, click 2 "Switch to Caddy" (the popover
|
||||||
|
// is the confirmation). The switch runs in control; this polls GET /engine until it ends.
|
||||||
|
import { onDestroy, onMount } from "svelte";
|
||||||
|
import { Banner, Button, Details, Dialog, Icon, Progress } from "@ianitor/ui";
|
||||||
|
import { call, get, newKey, sentence } from "../lib/api";
|
||||||
|
import { app, refresh } from "../lib/app.svelte";
|
||||||
|
import { whenInline } from "../lib/format";
|
||||||
|
import type { EngineView } from "../lib/types";
|
||||||
|
|
||||||
|
let { onclose }: { onclose: () => void } = $props();
|
||||||
|
|
||||||
|
const e = $derived(app.overview?.engine ?? null);
|
||||||
|
const running = $derived(e?.running ?? "pingora");
|
||||||
|
const name = $derived(running === "caddy" ? "Caddy" : "Pingora");
|
||||||
|
const other = $derived(running === "caddy" ? "Pingora" : "Caddy");
|
||||||
|
const target = $derived(running === "caddy" ? "pingora" : "caddy");
|
||||||
|
let switching = $state(false);
|
||||||
|
let problem = $state<string | null>(null);
|
||||||
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||||
|
onDestroy(() => clearTimeout(timer));
|
||||||
|
|
||||||
|
let activeLinks = $state(0);
|
||||||
|
onMount(async () => {
|
||||||
|
try {
|
||||||
|
const l = await get<{ items: { state: string }[] }>("/share-links", { quiet: true });
|
||||||
|
activeLinks = l.items.filter((x) => x.state === "active").length;
|
||||||
|
} catch {
|
||||||
|
/* the count is only a hint */
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const fr = $derived(e?.fallback_ready ?? null);
|
||||||
|
const differs = $derived(fr ? fr.compared - fr.matched : 0);
|
||||||
|
const notReady = $derived(running === "pingora" && !e?.fallback_ready?.built_at);
|
||||||
|
const disabledReason = $derived(!e?.switchable ? "This server does not let Ianitor switch engines." : notReady ? "Caddy is not ready: its settings have not been built yet." : null);
|
||||||
|
|
||||||
|
async function doSwitch() {
|
||||||
|
problem = null;
|
||||||
|
switching = true;
|
||||||
|
const from = name;
|
||||||
|
const to = other;
|
||||||
|
try {
|
||||||
|
await call("POST", "/engine", { target }, { idem: newKey() });
|
||||||
|
const poll = async () => {
|
||||||
|
try {
|
||||||
|
const v = await get<EngineView>("/engine", { quiet: true });
|
||||||
|
if (v.state === "switching") {
|
||||||
|
timer = setTimeout(poll, 1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switching = false;
|
||||||
|
await refresh();
|
||||||
|
if (v.last_error) {
|
||||||
|
app.switchResult = { ok: false, title: `${to} did not start, so ${from} is serving again.`, text: "Visitors had a short break and nothing else changed.", detail: v.last_error.detail ?? null };
|
||||||
|
} else {
|
||||||
|
app.switchResult = { ok: true, title: `Now serving with ${to}.`, text: "Switch back from the engine chip at any time; it is the same 2 clicks." };
|
||||||
|
}
|
||||||
|
onclose();
|
||||||
|
} catch {
|
||||||
|
// Contact may drop for a few seconds while the engines change (§9.2).
|
||||||
|
timer = setTimeout(poll, 1000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
timer = setTimeout(poll, 500);
|
||||||
|
} catch (err) {
|
||||||
|
switching = false;
|
||||||
|
problem = sentence(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Dialog title={e?.state === "stopped" ? `${name} is not answering` : `Serving with ${name}`} kind="popover" modal={false} escape={!switching} toggle="[data-engine-chip]" {onclose}>
|
||||||
|
<p class="ia-label">Engine</p>
|
||||||
|
{#if e?.state === "stopped"}
|
||||||
|
<p>Visitors may not reach any host. Switching to {other} is the quickest way back.</p>
|
||||||
|
{:else}
|
||||||
|
<p class="ia-text2">
|
||||||
|
{#if e?.since}Since {whenInline(e.since, app.now)}. {/if}
|
||||||
|
{#if running === "pingora"}
|
||||||
|
{#if notReady}Caddy is not ready: its settings have not been built yet.{:else if differs > 0}Caddy was built {whenInline(fr?.built_at, app.now)} with the same routes, but {differs} of {fr?.compared} {fr?.compared === 1 ? "host" : "hosts"} {differs === 1 ? "behaves" : "behave"} differently on it.{:else}Caddy is ready with the same routes: built {whenInline(fr?.built_at, app.now)}{fr?.compared ? (fr.compared === 1 ? ", and the host behaves the same" : `, and all ${fr.compared} hosts behave the same`) : ""}.{/if}
|
||||||
|
{#if !notReady && !fr?.current} It is rebuilt from the current routes when you switch.{/if}
|
||||||
|
{:else}Pingora is ready with the same routes.{/if}
|
||||||
|
</p>
|
||||||
|
{#if running === "pingora" && !notReady && fr?.differences.length}
|
||||||
|
<Details detail={fr.differences.join("\n")} />
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
<div class="ia-card">
|
||||||
|
<p><strong>What happens</strong></p>
|
||||||
|
<ul>
|
||||||
|
<li>{name} stops and {other} starts. New visits reach {other} in about 2 seconds.</li>
|
||||||
|
<li>Open connections close; videos and uploads in progress restart.</li>
|
||||||
|
<li>Hosts and certificates stay the same.</li>
|
||||||
|
{#if running === "pingora"}
|
||||||
|
<li>Share links stop working while Caddy serves: visitors with a link get the normal sign-in. They work again when you switch back.{#if activeLinks}{" "}{activeLinks === 1 ? "1 share link is" : `${activeLinks} share links are`} active.{/if}</li>
|
||||||
|
<li>Changes keep working: Ianitor tries each one on Caddy and undoes it if a host stops answering.</li>
|
||||||
|
{:else}
|
||||||
|
<li>Share links work again.</li>
|
||||||
|
{/if}
|
||||||
|
<li>This page may lose contact for a few seconds.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{#if switching}
|
||||||
|
<p class="ia-status" data-s="running" role="status"><Icon name="clock" /><strong>Switching to {other}</strong></p>
|
||||||
|
<Progress label="Switching engine" max={1} now={0} text="{name} stopping, starting {other}" />
|
||||||
|
{/if}
|
||||||
|
{#if problem}<Banner tone="notice" live="status">{#snippet title()}{problem}{/snippet}</Banner>{/if}
|
||||||
|
{#if disabledReason}<p class="ia-hint" id="switch-reason">{disabledReason}</p>{/if}
|
||||||
|
{#snippet footer()}
|
||||||
|
<Button onclick={onclose}>Cancel</Button>
|
||||||
|
<Button variant={e?.state === "stopped" ? "primary" : "outline"} icon="swap" onclick={doSwitch} pending={switching}
|
||||||
|
disabled={!!disabledReason} describedby={disabledReason ? "switch-reason" : undefined}>Switch to {other}</Button>
|
||||||
|
{/snippet}
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
ul { margin: 6px 0 0; padding-left: 1.1rem; color: var(--text-2); }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §2.5 and §5.1: the host list, sorted down, degraded, pending, unknown, healthy.
|
||||||
|
import { Status } from "@ianitor/ui";
|
||||||
|
import type { StatusKind } from "@ianitor/ui";
|
||||||
|
import HostMenu from "./HostMenu.svelte";
|
||||||
|
import { app, changesBlocked } from "../lib/app.svelte";
|
||||||
|
import { ago, duration } from "../lib/format";
|
||||||
|
import type { HostRow } from "../lib/types";
|
||||||
|
|
||||||
|
let {
|
||||||
|
hosts,
|
||||||
|
onedit,
|
||||||
|
onremove,
|
||||||
|
onshare,
|
||||||
|
onhistory,
|
||||||
|
onretry,
|
||||||
|
}: {
|
||||||
|
hosts: HostRow[];
|
||||||
|
onedit: (h: string) => void;
|
||||||
|
onremove: (h: string) => void;
|
||||||
|
onshare: (h: string) => void;
|
||||||
|
onhistory: (h: string) => void;
|
||||||
|
onretry: (h: string) => void;
|
||||||
|
} = $props();
|
||||||
|
|
||||||
|
const ORDER: Record<string, number> = { down: 0, degraded: 1, pending: 2, unknown: 3, healthy: 4 };
|
||||||
|
const sorted = $derived([...hosts].sort((a, b) => (ORDER[a.health.state] ?? 5) - (ORDER[b.health.state] ?? 5) || a.hostname.localeCompare(b.hostname)));
|
||||||
|
const running = $derived(app.overview?.active_apply ? (app.overview.last_apply?.hosts ?? []) : []);
|
||||||
|
const underCaddy = $derived(app.overview?.engine.running === "caddy");
|
||||||
|
|
||||||
|
function kind(h: HostRow): [StatusKind, string] {
|
||||||
|
switch (h.health.state) {
|
||||||
|
case "healthy": return ["healthy", "healthy"];
|
||||||
|
case "degraded": return ["degraded", "degraded"];
|
||||||
|
case "down": return ["down", "down"];
|
||||||
|
case "pending": return ["unknown", "waiting"];
|
||||||
|
default: return ["unknown", "not checked"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function since(h: HostRow): string {
|
||||||
|
return h.health.since ? duration((app.now - Date.parse(h.health.since)) / 1000) : "a while";
|
||||||
|
}
|
||||||
|
|
||||||
|
function sub(h: HostRow): { text: string; problem: boolean } {
|
||||||
|
const f = h.health.failure;
|
||||||
|
const visitors = 'Visitors get an error page.';
|
||||||
|
switch (h.health.state) {
|
||||||
|
case "healthy": {
|
||||||
|
const added = h.added_at && app.now - Date.parse(h.added_at) < 86_400_000 ? "Added today · c" : "C";
|
||||||
|
const lat = h.health.latency_ms != null && !underCaddy ? ` · ${h.health.latency_ms} ms` : "";
|
||||||
|
return { text: `${added}hecked ${ago(h.health.last_check_at, app.now)}${lat}`, problem: false };
|
||||||
|
}
|
||||||
|
case "degraded": {
|
||||||
|
const ok = h.health.upstreams.filter((u) => u.state === "healthy").length;
|
||||||
|
const m = h.health.upstreams.length;
|
||||||
|
if (m > 1) return { text: `${ok} of ${m} addresses answer. Visitors are sent to the ones that do.`, problem: true };
|
||||||
|
return { text: `Answering only some checks.`, problem: true };
|
||||||
|
}
|
||||||
|
case "down":
|
||||||
|
if (f?.kind === "refused") return { text: `Connection refused for ${since(h)}. ${visitors}`, problem: true };
|
||||||
|
if (f?.kind === "timeout") return { text: `Not answering for ${since(h)}. ${visitors}`, problem: true };
|
||||||
|
if (f?.kind === "name") return { text: `The name ${f.upstream ?? ""} cannot be found. ${visitors}`, problem: true };
|
||||||
|
if (f?.kind === "tls") return { text: `The certificate of ${f.upstream ?? ""} cannot be checked.`, problem: true };
|
||||||
|
return { text: `Answering with an error page for ${since(h)}.`, problem: true };
|
||||||
|
case "pending": return { text: "Waiting for the first check.", problem: false };
|
||||||
|
default: return { text: "No health check set for this host.", problem: false };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function phoneDetail(h: HostRow): string {
|
||||||
|
if (h.health.state === "healthy" && h.health.latency_ms != null) return `${h.health.latency_ms} ms`;
|
||||||
|
if (h.health.state === "down" && h.health.failure?.kind === "refused") return `refused for ${since(h)}`;
|
||||||
|
if (h.health.state === "unknown") return "no health check";
|
||||||
|
if (h.added_at && app.now - Date.parse(h.added_at) < 86_400_000) return "added today";
|
||||||
|
return h.share_links ? "share links on" : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function chips(h: HostRow): string[] {
|
||||||
|
const c = [h.tls === "domi" ? "Domi certificate" : "Let's Encrypt"];
|
||||||
|
c.push(h.auth === "forward-auth" ? "Sign-in first" : "Open to anyone");
|
||||||
|
if (h.share_links) c.push("Share links on");
|
||||||
|
if (h.device_certs) c.push("Device certificate needed");
|
||||||
|
if (!h.websockets) c.push("No websockets");
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
const blocked = $derived(changesBlocked());
|
||||||
|
const shareReason = $derived(!app.overview?.site?.share_links_available ? (underCaddy ? "Share links are off while Caddy serves." : "Share links are not set up on this server.") : null);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="ia-list" role="table" aria-label="Hosts">
|
||||||
|
<div class="ia-row head" role="row">
|
||||||
|
<span class="ia-label col-status" role="columnheader">Status</span>
|
||||||
|
<span class="ia-label" role="columnheader">Host</span>
|
||||||
|
<span class="ia-label desktop" role="columnheader">Sends traffic to</span>
|
||||||
|
<span role="columnheader"><span class="sr-only">More</span></span>
|
||||||
|
</div>
|
||||||
|
{#each sorted as h (h.hostname)}
|
||||||
|
{@const [k, w] = kind(h)}
|
||||||
|
{@const s = sub(h)}
|
||||||
|
<div class="ia-row" role="row">
|
||||||
|
<span class="col-status" role="cell"><Status kind={k} word={w} /></span>
|
||||||
|
<span role="cell">
|
||||||
|
<span class="phone-dot"><Status kind={k} word="" /></span>
|
||||||
|
<span class="ia-host">{h.hostname}</span>
|
||||||
|
<span class="ia-chips desktop">{#each chips(h) as c (c)}<span class="ia-chip">{c}</span>{/each}</span>
|
||||||
|
<span class="ia-sub phone">{w}{phoneDetail(h) ? ` · ${phoneDetail(h)}` : ""}</span>
|
||||||
|
</span>
|
||||||
|
<span role="cell" class="desktop">
|
||||||
|
<span>{h.upstreams[0] ?? ""}</span>{#if h.upstreams.length > 1}{" "}<span class="ia-muted">+{h.upstreams.length - 1} more</span>{/if}
|
||||||
|
<span class="ia-sub" class:problem={s.problem} style="display:block">{running.includes(h.hostname) ? "Changing now · " : ""}{s.text}</span>
|
||||||
|
{#if h.certificate.state === "pending"}<span class="ia-sub" style="display:block">Waiting for Let's Encrypt to issue the certificate.</span>{/if}
|
||||||
|
{#if h.certificate.state === "failed"}
|
||||||
|
<span class="ia-sub" style="display:block;color:var(--down)">Let's Encrypt could not confirm <strong>{h.hostname}</strong>. The name must point to this server, and port 80 must be open from the internet.
|
||||||
|
<button type="button" class="domi-btn link" onclick={() => onretry(h.hostname)}>Try again</button></span>
|
||||||
|
{/if}
|
||||||
|
</span>
|
||||||
|
<span role="cell">
|
||||||
|
<HostMenu hostname={h.hostname} items={[
|
||||||
|
{ label: "Share link", icon: "link", reason: shareReason, run: () => onshare(h.hostname) },
|
||||||
|
{ label: "Edit host", icon: "pencil", reason: blocked, run: () => onedit(h.hostname) },
|
||||||
|
{ label: "Show in history", icon: "history", run: () => onhistory(h.hostname) },
|
||||||
|
{ label: "Remove host", icon: "trash", danger: true, divider: true, reason: blocked, run: () => onremove(h.hostname) },
|
||||||
|
]} />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.phone, .phone-dot { display: none; }
|
||||||
|
.problem { color: var(--text-2) !important; }
|
||||||
|
@media (max-width: 719.98px) {
|
||||||
|
.desktop { display: none !important; }
|
||||||
|
.phone { display: block; padding-left: 22px; }
|
||||||
|
.phone-dot { display: inline; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts" module>
|
||||||
|
import type { IconName } from "@ianitor/ui";
|
||||||
|
export interface Item {
|
||||||
|
label: string;
|
||||||
|
icon: IconName;
|
||||||
|
danger?: boolean;
|
||||||
|
reason?: string | null;
|
||||||
|
divider?: boolean;
|
||||||
|
run: () => void;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §2.6: the row's ⋯ menu (WAI-ARIA menu button).
|
||||||
|
import { tick } from "svelte";
|
||||||
|
import { Icon } from "@ianitor/ui";
|
||||||
|
|
||||||
|
let { hostname, items }: { hostname: string; items: Item[] } = $props();
|
||||||
|
|
||||||
|
let open = $state(false);
|
||||||
|
let btn: HTMLButtonElement | undefined = $state();
|
||||||
|
let list: HTMLUListElement | undefined = $state();
|
||||||
|
const id = "menu-" + Math.random().toString(36).slice(2, 9);
|
||||||
|
|
||||||
|
const nodes = () => Array.from(list?.querySelectorAll<HTMLElement>('[role="menuitem"]') ?? []);
|
||||||
|
|
||||||
|
async function show(focus: "first" | "last" = "first") {
|
||||||
|
open = true;
|
||||||
|
await tick();
|
||||||
|
const n = nodes();
|
||||||
|
(focus === "first" ? n[0] : n[n.length - 1])?.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function close(back = true) {
|
||||||
|
open = false;
|
||||||
|
if (back) btn?.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
function key(e: KeyboardEvent) {
|
||||||
|
const n = nodes();
|
||||||
|
const i = n.indexOf(document.activeElement as HTMLElement);
|
||||||
|
if (e.key === "ArrowDown") { e.preventDefault(); n[(i + 1) % n.length]?.focus(); }
|
||||||
|
else if (e.key === "ArrowUp") { e.preventDefault(); n[(i - 1 + n.length) % n.length]?.focus(); }
|
||||||
|
else if (e.key === "Home") { e.preventDefault(); n[0]?.focus(); }
|
||||||
|
else if (e.key === "End") { e.preventDefault(); n[n.length - 1]?.focus(); }
|
||||||
|
else if (e.key === "Escape") { e.preventDefault(); close(); }
|
||||||
|
else if (e.key === "Tab") close(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pick(it: Item) {
|
||||||
|
if (it.reason) return;
|
||||||
|
// Focus back on More first: a dialog the item opens returns focus there when it closes
|
||||||
|
// (§2.9), not to a menu item that no longer exists.
|
||||||
|
close(true);
|
||||||
|
it.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
function outside(e: MouseEvent) {
|
||||||
|
if (open && !(e.target instanceof Node && (list?.contains(e.target) || btn?.contains(e.target)))) close(false);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:window onclick={outside} />
|
||||||
|
|
||||||
|
<div class="ia-menu-wrap">
|
||||||
|
<button bind:this={btn} type="button" class="ia-icon-btn" aria-label="More for {hostname}" aria-haspopup="menu"
|
||||||
|
aria-expanded={open} aria-controls={id}
|
||||||
|
onclick={() => (open ? close() : show())}
|
||||||
|
onkeydown={(e) => { if (e.key === "ArrowDown") { e.preventDefault(); show("first"); } else if (e.key === "ArrowUp") { e.preventDefault(); show("last"); } }}>
|
||||||
|
<Icon name="dots" />
|
||||||
|
</button>
|
||||||
|
{#if open}
|
||||||
|
<ul bind:this={list} class="ia-menu" role="menu" id={id} aria-label={hostname} tabindex="-1" onkeydown={key}>
|
||||||
|
{#each items as it (it.label)}
|
||||||
|
{#if it.divider}<li role="separator"><hr /></li>{/if}
|
||||||
|
<li role="none">
|
||||||
|
<button type="button" role="menuitem" tabindex="-1" class:danger={it.danger} aria-disabled={it.reason ? "true" : undefined} onclick={() => pick(it)}>
|
||||||
|
<Icon name={it.icon} />{it.label}
|
||||||
|
{#if it.reason}<span class="reason">{it.reason}</span>{/if}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,538 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §6 and §7: the add/edit panel, its validation on blur, Apply, and the progress and
|
||||||
|
// outcome of the apply it starts. Every decision comes from control; the form only carries it.
|
||||||
|
import { onDestroy, onMount } from "svelte";
|
||||||
|
import { Banner, Button, Details, Dialog, Icon, Segmented } from "@ianitor/ui";
|
||||||
|
import ApplyProgress from "./ApplyProgress.svelte";
|
||||||
|
import { ApiError, call, del, get, newKey, sentence } from "../lib/api";
|
||||||
|
import { app, changesBlocked, refresh, restoreLastKept, toast } from "../lib/app.svelte";
|
||||||
|
import { FINAL, follow } from "../lib/applies";
|
||||||
|
import { firstSentence } from "../lib/format";
|
||||||
|
import type { ApplyView, ErrorBody, HeaderRule, HostSpec } from "../lib/types";
|
||||||
|
|
||||||
|
let {
|
||||||
|
hostname,
|
||||||
|
resume,
|
||||||
|
prefill,
|
||||||
|
focusField,
|
||||||
|
onclose,
|
||||||
|
}: {
|
||||||
|
hostname?: string;
|
||||||
|
resume?: string;
|
||||||
|
prefill?: HostSpec | null;
|
||||||
|
focusField?: string;
|
||||||
|
onclose: () => void;
|
||||||
|
} = $props();
|
||||||
|
|
||||||
|
const site = $derived(app.overview?.site ?? null);
|
||||||
|
const signinOk = $derived(site?.forward_auth_configured ?? false);
|
||||||
|
|
||||||
|
// ---- the form
|
||||||
|
type Rule = { action: "set" | "remove"; name: string; kind: "value" | "secret"; value: string; secret: string };
|
||||||
|
let host = $state({
|
||||||
|
hostname: "",
|
||||||
|
upstreams: [""],
|
||||||
|
tls: "domi" as "domi" | "letsencrypt",
|
||||||
|
auth: "forward-auth" as "forward-auth" | "none",
|
||||||
|
websockets: true,
|
||||||
|
share_links: false,
|
||||||
|
device_certs: false,
|
||||||
|
access_log: "off" as "off" | "truncated",
|
||||||
|
hc: false,
|
||||||
|
hcPath: "/",
|
||||||
|
hcEvery: 30,
|
||||||
|
req: [] as Rule[],
|
||||||
|
resp: [] as Rule[],
|
||||||
|
});
|
||||||
|
let rev = $state<string | null>(null);
|
||||||
|
let more = $state(false);
|
||||||
|
let loading = $state(true);
|
||||||
|
let notFound = $state<string | null>(null);
|
||||||
|
let errors = $state<Record<string, ErrorBody>>({});
|
||||||
|
let touched = $state<Record<string, boolean>>({});
|
||||||
|
let summary = $state("");
|
||||||
|
let underFooter = $state("");
|
||||||
|
let conflict = $state<ErrorBody | null>(null);
|
||||||
|
let topError = $state<ApiError | null>(null);
|
||||||
|
let idem = newKey();
|
||||||
|
let lastBody = "";
|
||||||
|
|
||||||
|
// ---- the apply
|
||||||
|
let apply = $state<ApplyView | null>(null);
|
||||||
|
let restoring = $state(false);
|
||||||
|
let restoreProblem = $state<string | null>(null);
|
||||||
|
let phase = $state<"form" | "progress">("form");
|
||||||
|
let stop: (() => void) | undefined;
|
||||||
|
let closeTimer: ReturnType<typeof setTimeout> | undefined;
|
||||||
|
|
||||||
|
function fromSpec(s: HostSpec) {
|
||||||
|
host.hostname = s.hostname;
|
||||||
|
host.upstreams = s.upstreams.length ? [...s.upstreams] : [""];
|
||||||
|
host.tls = s.tls;
|
||||||
|
host.auth = s.auth;
|
||||||
|
host.websockets = s.websockets;
|
||||||
|
host.share_links = s.share_links;
|
||||||
|
host.device_certs = !!s.device_certs;
|
||||||
|
host.access_log = s.access_log;
|
||||||
|
host.hc = !!s.health_check;
|
||||||
|
host.hcPath = s.health_check?.path ?? "/";
|
||||||
|
host.hcEvery = s.health_check?.interval_secs ?? 30;
|
||||||
|
const rule = (r: HeaderRule): Rule => ({ action: r.action, name: r.name, kind: r.secret ? "secret" : "value", value: r.value ?? "", secret: r.secret ?? "" });
|
||||||
|
host.req = (s.request_headers ?? []).map(rule);
|
||||||
|
host.resp = (s.response_headers ?? []).map(rule);
|
||||||
|
if (host.hc || host.req.length || host.resp.length || !host.websockets || host.share_links || host.access_log !== "off" || host.device_certs) more = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function spec(): HostSpec {
|
||||||
|
const rules = (rs: Rule[]): HeaderRule[] =>
|
||||||
|
rs.map((r) =>
|
||||||
|
r.action === "remove"
|
||||||
|
? { action: "remove", name: r.name }
|
||||||
|
: r.kind === "secret"
|
||||||
|
? { action: "set", name: r.name, secret: r.secret }
|
||||||
|
: { action: "set", name: r.name, value: r.value },
|
||||||
|
);
|
||||||
|
// The UI always sends every field explicitly (the schema's own defaults differ).
|
||||||
|
return {
|
||||||
|
hostname: host.hostname.trim(),
|
||||||
|
upstreams: host.upstreams.map((u) => u.trim()).filter((u, i) => u !== "" || i === 0),
|
||||||
|
tls: host.tls,
|
||||||
|
auth: host.auth,
|
||||||
|
websockets: host.websockets,
|
||||||
|
share_links: host.share_links,
|
||||||
|
device_certs: host.device_certs,
|
||||||
|
access_log: host.access_log,
|
||||||
|
health_check: host.hc ? { path: host.hcPath, interval_secs: Number(host.hcEvery) } : null,
|
||||||
|
request_headers: rules(host.req),
|
||||||
|
response_headers: rules(host.resp),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(async () => {
|
||||||
|
if (resume) {
|
||||||
|
phase = "progress";
|
||||||
|
stop = follow(resume, onApply);
|
||||||
|
}
|
||||||
|
if (prefill) {
|
||||||
|
fromSpec(prefill);
|
||||||
|
} else if (hostname) {
|
||||||
|
try {
|
||||||
|
const d = await get<{ host: HostSpec; rev: string }>(`/hosts/${encodeURIComponent(hostname)}`);
|
||||||
|
fromSpec(d.host);
|
||||||
|
rev = d.rev;
|
||||||
|
} catch (e) {
|
||||||
|
notFound = sentence(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rev = app.overview?.rev ?? null;
|
||||||
|
if (!signinOk) host.auth = "none";
|
||||||
|
}
|
||||||
|
// A form saved before this tab went to sign in comes back (App.svelte, signIn).
|
||||||
|
try {
|
||||||
|
const raw = sessionStorage.getItem(DRAFT);
|
||||||
|
const d = raw ? (JSON.parse(raw) as { hostname: string; host: typeof host }) : null;
|
||||||
|
if (d && d.hostname === (hostname ?? "") && !resume) {
|
||||||
|
Object.assign(host, d.host);
|
||||||
|
more = more || d.host.hc || d.host.req.length > 0 || d.host.resp.length > 0;
|
||||||
|
}
|
||||||
|
sessionStorage.removeItem(DRAFT);
|
||||||
|
} catch {
|
||||||
|
/* no storage: nothing to bring back */
|
||||||
|
}
|
||||||
|
loading = false;
|
||||||
|
if (phase === "form") {
|
||||||
|
// The Dialog focused its heading while this said "Loading…": now the first field
|
||||||
|
// (Hostname; Send traffic to when editing), so typing right after opening works.
|
||||||
|
const f = focusField ?? (hostname ? "upstreams[0]" : "hostname");
|
||||||
|
if (f.startsWith("health_check")) more = true;
|
||||||
|
setTimeout(() => document.getElementById(fieldId(f))?.focus(), 0);
|
||||||
|
}
|
||||||
|
window.addEventListener("ianitor:save-draft", saveDraft);
|
||||||
|
});
|
||||||
|
|
||||||
|
const DRAFT = "ianitor-draft";
|
||||||
|
function saveDraft() {
|
||||||
|
if (phase !== "form") return;
|
||||||
|
try {
|
||||||
|
sessionStorage.setItem(DRAFT, JSON.stringify({ hostname: hostname ?? "", host: $state.snapshot(host) }));
|
||||||
|
} catch {
|
||||||
|
/* no storage */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onDestroy(() => {
|
||||||
|
stop?.();
|
||||||
|
clearTimeout(closeTimer);
|
||||||
|
if (typeof window !== "undefined") window.removeEventListener("ianitor:save-draft", saveDraft);
|
||||||
|
});
|
||||||
|
|
||||||
|
function fieldId(f: string): string {
|
||||||
|
return "f-" + f.replace(/[^a-z0-9]+/gi, "-");
|
||||||
|
}
|
||||||
|
const errAt = (f: string) => errors[f];
|
||||||
|
|
||||||
|
function setErrors(list: ErrorBody[], only?: string) {
|
||||||
|
const next: Record<string, ErrorBody> = only ? { ...errors } : {};
|
||||||
|
if (only) {
|
||||||
|
for (const k of Object.keys(next)) if (k === only || k.startsWith(only + "[")) delete next[k];
|
||||||
|
}
|
||||||
|
for (const e of list) {
|
||||||
|
const f = e.field ?? "";
|
||||||
|
if (!f) continue;
|
||||||
|
if (only && !(f === only || f.startsWith(only + "["))) continue;
|
||||||
|
next[f] = e;
|
||||||
|
}
|
||||||
|
errors = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validation on blur (§2.10): only the field that lost focus, debounced.
|
||||||
|
let blurTimer: ReturnType<typeof setTimeout> | undefined;
|
||||||
|
function blur(field: string) {
|
||||||
|
touched[field] = true;
|
||||||
|
clearTimeout(blurTimer);
|
||||||
|
blurTimer = setTimeout(async () => {
|
||||||
|
try {
|
||||||
|
await call("POST", `/hosts/validate?mode=${hostname ? "edit" : "create"}`, spec());
|
||||||
|
setErrors([], field);
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof ApiError) setErrors(e.errors.length ? e.errors : [e.body], field);
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submit(e?: Event) {
|
||||||
|
e?.preventDefault();
|
||||||
|
if (changesBlocked()) return;
|
||||||
|
const body = spec();
|
||||||
|
const text = JSON.stringify(body);
|
||||||
|
if (text !== lastBody) {
|
||||||
|
idem = newKey();
|
||||||
|
lastBody = text;
|
||||||
|
}
|
||||||
|
underFooter = "";
|
||||||
|
conflict = null;
|
||||||
|
topError = null;
|
||||||
|
try {
|
||||||
|
const path = hostname ? `/hosts/${encodeURIComponent(hostname)}` : "/hosts";
|
||||||
|
const a = await call<{ apply: ApplyView }>(hostname ? "PUT" : "POST", path, { host: body, base_rev: rev }, { idem });
|
||||||
|
const ap = a.data?.apply;
|
||||||
|
if (!ap) return;
|
||||||
|
apply = ap;
|
||||||
|
phase = "progress";
|
||||||
|
stop?.();
|
||||||
|
stop = follow(ap.id, onApply);
|
||||||
|
} catch (err) {
|
||||||
|
if (!(err instanceof ApiError)) {
|
||||||
|
topError = null;
|
||||||
|
underFooter = sentence(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (err.code === "change.conflict") {
|
||||||
|
conflict = err.body;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (err.code === "change.unchanged") {
|
||||||
|
underFooter = "This is the same as what is live now, so nothing changed.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const list = err.errors.length ? err.errors : err.body.field ? [err.body] : [];
|
||||||
|
if (list.length) {
|
||||||
|
setErrors(list);
|
||||||
|
for (const x of list) if (x.field) touched[x.field] = true;
|
||||||
|
summary = `${list.length} ${list.length === 1 ? "thing" : "things"} to fix before Apply.`;
|
||||||
|
const first = list.find((x) => x.field)?.field;
|
||||||
|
if (first?.startsWith("health_check") || first?.includes("headers")) more = true;
|
||||||
|
if (first) setTimeout(() => document.getElementById(fieldId(first))?.focus(), 0);
|
||||||
|
} else {
|
||||||
|
topError = err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onApply(a: ApplyView) {
|
||||||
|
apply = a;
|
||||||
|
if (a.state === "kept") {
|
||||||
|
if (a.kind !== "remove") app.focusHost = a.hosts[0] ?? null;
|
||||||
|
closeTimer = setTimeout(() => onclose(), 1500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function cancelQueued() {
|
||||||
|
if (!apply) return;
|
||||||
|
try {
|
||||||
|
await del(`/applies/${encodeURIComponent(apply.id)}`);
|
||||||
|
toast("Cancelled before it started. Nothing changed.");
|
||||||
|
stop?.();
|
||||||
|
phase = "form";
|
||||||
|
apply = null;
|
||||||
|
} catch (e) {
|
||||||
|
underFooter = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function editAgain(field?: string) {
|
||||||
|
stop?.();
|
||||||
|
phase = "form";
|
||||||
|
apply = null;
|
||||||
|
idem = newKey();
|
||||||
|
const f = field ?? "upstreams[0]";
|
||||||
|
if (f.startsWith("health_check")) {
|
||||||
|
more = true;
|
||||||
|
host.hc = true;
|
||||||
|
}
|
||||||
|
setTimeout(() => document.getElementById(fieldId(f))?.focus(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function keepMine() {
|
||||||
|
if (!hostname) {
|
||||||
|
rev = app.overview?.rev ?? rev;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
const d = await get<{ host: HostSpec; rev: string }>(`/hosts/${encodeURIComponent(hostname)}`);
|
||||||
|
rev = d.rev;
|
||||||
|
} catch {
|
||||||
|
/* keep the old rev */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await refresh();
|
||||||
|
if (!hostname) rev = app.overview?.rev ?? rev;
|
||||||
|
conflict = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function useTheirs() {
|
||||||
|
if (!hostname) return;
|
||||||
|
const d = await get<{ host: HostSpec; rev: string }>(`/hosts/${encodeURIComponent(hostname)}`);
|
||||||
|
fromSpec(d.host);
|
||||||
|
rev = d.rev;
|
||||||
|
conflict = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const name = $derived(host.hostname.trim() || hostname || "the host");
|
||||||
|
const heading = $derived.by(() => {
|
||||||
|
if (phase !== "progress" || !apply) return hostname ? `Edit ${hostname}` : "New host";
|
||||||
|
const h = apply.hosts[0] ?? name;
|
||||||
|
switch (apply.kind) {
|
||||||
|
case "add":
|
||||||
|
return `Adding ${h}`;
|
||||||
|
case "remove":
|
||||||
|
return `Removing ${h}`;
|
||||||
|
case "share_links":
|
||||||
|
return `Turning on share links for ${h}`;
|
||||||
|
case "undo":
|
||||||
|
return `Undoing: ${apply.summary.replace(/^Undid: /, "")}`;
|
||||||
|
case "restore":
|
||||||
|
return apply.summary.replace(/^Restored /, "Restoring ");
|
||||||
|
default:
|
||||||
|
return `Changing ${h}`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const reasonOffer = $derived.by(() => {
|
||||||
|
const c = apply?.reason?.code ?? "";
|
||||||
|
if (/apply\.reverted\.(not_found|redirect|sign_in)$/.test(c)) return { label: "Edit health check", field: "health_check.path" };
|
||||||
|
if (/apply\.(interrupted|reverted\.edge_lost|interrupted\.queued)$/.test(c)) return { label: "Try again", field: "" };
|
||||||
|
if (c.startsWith("apply.reverted") || c === "apply.failed.validation" || c.startsWith("pki.")) return { label: "Edit and try again", field: apply?.reason?.field ?? undefined };
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
const blocked = $derived(changesBlocked());
|
||||||
|
const shareWarning = $derived(host.auth === "none" && host.share_links);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Dialog title={heading} kind="panel" {onclose}>
|
||||||
|
{#if loading}
|
||||||
|
<p class="ia-muted">Loading…</p>
|
||||||
|
{:else if notFound}
|
||||||
|
<Banner tone="notice" live="status">{#snippet title()}{notFound}{/snippet}
|
||||||
|
{#snippet actions()}<Button onclick={onclose}>Back to hosts</Button>{/snippet}
|
||||||
|
</Banner>
|
||||||
|
{:else if phase === "progress" && apply}
|
||||||
|
<div aria-live="polite" class="sr-only">
|
||||||
|
{#if apply.state === "queued"}Waiting for another change to finish.{:else if apply.state === "watching"}Watching health checks.{:else if apply.state === "kept"}Kept. {apply.reason?.message}{:else if apply.state === "reverted"}Reverted. {apply.reason?.message}{:else if apply.state === "failed"}Not applied. {apply.reason?.message}{/if}
|
||||||
|
</div>
|
||||||
|
<ApplyProgress {apply} oncancel={cancelQueued} />
|
||||||
|
{#if apply.state === "kept"}
|
||||||
|
<Banner tone="kept">
|
||||||
|
{#snippet title()}<span class="ia-status" data-s="kept"><span class="word">kept</span></span> <strong>{apply?.hosts[0] ?? name}</strong> {apply?.kind === "remove" ? "is removed." : "is live."}{/snippet}
|
||||||
|
{(apply.reason?.message ?? "").replace(/^\S+ is (live|removed)\.\s*/, "")}{#if apply.commit_short} Saved as commit {apply.commit_short}{apply.push?.state === "pushed" ? " and pushed to Gitea" : ""}.{/if}
|
||||||
|
</Banner>
|
||||||
|
{:else if apply.state === "reverted" || apply.state === "failed"}
|
||||||
|
{@const parts = firstSentence(apply.reason?.message ?? "")}
|
||||||
|
<Banner tone="notice" live="status">
|
||||||
|
{#snippet title()}<span class="ia-status" data-s="reverted"><span class="word">{apply?.state === "failed" ? "not applied" : "reverted"}</span></span> <strong>{parts[0]}</strong>{/snippet}
|
||||||
|
{#if parts[1]}Reason: {parts[1]}{/if}
|
||||||
|
{#snippet actions()}
|
||||||
|
{#if reasonOffer}
|
||||||
|
<Button variant="outline" onclick={() => (reasonOffer?.field === "" ? (editAgain(), submit()) : editAgain(reasonOffer?.field))}>{reasonOffer.label}</Button>
|
||||||
|
{/if}
|
||||||
|
{/snippet}
|
||||||
|
</Banner>
|
||||||
|
{#if apply.reason?.detail}<Details detail={apply.reason.detail} />{/if}
|
||||||
|
<p class="ia-hint">Your form is kept. History records the attempt as {apply.state === "failed" ? "not applied" : "reverted"}.</p>
|
||||||
|
{:else if apply.state === "needs_attention"}
|
||||||
|
<Banner tone="down" live="alert">{#snippet title()}<strong>Ianitor could not undo a failed change.</strong>{/snippet}{apply.reason?.message}
|
||||||
|
{#if restoreProblem}<p role="status">{restoreProblem}</p>{/if}
|
||||||
|
{#snippet actions()}
|
||||||
|
{#if app.overview?.undo?.target}<Button variant="primary" pending={restoring} onclick={async () => { restoring = true; restoreProblem = await restoreLastKept(); restoring = false; }}>Restore the last kept version</Button>{/if}
|
||||||
|
{/snippet}
|
||||||
|
</Banner>
|
||||||
|
{/if}
|
||||||
|
{:else}
|
||||||
|
<form id="host-form" onsubmit={submit} novalidate>
|
||||||
|
{#if summary}<p class="sr-only" role="alert">{summary}</p>{/if}
|
||||||
|
{#if conflict}
|
||||||
|
<Banner tone="notice" live="status">
|
||||||
|
{#snippet title()}{conflict?.message}{/snippet}
|
||||||
|
{#snippet actions()}<Button onclick={keepMine}>Keep my edits</Button>{#if hostname}<Button onclick={useTheirs}>Use the new version</Button>{/if}{/snippet}
|
||||||
|
</Banner>
|
||||||
|
{/if}
|
||||||
|
{#if topError}
|
||||||
|
<Banner tone="notice" live="status">{#snippet title()}{sentence(topError)}{/snippet}</Banner>
|
||||||
|
{#if topError.body.detail}<Details detail={topError.body.detail} reference={topError.requestId} />{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="domi-field">
|
||||||
|
<label class="domi-field-label" for={fieldId("hostname")}>Hostname</label>
|
||||||
|
<input id={fieldId("hostname")} class="domi-input" bind:value={host.hostname} readonly={!!hostname}
|
||||||
|
autocapitalize="none" spellcheck="false" inputmode="url" autocomplete="off"
|
||||||
|
aria-invalid={errAt("hostname") && touched["hostname"] ? "true" : undefined}
|
||||||
|
aria-describedby="{fieldId('hostname')}-e {fieldId('hostname')}-h" onblur={() => blur("hostname")} />
|
||||||
|
{#if errAt("hostname") && touched["hostname"]}
|
||||||
|
<p class="domi-error" id="{fieldId('hostname')}-e"><Icon name="ring" />{errAt("hostname").message}
|
||||||
|
{#if errAt("hostname").params?.suggestion}
|
||||||
|
<button type="button" class="domi-btn link" onclick={() => { host.hostname = errAt("hostname").params.suggestion; blur("hostname"); }}>Use {errAt("hostname").params.suggestion}</button>
|
||||||
|
{/if}
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
{#if hostname}<p class="ia-hint" id="{fieldId('hostname')}-h">To use another address, add a new host and remove this one.</p>{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#each host.upstreams as _, i (i)}
|
||||||
|
{@const f = `upstreams[${i}]`}
|
||||||
|
{@const err = errAt(f) ?? (i === 0 ? errAt("upstreams") : undefined)}
|
||||||
|
<div class="domi-field">
|
||||||
|
{#if i === 0}<label class="domi-field-label" for={fieldId(f)}>Send traffic to</label>{/if}
|
||||||
|
<div class="row">
|
||||||
|
<input id={fieldId(f)} class="domi-input" bind:value={host.upstreams[i]} autocapitalize="none" spellcheck="false" inputmode="url" autocomplete="off"
|
||||||
|
aria-label={i === 0 ? undefined : `Also send traffic to, address ${i + 1}`}
|
||||||
|
aria-invalid={err && (touched[f] || touched["upstreams"]) ? "true" : undefined}
|
||||||
|
aria-describedby="{fieldId(f)}-e" onblur={() => blur(f)} />
|
||||||
|
{#if i > 0}<button type="button" class="ia-icon-btn" aria-label="Remove this address" onclick={() => host.upstreams.splice(i, 1)}><Icon name="trash" /></button>{/if}
|
||||||
|
</div>
|
||||||
|
{#if err && (touched[f] || touched["upstreams"])}
|
||||||
|
<p class="domi-error" id="{fieldId(f)}-e"><Icon name="ring" />{err.message}
|
||||||
|
{#if err.params?.suggestion}<button type="button" class="domi-btn link" onclick={() => { host.upstreams[i] = err.params.suggestion; blur(f); }}>Use {err.params.suggestion}</button>{/if}
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
{#if i === 0 && host.upstreams.length === 1}<p class="ia-hint">Add another address later for a second server.</p>{/if}
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
<div><button type="button" class="domi-btn link" onclick={() => host.upstreams.push("")}>Add another address</button></div>
|
||||||
|
|
||||||
|
<Segmented legend="Certificate" name="tls" bind:value={host.tls}
|
||||||
|
options={[{ value: "domi", label: "Domi certificate" }, { value: "letsencrypt", label: "Let's Encrypt" }]} />
|
||||||
|
<p class="ia-hint">Domi for home devices only; Let's Encrypt for a public site.</p>
|
||||||
|
|
||||||
|
<Segmented legend="Who can open it" name="auth" bind:value={host.auth} disabled={signinOk ? [] : ["forward-auth"]}
|
||||||
|
options={[{ value: "forward-auth", label: "Sign in first" }, { value: "none", label: "Anyone" }]} />
|
||||||
|
{#if !signinOk}<p class="ia-hint">Sign-in is not set up on this server yet, so choose Anyone for now. To set it up, add the Authelia address to ianitor.toml in the routes repository.</p>{/if}
|
||||||
|
{#if errAt("auth")}<p class="domi-error"><Icon name="ring" />{errAt("auth").message}</p>{/if}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button type="button" class="domi-btn link" aria-expanded={more} aria-controls="more-options" onclick={() => (more = !more)}>
|
||||||
|
More options: headers, websockets, health check, share links, visit log
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{#if more}
|
||||||
|
<div id="more-options" class="more">
|
||||||
|
<div class="domi-field">
|
||||||
|
<span class="domi-field-label">Health check</span>
|
||||||
|
<label class="ia-check"><input type="checkbox" bind:checked={host.hc} /> Check that it answers</label>
|
||||||
|
<p class="ia-hint">Ianitor asks this address regularly and shows the result on the main screen.</p>
|
||||||
|
</div>
|
||||||
|
{#if host.hc}
|
||||||
|
<div class="domi-field">
|
||||||
|
<label class="domi-field-label" for={fieldId("health_check.path")}>Health check address</label>
|
||||||
|
<input id={fieldId("health_check.path")} class="domi-input" bind:value={host.hcPath} aria-invalid={errAt("health_check.path") ? "true" : undefined} onblur={() => blur("health_check.path")} />
|
||||||
|
{#if errAt("health_check.path")}<p class="domi-error"><Icon name="ring" />{errAt("health_check.path").message}</p>{/if}
|
||||||
|
<p class="ia-hint">Use an address that answers without signing in, like /health.</p>
|
||||||
|
</div>
|
||||||
|
<div class="domi-field">
|
||||||
|
<label class="domi-field-label" for={fieldId("health_check.interval_secs")}>Checks every</label>
|
||||||
|
<div class="row"><input id={fieldId("health_check.interval_secs")} class="domi-input narrow" type="number" min="1" max="3600" bind:value={host.hcEvery} onblur={() => blur("health_check.interval_secs")} /> <span class="ia-text2">seconds</span></div>
|
||||||
|
{#if errAt("health_check.interval_secs")}<p class="domi-error"><Icon name="ring" />{errAt("health_check.interval_secs").message}</p>{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
<div class="domi-field">
|
||||||
|
<span class="domi-field-label">Websockets</span>
|
||||||
|
<label class="ia-check"><input type="checkbox" bind:checked={host.websockets} /> Allow websockets</label>
|
||||||
|
<p class="ia-hint">Live updates for apps like Home Assistant. Leave on unless you know the app does not need them.</p>
|
||||||
|
</div>
|
||||||
|
<div class="domi-field">
|
||||||
|
<span class="domi-field-label">Share links</span>
|
||||||
|
<label class="ia-check"><input type="checkbox" bind:checked={host.share_links} /> Allow share links</label>
|
||||||
|
<p class="ia-hint">Lets you make links that open this host without signing in, until they expire.</p>
|
||||||
|
{#if shareWarning}<p class="ia-hint">Anyone can already open {name}, so a share link changes nothing.</p>{/if}
|
||||||
|
</div>
|
||||||
|
<div class="domi-field">
|
||||||
|
<span class="domi-field-label">Device certificates</span>
|
||||||
|
<label class="ia-check"><input type="checkbox" bind:checked={host.device_certs} /> Only devices with a Domi device certificate</label>
|
||||||
|
<p class="ia-hint">Phones, computers and apps need a certificate from Certificates before they can open it.</p>
|
||||||
|
</div>
|
||||||
|
<Segmented legend="Visit log" name="access_log" bind:value={host.access_log} options={[{ value: "off", label: "Off" }, { value: "truncated", label: "On" }]} />
|
||||||
|
<p class="ia-hint">On keeps a log on this server, with visitor addresses shortened.</p>
|
||||||
|
{#each [{ list: "request_headers", rules: host.req, title: "Header rules sent to your service", secrets: true }, { list: "response_headers", rules: host.resp, title: "Header rules sent back to visitors", secrets: false }] as group (group.list)}
|
||||||
|
<div class="domi-field">
|
||||||
|
<span class="domi-field-label">{group.title}</span>
|
||||||
|
{#each group.rules as r, i (i)}
|
||||||
|
{@const p = `${group.list}[${i}]`}
|
||||||
|
<div class="rule ia-card">
|
||||||
|
<Segmented legend="Rule {i + 1}" name="{p}-action" bind:value={r.action} options={[{ value: "set", label: "Set" }, { value: "remove", label: "Remove" }]} />
|
||||||
|
<label class="domi-field-label" for={fieldId(p + ".name")}>Header name</label>
|
||||||
|
<input id={fieldId(p + ".name")} class="domi-input" bind:value={r.name} onblur={() => blur(p + ".name")} />
|
||||||
|
{#if r.action === "set"}
|
||||||
|
{#if group.secrets}
|
||||||
|
<Segmented legend="Value" name="{p}-kind" bind:value={r.kind} disabled={(site?.secrets.length ?? 0) === 0 ? ["secret"] : []} options={[{ value: "value", label: "Fixed value" }, { value: "secret", label: "Secret" }]} />
|
||||||
|
{/if}
|
||||||
|
{#if r.kind === "secret" && group.secrets}
|
||||||
|
<select class="domi-input" bind:value={r.secret} aria-label="Secret">
|
||||||
|
{#each site?.secrets ?? [] as s (s)}<option value={s}>{s}</option>{/each}
|
||||||
|
</select>
|
||||||
|
{:else}
|
||||||
|
<input class="domi-input" bind:value={r.value} aria-label="Value" onblur={() => blur(p + ".value")} />
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
{#each Object.entries(errors).filter(([k]) => k.startsWith(p)) as [, e] (e.code + e.field)}<p class="domi-error"><Icon name="ring" />{e.message}</p>{/each}
|
||||||
|
<button type="button" class="ia-icon-btn" aria-label="Remove this rule" onclick={() => group.rules.splice(i, 1)}><Icon name="trash" /></button>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
<div><button type="button" class="domi-btn link" onclick={() => group.rules.push({ action: "set", name: "", kind: "value", value: "", secret: site?.secrets[0] ?? "" })}>Add a rule</button></div>
|
||||||
|
{#if group.secrets && (site?.secrets.length ?? 0) === 0}<p class="ia-hint">No secrets are listed in ianitor.toml.</p>{/if}
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</form>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#snippet footer()}
|
||||||
|
{#if phase === "form" && !loading && !notFound}
|
||||||
|
{#if underFooter}<p class="ia-hint full" role="status">{underFooter}</p>{/if}
|
||||||
|
{#if blocked}<p class="ia-hint full" id="apply-blocked">{blocked}</p>{/if}
|
||||||
|
<Button onclick={onclose}>Cancel</Button>
|
||||||
|
<Button variant="primary" type="submit" form="host-form" disabled={!!blocked} describedby={blocked ? "apply-blocked" : undefined}>Apply</Button>
|
||||||
|
{:else if phase === "progress" && apply && FINAL.includes(apply.state)}
|
||||||
|
<Button onclick={onclose}>Close</Button>
|
||||||
|
{/if}
|
||||||
|
{/snippet}
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
form { display: flex; flex-direction: column; gap: 16px; }
|
||||||
|
.row { display: flex; gap: 8px; align-items: center; }
|
||||||
|
.more { display: flex; flex-direction: column; gap: 16px; }
|
||||||
|
.rule { display: flex; flex-direction: column; gap: 8px; }
|
||||||
|
.narrow { max-width: 8rem; }
|
||||||
|
.full { flex-basis: 100%; }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §13.5: the intermediate banner. Renew is 1 click; the banner then shows the match
|
||||||
|
// code. Until Custos can sign (docs/custos-ticket.md) the request is signed by hand offline,
|
||||||
|
// so the waiting banner links to that page.
|
||||||
|
import { Banner, Button } from "@ianitor/ui";
|
||||||
|
import { del, post, sentence } from "../lib/api";
|
||||||
|
import { app, navigate, refresh, secondsLeft } from "../lib/app.svelte";
|
||||||
|
import { duration, longDate } from "../lib/format";
|
||||||
|
import type { PkiRequest } from "../lib/types";
|
||||||
|
|
||||||
|
const i = $derived(app.overview?.intermediate ?? null);
|
||||||
|
let pending = $state(false);
|
||||||
|
let problem = $state<string | null>(null);
|
||||||
|
|
||||||
|
async function renew() {
|
||||||
|
pending = true;
|
||||||
|
problem = null;
|
||||||
|
try {
|
||||||
|
await post<PkiRequest>("/certs/intermediate/renewal");
|
||||||
|
await refresh();
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
} finally {
|
||||||
|
pending = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function cancel(id: string) {
|
||||||
|
try {
|
||||||
|
await del(`/pki-requests/${encodeURIComponent(id)}`);
|
||||||
|
await refresh();
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if app.renewedUntil}
|
||||||
|
<Banner tone="kept" live="status" ondismiss={() => (app.renewedUntil = null)}>
|
||||||
|
{#snippet title()}Renewed. The Domi intermediate certificate is now valid until {longDate(app.renewedUntil, false)}.{/snippet}
|
||||||
|
</Banner>
|
||||||
|
{:else if i?.renewal}
|
||||||
|
{@const r = i.renewal}
|
||||||
|
<Banner tone="notice" label="Domi intermediate certificate">
|
||||||
|
{#snippet title()}
|
||||||
|
<span tabindex="-1">Sign the renewal on the offline computer. The next page has the files, the command and a fingerprint to check.</span>
|
||||||
|
{/snippet}
|
||||||
|
The request stays open for {duration(secondsLeft(r.expires_at))}. {#if problem}{problem}{/if}
|
||||||
|
{#snippet actions()}
|
||||||
|
<Button variant="outline" onclick={() => navigate("/certificates/renew-by-hand")}>Sign it by hand</Button>
|
||||||
|
<Button onclick={() => cancel(r.request_id)}>Cancel request</Button>
|
||||||
|
{/snippet}
|
||||||
|
</Banner>
|
||||||
|
{:else if i?.banner}
|
||||||
|
<Banner tone={i.state === "due" ? "notice" : "down"} label="Domi intermediate certificate">
|
||||||
|
{#snippet title()}<strong>{i.banner?.message}</strong>{/snippet}
|
||||||
|
{i.state === "missing" ? "Setting it up makes a request that the Domi root signs on the offline computer." : "Renewing makes a request that the Domi root signs on the offline computer."}
|
||||||
|
{#if problem} {problem}{/if}
|
||||||
|
{#snippet actions()}<Button variant="outline" onclick={renew} {pending}>{i.state === "missing" ? "Set up" : "Renew"}</Button>{/snippet}
|
||||||
|
</Banner>
|
||||||
|
{/if}
|
||||||
|
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §8.2: mint on open (click 2), Copy link (click 3). Changing an option re-mints with
|
||||||
|
// `replaces`, so one link from this dialog is valid at a time; closing without copying stops it.
|
||||||
|
// Links off: "Turn on share links" applies the change, then Copy link (4 clicks: open
|
||||||
|
// question Q1 is not decided, so this is the fallback path the design allows).
|
||||||
|
import { onDestroy, onMount } from "svelte";
|
||||||
|
import { Banner, Button, Dialog, Icon, Segmented } from "@ianitor/ui";
|
||||||
|
import ApplyProgress from "./ApplyProgress.svelte";
|
||||||
|
import { ApiError, call, del, newKey, patch, sentence } from "../lib/api";
|
||||||
|
import { app } from "../lib/app.svelte";
|
||||||
|
import { follow } from "../lib/applies";
|
||||||
|
import { longDate } from "../lib/format";
|
||||||
|
import type { ApplyView, MintedLink } from "../lib/types";
|
||||||
|
|
||||||
|
let { hostname, onclose }: { hostname: string; onclose: () => void } = $props();
|
||||||
|
|
||||||
|
// Known before the Dialog mounts, so its focus lands on Copy link (§2.9), not the title.
|
||||||
|
// svelte-ignore state_referenced_locally
|
||||||
|
let on = $state(!!app.overview?.hosts.find((h) => h.hostname === hostname)?.share_links);
|
||||||
|
let link = $state<MintedLink | null>(null);
|
||||||
|
let minting = $state(false);
|
||||||
|
let copied = $state(false);
|
||||||
|
let copiedBefore = $state(false);
|
||||||
|
let refused = $state(false);
|
||||||
|
let problem = $state<string | null>(null);
|
||||||
|
let fieldErr = $state<{ field: string; message: string } | null>(null);
|
||||||
|
let days = $state<"1" | "7" | "30">("7");
|
||||||
|
let prefix = $state("/");
|
||||||
|
let showPassword = $state(false);
|
||||||
|
let password = $state("");
|
||||||
|
let usingPassword = $state(false);
|
||||||
|
let turning = $state<ApplyView | null>(null);
|
||||||
|
let stopFollow: (() => void) | undefined;
|
||||||
|
let secretBox: HTMLTextAreaElement | undefined = $state();
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
if (on) void mint();
|
||||||
|
});
|
||||||
|
onDestroy(() => stopFollow?.());
|
||||||
|
|
||||||
|
async function mint() {
|
||||||
|
minting = true;
|
||||||
|
problem = null;
|
||||||
|
fieldErr = null;
|
||||||
|
try {
|
||||||
|
const body: Record<string, unknown> = { path_prefix: prefix || "/", expires_in_s: Number(days) * 86400 };
|
||||||
|
if (usingPassword && password) body.password = password;
|
||||||
|
if (link) body.replaces = link.id;
|
||||||
|
const a = await call<MintedLink>("POST", `/hosts/${encodeURIComponent(hostname)}/share-links`, body, { idem: newKey() });
|
||||||
|
if (link && copied) copiedBefore = true;
|
||||||
|
link = a.data;
|
||||||
|
copied = false;
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof ApiError && e.body.field) {
|
||||||
|
fieldErr = { field: e.body.field, message: e.body.message };
|
||||||
|
if (e.body.field === "password") usingPassword = false;
|
||||||
|
}
|
||||||
|
else problem = sentence(e);
|
||||||
|
} finally {
|
||||||
|
minting = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copy() {
|
||||||
|
if (!link) return;
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(link.url);
|
||||||
|
copied = true;
|
||||||
|
refused = false;
|
||||||
|
} catch {
|
||||||
|
refused = true;
|
||||||
|
secretBox?.select();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function turnOn() {
|
||||||
|
try {
|
||||||
|
const a = await patch<{ apply: ApplyView }>(`/hosts/${encodeURIComponent(hostname)}`, { share_links: true, base_rev: app.overview?.rev ?? null });
|
||||||
|
turning = a.apply;
|
||||||
|
stopFollow = follow(a.apply.id, async (x) => {
|
||||||
|
turning = x;
|
||||||
|
if (x.state === "kept") {
|
||||||
|
on = true;
|
||||||
|
await mint();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
// A link nobody copied does not stay valid.
|
||||||
|
if (link && !copied) void del(`/share-links/${encodeURIComponent(link.id)}`, { keepalive: true }).catch(() => {});
|
||||||
|
onclose();
|
||||||
|
}
|
||||||
|
|
||||||
|
const underCaddy = $derived(app.overview?.engine.running === "caddy");
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Dialog title="Share {hostname}" onclose={close}>
|
||||||
|
{#if !on}
|
||||||
|
{#if turning}
|
||||||
|
<ApplyProgress apply={turning} />
|
||||||
|
{#if turning.state === "reverted" || turning.state === "failed"}
|
||||||
|
<Banner tone="notice" live="status">{#snippet title()}Share links were not turned on. {turning?.reason?.message}{/snippet}</Banner>
|
||||||
|
{/if}
|
||||||
|
{:else}
|
||||||
|
<p><strong>Share links are off for {hostname}.</strong></p>
|
||||||
|
<p class="ia-text2">Turning them on is a change to the host, checked like any other.</p>
|
||||||
|
{#if problem}<p class="domi-error" role="alert"><Icon name="ring" />{problem}</p>{/if}
|
||||||
|
<div><Button variant="outline" onclick={turnOn} disabled={!!app.overview?.paused}>Turn on share links</Button></div>
|
||||||
|
{/if}
|
||||||
|
{:else}
|
||||||
|
<p class="ia-text2">Anyone with this link can open the site without signing in, until it expires.</p>
|
||||||
|
{#if underCaddy}
|
||||||
|
<Banner tone="notice">{#snippet title()}Caddy is serving right now, so share links do not work: visitors with this link get the normal sign-in. The link works after switching back to Pingora, until it expires.{/snippet}</Banner>
|
||||||
|
{/if}
|
||||||
|
{#if link?.warning}<p class="ia-hint">{link.warning.message}</p>{/if}
|
||||||
|
{#if problem}<Banner tone="notice" live="status">{#snippet title()}{problem}{/snippet}</Banner>{/if}
|
||||||
|
{#if link}
|
||||||
|
<textarea bind:this={secretBox} class="ia-secret" readonly value={link.url} aria-label="Share link" onfocus={(e) => (e.currentTarget as HTMLTextAreaElement).select()}></textarea>
|
||||||
|
{:else if minting}
|
||||||
|
<p class="ia-muted">Making the link…</p>
|
||||||
|
{/if}
|
||||||
|
{#if copied}
|
||||||
|
<p class="ia-status" data-s="kept" role="status"><Icon name="check" /><span>Copied</span></p>
|
||||||
|
<p class="ia-hint">Expires on {longDate(link?.expires_at)}. To stop it sooner: Settings, Share links, Stop this link.</p>
|
||||||
|
{:else}
|
||||||
|
<Button variant="primary" full icon="copy" onclick={copy} disabled={!link || minting} data-autofocus>Copy link</Button>
|
||||||
|
{/if}
|
||||||
|
{#if refused}<p class="ia-hint" role="alert">Your browser did not allow copying. Press Ctrl+C to copy the selected link.</p>{/if}
|
||||||
|
{#if copiedBefore && !copied}<p class="ia-hint">The link you copied before is stopped. Copy this one.</p>{/if}
|
||||||
|
|
||||||
|
<Segmented legend="Expires after" name="expiry" bind:value={days} onchange={() => mint()}
|
||||||
|
options={[{ value: "1", label: "1 day" }, { value: "7", label: "7 days" }, { value: "30", label: "30 days" }]} />
|
||||||
|
<div class="domi-field">
|
||||||
|
<label class="domi-field-label" for="share-prefix">Only addresses starting with</label>
|
||||||
|
<input id="share-prefix" class="domi-input" bind:value={prefix} onblur={() => mint()} onkeydown={(e) => { if (e.key === "Enter") { e.preventDefault(); void mint(); } }}
|
||||||
|
aria-invalid={fieldErr?.field === "path_prefix" ? "true" : undefined} />
|
||||||
|
{#if fieldErr?.field === "path_prefix"}<p class="domi-error"><Icon name="ring" />{fieldErr.message}</p>{/if}
|
||||||
|
<p class="ia-hint">/ shares the whole site. Try /share/summer-2026 for one album.</p>
|
||||||
|
</div>
|
||||||
|
{#if usingPassword}
|
||||||
|
<p class="ia-hint">This link asks for the password.</p>
|
||||||
|
<div><button type="button" class="domi-btn link" onclick={() => { usingPassword = false; password = ""; void mint(); }}>Remove the password</button></div>
|
||||||
|
{:else if showPassword}
|
||||||
|
<div class="domi-field">
|
||||||
|
<label class="domi-field-label" for="share-password">Password</label>
|
||||||
|
<input id="share-password" class="domi-input" type="password" autocomplete="new-password" bind:value={password}
|
||||||
|
aria-invalid={fieldErr?.field === "password" ? "true" : undefined} />
|
||||||
|
{#if fieldErr?.field === "password"}<p class="domi-error"><Icon name="ring" />{fieldErr.message}</p>{/if}
|
||||||
|
<p class="ia-hint">At least 8 characters. Send it to them separately.</p>
|
||||||
|
<div><Button onclick={() => { usingPassword = true; void mint(); }}>Use this password</Button></div>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div><button type="button" class="domi-btn link" onclick={() => (showPassword = true)}>Add a password</button></div>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
</Dialog>
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §2.8 order: paused / needs attention, lost contact, health unavailable, the Caddy
|
||||||
|
// notice, then (on Hosts) the intermediate banner. First on every screen.
|
||||||
|
import { Banner, Button, Details } from "@ianitor/ui";
|
||||||
|
import { app, refresh, restorable as canRestore, restoreLastKept } from "../lib/app.svelte";
|
||||||
|
import { atTime, whenInline } from "../lib/format";
|
||||||
|
|
||||||
|
const o = $derived(app.overview);
|
||||||
|
let restoring = $state(false);
|
||||||
|
let problem = $state<string | null>(null);
|
||||||
|
|
||||||
|
const restorable = $derived(canRestore());
|
||||||
|
|
||||||
|
async function restore() {
|
||||||
|
restoring = true;
|
||||||
|
problem = await restoreLastKept();
|
||||||
|
restoring = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// §7.6: the bold line and line 2 by the pause's underlying code.
|
||||||
|
const pause = $derived.by(() => {
|
||||||
|
const code = o?.paused_reason ?? "";
|
||||||
|
const message = o?.paused?.message ?? "";
|
||||||
|
if (code === "apply.needs_attention")
|
||||||
|
return { bold: "Ianitor could not undo a failed change.", line2: "Visitors are served the last good settings, but the routes repository still has the change. Restore the last kept version to make them match again.", extra: "" };
|
||||||
|
if (code === "control.files_unwritten")
|
||||||
|
return { bold: "The change is live, but Ianitor could not save the proxy settings to disk.", line2: "Changes are paused until Ianitor restarts and saves them. Restoring the last kept version also clears this.", extra: "On the server: sudo systemctl restart ianitor-control" };
|
||||||
|
// control.paused wraps the reason: "Changes are paused: <reason>"; show the reason itself.
|
||||||
|
const own = message.replace(/^Changes are paused: /, "");
|
||||||
|
if (/^(repo|file|site)\./.test(code))
|
||||||
|
return { bold: own, line2: `Fix the file in the ${o?.repo?.name ?? "routes"} repository; Ianitor picks it up by itself.`, extra: "" };
|
||||||
|
return { bold: own, line2: "", extra: "" };
|
||||||
|
});
|
||||||
|
|
||||||
|
// "Show details" for every pause (§7.6): the server's detail, the restart command, or the
|
||||||
|
// full message when there is nothing more.
|
||||||
|
const pauseDetail = $derived(
|
||||||
|
[o?.paused_detail, pause.extra].filter(Boolean).join("\n") || (o?.paused ? (o.paused.message ?? "") : ""),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
async function retry() {
|
||||||
|
await refresh();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if o?.paused}
|
||||||
|
<Banner tone="down" live="alert">
|
||||||
|
{#snippet title()}<span class="ia-status" data-s="down"><span class="word">{o.paused_reason === "apply.needs_attention" ? "needs attention" : "paused"}</span></span> <strong>{pause.bold}</strong>{/snippet}
|
||||||
|
{#if pause.line2}<span class="line2">{pause.line2}</span>{/if}
|
||||||
|
{#if restorable && o.undo?.target}<p class="ia-hint">Goes back to "{o.undo.target.summary}" from {whenInline(o.undo.target.kept_at, app.now)}. It is checked like any change.</p>{/if}
|
||||||
|
{#if problem}<p role="status">{problem}</p>{/if}
|
||||||
|
{#if pauseDetail}<Details detail={pauseDetail} />{/if}
|
||||||
|
{#snippet actions()}
|
||||||
|
{#if restorable}<Button variant="primary" onclick={restore} pending={restoring}>Restore the last kept version</Button>{/if}
|
||||||
|
{/snippet}
|
||||||
|
</Banner>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if app.lostContact}
|
||||||
|
<Banner tone="down" live="alert">
|
||||||
|
{#snippet title()}<strong>{typeof navigator !== "undefined" && navigator.onLine === false ? "This device is offline. Ianitor keeps running." : "Ianitor's control service is not answering."}</strong>{/snippet}
|
||||||
|
Traffic keeps flowing; changes wait until it is back.{#if app.lastUpdated} Last updated {atTime(new Date(app.lastUpdated).toISOString(), app.now)}.{/if}
|
||||||
|
{#snippet actions()}<Button onclick={retry}>Try again now</Button>{/snippet}
|
||||||
|
</Banner>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if o?.health_error}
|
||||||
|
<Banner tone="notice">{#snippet title()}{o.health_error?.message}{/snippet}</Banner>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if app.switchResult}
|
||||||
|
{@const r = app.switchResult}
|
||||||
|
<Banner tone={r.ok ? "kept" : "down"} live="status" ondismiss={() => (app.switchResult = null)}>
|
||||||
|
{#snippet title()}<strong>{r.title}</strong>{/snippet}
|
||||||
|
{r.text}
|
||||||
|
{#if r.detail}<Details detail={r.detail} />{/if}
|
||||||
|
</Banner>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if o?.engine.running === "caddy" && (o.hosts.some((h) => h.share_links) ?? false)}
|
||||||
|
<Banner tone="notice">{#snippet title()}Caddy is serving (the fallback), so share links do not work until you switch back.{/snippet}</Banner>
|
||||||
|
{/if}
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The one typed API client (handoff §0, §10, §11). It owns the base path, the UI header (CSRF),
|
||||||
|
// redirect: "manual" (sign-out detection), Idempotency-Keys, the error envelope, the server
|
||||||
|
// clock offset, rate-limit and in-progress retries, and lost-contact detection. It decides
|
||||||
|
// nothing about the data.
|
||||||
|
|
||||||
|
import type { ErrorBody, ErrorEnvelope } from "./types";
|
||||||
|
|
||||||
|
export const BASE = "/api/v1";
|
||||||
|
|
||||||
|
/** A refusal from control, with its envelope. */
|
||||||
|
export class ApiError extends Error {
|
||||||
|
constructor(
|
||||||
|
public status: number,
|
||||||
|
public body: ErrorBody,
|
||||||
|
public errors: ErrorBody[],
|
||||||
|
public requestId: string,
|
||||||
|
) {
|
||||||
|
super(body.message);
|
||||||
|
}
|
||||||
|
get code(): string {
|
||||||
|
return this.body.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Authelia's portal redirect, or a 401 without Ianitor's envelope. */
|
||||||
|
export class SignedOut extends Error {}
|
||||||
|
|
||||||
|
/** No answer (network, or a proxy error without an envelope). */
|
||||||
|
export class LostContact extends Error {}
|
||||||
|
|
||||||
|
type Listener = () => void;
|
||||||
|
|
||||||
|
export interface ClientEvents {
|
||||||
|
onSignedOut?: Listener;
|
||||||
|
onContact?: (ok: boolean) => void;
|
||||||
|
onServerTime?: (offsetMs: number) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
let events: ClientEvents = {};
|
||||||
|
export function setClientEvents(e: ClientEvents): void {
|
||||||
|
events = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A key for one click; reused by every retry of that click (§11.3). */
|
||||||
|
export function newKey(): string {
|
||||||
|
if (typeof crypto !== "undefined" && "randomUUID" in crypto) return crypto.randomUUID();
|
||||||
|
return Math.random().toString(36).slice(2) + Date.now().toString(36);
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CallOptions {
|
||||||
|
idem?: string;
|
||||||
|
etag?: string;
|
||||||
|
/** Do not count a failure as lost contact (engine switch, §9.2). */
|
||||||
|
quiet?: boolean;
|
||||||
|
keepalive?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Answer<T> {
|
||||||
|
status: number;
|
||||||
|
data: T | null;
|
||||||
|
etag: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
||||||
|
|
||||||
|
function envelope(v: unknown): v is ErrorEnvelope {
|
||||||
|
return typeof v === "object" && v !== null && "error" in v && typeof (v as ErrorEnvelope).error === "object";
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function call<T>(
|
||||||
|
method: string,
|
||||||
|
path: string,
|
||||||
|
body?: unknown,
|
||||||
|
opts: CallOptions = {},
|
||||||
|
): Promise<Answer<T>> {
|
||||||
|
let rateRetried = false;
|
||||||
|
for (let attempt = 0; attempt < 12; attempt++) {
|
||||||
|
const headers: Record<string, string> = { "X-Ianitor-UI": "1", Accept: "application/json" };
|
||||||
|
if (body !== undefined) headers["Content-Type"] = "application/json";
|
||||||
|
if (opts.idem) headers["Idempotency-Key"] = opts.idem;
|
||||||
|
if (opts.etag) headers["If-None-Match"] = opts.etag;
|
||||||
|
let res: Response;
|
||||||
|
try {
|
||||||
|
res = await fetch(BASE + path, {
|
||||||
|
method,
|
||||||
|
headers,
|
||||||
|
body: body === undefined ? undefined : JSON.stringify(body),
|
||||||
|
redirect: "manual",
|
||||||
|
credentials: "same-origin",
|
||||||
|
keepalive: opts.keepalive,
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
if (!opts.quiet) events.onContact?.(false);
|
||||||
|
throw new LostContact("no answer");
|
||||||
|
}
|
||||||
|
if (res.type === "opaqueredirect" || (res.status >= 300 && res.status < 400 && res.status !== 304)) {
|
||||||
|
events.onSignedOut?.();
|
||||||
|
throw new SignedOut("signed out");
|
||||||
|
}
|
||||||
|
if (res.status === 304) {
|
||||||
|
events.onContact?.(true);
|
||||||
|
return { status: 304, data: null, etag: opts.etag ?? null };
|
||||||
|
}
|
||||||
|
let json: unknown = null;
|
||||||
|
const text = await res.text();
|
||||||
|
try {
|
||||||
|
json = text ? JSON.parse(text) : null;
|
||||||
|
} catch {
|
||||||
|
json = null;
|
||||||
|
}
|
||||||
|
if (json && typeof json === "object" && "server_time" in json) {
|
||||||
|
const t = Date.parse(String((json as { server_time: string }).server_time));
|
||||||
|
if (!Number.isNaN(t)) events.onServerTime?.(t - Date.now());
|
||||||
|
}
|
||||||
|
if (!envelope(json)) {
|
||||||
|
if (res.status === 401) {
|
||||||
|
events.onSignedOut?.();
|
||||||
|
throw new SignedOut("signed out");
|
||||||
|
}
|
||||||
|
if (res.status >= 502 && res.status <= 504) {
|
||||||
|
if (!opts.quiet) events.onContact?.(false);
|
||||||
|
throw new LostContact(`proxy answered ${res.status}`);
|
||||||
|
}
|
||||||
|
events.onContact?.(true);
|
||||||
|
return { status: res.status, data: json as T, etag: res.headers.get("ETag") };
|
||||||
|
}
|
||||||
|
events.onContact?.(true);
|
||||||
|
const env = json;
|
||||||
|
if (env.error.code === "request.in_progress") {
|
||||||
|
await sleep(1000);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (env.error.code === "rate.limited" && !rateRetried) {
|
||||||
|
rateRetried = true;
|
||||||
|
await sleep(Math.min(60, env.error.retry_after_s ?? 1) * 1000);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (res.status === 401 && env.error.code.startsWith("token.")) {
|
||||||
|
// The UI holds no token: a token refusal means the sign-in did not reach control.
|
||||||
|
events.onSignedOut?.();
|
||||||
|
throw new SignedOut(env.error.message);
|
||||||
|
}
|
||||||
|
throw new ApiError(res.status, env.error, env.errors ?? [], env.request_id ?? "");
|
||||||
|
}
|
||||||
|
throw new ApiError(
|
||||||
|
409,
|
||||||
|
{
|
||||||
|
code: "request.in_progress",
|
||||||
|
message: "The first request with this Idempotency-Key is still being handled. Try again in a moment.",
|
||||||
|
field: null,
|
||||||
|
params: {},
|
||||||
|
retry_after_s: 1,
|
||||||
|
detail: null,
|
||||||
|
},
|
||||||
|
[],
|
||||||
|
"",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export const get = <T>(path: string, opts?: CallOptions) => call<T>("GET", path, undefined, opts).then((a) => a.data as T);
|
||||||
|
export const post = <T>(path: string, body: unknown = {}, opts?: CallOptions) =>
|
||||||
|
call<T>("POST", path, body, { idem: newKey(), ...opts }).then((a) => a.data as T);
|
||||||
|
export const put = <T>(path: string, body: unknown, opts?: CallOptions) =>
|
||||||
|
call<T>("PUT", path, body, { idem: newKey(), ...opts }).then((a) => a.data as T);
|
||||||
|
export const patch = <T>(path: string, body: unknown, opts?: CallOptions) =>
|
||||||
|
call<T>("PATCH", path, body, { idem: newKey(), ...opts }).then((a) => a.data as T);
|
||||||
|
export const del = (path: string, opts?: CallOptions) => call<unknown>("DELETE", path, undefined, opts).then(() => undefined);
|
||||||
|
|
||||||
|
/** A UI sentence for request.* codes (handoff §12.4): bugs or a stale page, not user mistakes. */
|
||||||
|
export function sentence(e: unknown): string {
|
||||||
|
if (e instanceof ApiError) {
|
||||||
|
if (e.code.startsWith("request.") && e.code !== "request.in_progress") {
|
||||||
|
return "Ianitor refused this request from the page. Reload the page and try again.";
|
||||||
|
}
|
||||||
|
return e.body.message;
|
||||||
|
}
|
||||||
|
if (e instanceof LostContact) return "Ianitor's control service is not answering. Traffic keeps flowing; changes wait until it is back.";
|
||||||
|
if (e instanceof SignedOut) return "Your sign-in has ended. Sign in again; this page keeps what you typed.";
|
||||||
|
return "Something went wrong.";
|
||||||
|
}
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// Shared UI state: the overview (polled, handoff §3), the route, contact and sign-in state,
|
||||||
|
// the server clock offset and toasts. No business logic: everything shown comes from control.
|
||||||
|
|
||||||
|
import { call, newKey, sentence, setClientEvents } from "./api";
|
||||||
|
import type { Overview } from "./types";
|
||||||
|
|
||||||
|
export interface Toast {
|
||||||
|
id: number;
|
||||||
|
text: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const app = $state({
|
||||||
|
overview: null as Overview | null,
|
||||||
|
etag: null as string | null,
|
||||||
|
loadError: false,
|
||||||
|
lostContact: false,
|
||||||
|
lostSince: 0,
|
||||||
|
lastUpdated: 0,
|
||||||
|
signedOut: false,
|
||||||
|
offset: 0,
|
||||||
|
now: Date.now(),
|
||||||
|
path: typeof location === "undefined" ? "/" : location.pathname + location.search,
|
||||||
|
toasts: [] as Toast[],
|
||||||
|
/** Dismissed banner keys (reverted outcome, renewed, switched). */
|
||||||
|
dismissed: [] as string[],
|
||||||
|
/** The outcome of the last engine switch, until dismissed (handoff §9.2). */
|
||||||
|
switchResult: null as null | { ok: boolean; title: string; text: string; detail?: string | null },
|
||||||
|
/** A renewal just installed (handoff §13.5). */
|
||||||
|
renewedUntil: null as null | string,
|
||||||
|
/** After a kept add or edit: the row whose More button gets focus (§7.5). */
|
||||||
|
focusHost: null as string | null,
|
||||||
|
/** Narrower than 720 px (the phone layout, handoff §5.2). */
|
||||||
|
phone: false,
|
||||||
|
/** Panels the main screen opens (add/edit host, share, engine). */
|
||||||
|
panel: null as null | { kind: "host"; hostname?: string; resume?: string } | { kind: "share"; hostname: string } | { kind: "engine" },
|
||||||
|
});
|
||||||
|
|
||||||
|
let failures = 0;
|
||||||
|
let firstFailure = 0;
|
||||||
|
|
||||||
|
setClientEvents({
|
||||||
|
onSignedOut: () => {
|
||||||
|
app.signedOut = true;
|
||||||
|
},
|
||||||
|
onContact: (ok) => {
|
||||||
|
if (ok) {
|
||||||
|
failures = 0;
|
||||||
|
app.lostContact = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (failures === 0) firstFailure = Date.now();
|
||||||
|
failures++;
|
||||||
|
// Retry quietly for 10 s (a reload takes about 2 s), then say so (§11.1).
|
||||||
|
if (Date.now() - firstFailure >= 10_000) {
|
||||||
|
if (!app.lostContact) app.lostSince = Date.now();
|
||||||
|
app.lostContact = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onServerTime: (o) => {
|
||||||
|
app.offset = o;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
/** Server time now, in ms (all countdowns use it, §7.2). */
|
||||||
|
export function serverNow(): number {
|
||||||
|
return app.now + app.offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Seconds left until an ISO time, on the server's clock. */
|
||||||
|
export function secondsLeft(iso: string | null | undefined): number {
|
||||||
|
if (!iso) return 0;
|
||||||
|
return Math.max(0, Math.ceil((Date.parse(iso) - serverNow()) / 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function refresh(): Promise<void> {
|
||||||
|
if (app.signedOut) return;
|
||||||
|
try {
|
||||||
|
const a = await call<Overview>("GET", "/overview", undefined, { etag: app.etag ?? undefined });
|
||||||
|
if (a.status === 200 && a.data) {
|
||||||
|
app.overview = a.data;
|
||||||
|
app.etag = a.etag;
|
||||||
|
}
|
||||||
|
app.loadError = false;
|
||||||
|
app.lastUpdated = Date.now();
|
||||||
|
} catch {
|
||||||
|
if (!app.overview) app.loadError = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||||
|
let hiddenSince = 0;
|
||||||
|
|
||||||
|
/** Poll every 5 s while visible, 30 s when hidden, stop after 15 min hidden (Q9). */
|
||||||
|
export function startPolling(): () => void {
|
||||||
|
let stopped = false;
|
||||||
|
const tick = async () => {
|
||||||
|
if (stopped) return;
|
||||||
|
const hidden = typeof document !== "undefined" && document.visibilityState === "hidden";
|
||||||
|
if (hidden && !hiddenSince) hiddenSince = Date.now();
|
||||||
|
if (!hidden) hiddenSince = 0;
|
||||||
|
if (!(hidden && Date.now() - hiddenSince > 15 * 60_000)) await refresh();
|
||||||
|
const every = app.lostContact ? 5000 : hidden ? 30_000 : 5000;
|
||||||
|
timer = setTimeout(tick, every);
|
||||||
|
};
|
||||||
|
const vis = () => {
|
||||||
|
if (document.visibilityState === "visible" && hiddenSince) {
|
||||||
|
hiddenSince = 0;
|
||||||
|
clearTimeout(timer);
|
||||||
|
void tick();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener("visibilitychange", vis);
|
||||||
|
const clock = setInterval(() => (app.now = Date.now()), 1000);
|
||||||
|
void tick();
|
||||||
|
return () => {
|
||||||
|
stopped = true;
|
||||||
|
clearTimeout(timer);
|
||||||
|
clearInterval(clock);
|
||||||
|
document.removeEventListener("visibilitychange", vis);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let toastId = 0;
|
||||||
|
export function toast(text: string): void {
|
||||||
|
const id = ++toastId;
|
||||||
|
app.toasts = [...app.toasts.slice(-2), { id, text }];
|
||||||
|
setTimeout(() => {
|
||||||
|
app.toasts = app.toasts.filter((t) => t.id !== id);
|
||||||
|
}, 6000);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function navigate(path: string): void {
|
||||||
|
if (path === app.path) return;
|
||||||
|
history.pushState({}, "", path);
|
||||||
|
app.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
|
||||||
|
const mq = window.matchMedia("(max-width: 719.98px)");
|
||||||
|
app.phone = mq.matches;
|
||||||
|
mq.addEventListener?.("change", (e) => (app.phone = e.matches));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
window.addEventListener("popstate", () => {
|
||||||
|
app.path = location.pathname + location.search;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Is a change allowed now? (Paused, or no contact.) */
|
||||||
|
export function changesBlocked(): string | null {
|
||||||
|
const o = app.overview;
|
||||||
|
if (app.lostContact) return "Ianitor's control service is not answering.";
|
||||||
|
if (o?.paused) return "Changes are paused.";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** "Restore the last kept version" (handoff §7.6): start it and show its progress in a panel.
|
||||||
|
* Returns the sentence to show when it could not start. */
|
||||||
|
export async function restoreLastKept(): Promise<string | null> {
|
||||||
|
const o = app.overview;
|
||||||
|
if (!o?.undo?.target) return null;
|
||||||
|
try {
|
||||||
|
const a = await call<{ apply: { id: string } }>("POST", "/restore", { change_id: o.undo.target.change_id, base_rev: o.rev }, { idem: newKey() });
|
||||||
|
if (a.data) app.panel = { kind: "host", resume: a.data.apply.id };
|
||||||
|
return null;
|
||||||
|
} catch (e) {
|
||||||
|
return sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Whether the pause can be cleared by restoring the last kept version. */
|
||||||
|
export function restorable(): boolean {
|
||||||
|
const o = app.overview;
|
||||||
|
return !!o?.paused && ["apply.needs_attention", "control.files_unwritten"].includes(o.paused_reason ?? "") && !!o.undo?.target;
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// Following an apply (handoff §2.2 of ui-api, §3 here): GET /applies/{id} every second while it
|
||||||
|
// runs; quiet retries while edge reloads; the id kept in sessionStorage so a reload resumes it.
|
||||||
|
|
||||||
|
import { get } from "./api";
|
||||||
|
import { app, refresh } from "./app.svelte";
|
||||||
|
import type { ApplyView } from "./types";
|
||||||
|
|
||||||
|
export const FINAL = ["kept", "reverted", "failed", "needs_attention"];
|
||||||
|
const KEY = "ianitor.activeApply";
|
||||||
|
|
||||||
|
export function remember(id: string | null): void {
|
||||||
|
try {
|
||||||
|
if (id) sessionStorage.setItem(KEY, id);
|
||||||
|
else sessionStorage.removeItem(KEY);
|
||||||
|
} catch {
|
||||||
|
/* storage may be off; the bar still shows the running apply */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remembered(): string | null {
|
||||||
|
try {
|
||||||
|
return sessionStorage.getItem(KEY);
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Poll until the apply ends. Returns a stop function. */
|
||||||
|
export function follow(id: string, onupdate: (a: ApplyView) => void, every = 1000): () => void {
|
||||||
|
let stopped = false;
|
||||||
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||||
|
remember(id);
|
||||||
|
const tick = async () => {
|
||||||
|
if (stopped) return;
|
||||||
|
if (app.signedOut) {
|
||||||
|
// No requests while signed out (the overview poll stops too); look again shortly.
|
||||||
|
timer = setTimeout(tick, every);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const a = await get<ApplyView>(`/applies/${encodeURIComponent(id)}`);
|
||||||
|
if (stopped) return;
|
||||||
|
onupdate(a);
|
||||||
|
if (FINAL.includes(a.state)) {
|
||||||
|
remember(null);
|
||||||
|
void refresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
/* lost contact or a reload in progress: keep trying (the banner says so after 10 s) */
|
||||||
|
}
|
||||||
|
timer = setTimeout(tick, every);
|
||||||
|
};
|
||||||
|
void tick();
|
||||||
|
return () => {
|
||||||
|
stopped = true;
|
||||||
|
clearTimeout(timer);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// Formatting only (handoff §3): times in the browser's zone, 24-hour clock, counts sentences.
|
||||||
|
|
||||||
|
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||||
|
const LONG = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
||||||
|
|
||||||
|
const two = (n: number) => String(n).padStart(2, "0");
|
||||||
|
|
||||||
|
/** "Today 14:02", "Yesterday 21:14", "5 Nov 21:14", "5 Nov 2025". */
|
||||||
|
export function when(iso: string | null | undefined, now = Date.now()): string {
|
||||||
|
if (!iso) return "";
|
||||||
|
const d = new Date(iso);
|
||||||
|
if (Number.isNaN(d.getTime())) return "";
|
||||||
|
const n = new Date(now);
|
||||||
|
const hm = `${two(d.getHours())}:${two(d.getMinutes())}`;
|
||||||
|
const sameDay = (a: Date, b: Date) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
||||||
|
if (sameDay(d, n)) return `Today ${hm}`;
|
||||||
|
const y = new Date(n);
|
||||||
|
y.setDate(n.getDate() - 1);
|
||||||
|
if (sameDay(d, y)) return `Yesterday ${hm}`;
|
||||||
|
if (d.getFullYear() !== n.getFullYear()) return `${d.getDate()} ${MONTHS[d.getMonth()]} ${d.getFullYear()}`;
|
||||||
|
return `${d.getDate()} ${MONTHS[d.getMonth()]} ${hm}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Inside a sentence: "today 14:02", "yesterday 21:14", "5 Nov 21:14". */
|
||||||
|
export function whenInline(iso: string | null | undefined, now = Date.now()): string {
|
||||||
|
return when(iso, now).replace(/^(Today|Yesterday)/, (s) => s.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** After "at" / "on": "at 14:03", "yesterday at 21:14", "on 5 Nov at 21:14", "on 5 Nov 2025". */
|
||||||
|
export function atTime(iso: string | null | undefined, now = Date.now()): string {
|
||||||
|
const w = when(iso, now);
|
||||||
|
if (!w) return "";
|
||||||
|
if (w.startsWith("Today ")) return `at ${w.slice(6)}`;
|
||||||
|
if (w.startsWith("Yesterday ")) return `yesterday at ${w.slice(10)}`;
|
||||||
|
const m = /^(\d+ \w+) (\d\d:\d\d)$/.exec(w);
|
||||||
|
return m ? `on ${m[1]} at ${m[2]}` : `on ${w}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** "14 November 2026 at 14:20". */
|
||||||
|
export function longDate(iso: string | null | undefined, withTime = true): string {
|
||||||
|
if (!iso) return "";
|
||||||
|
const d = new Date(iso);
|
||||||
|
if (Number.isNaN(d.getTime())) return "";
|
||||||
|
const s = `${d.getDate()} ${LONG[d.getMonth()]} ${d.getFullYear()}`;
|
||||||
|
return withTime ? `${s} at ${two(d.getHours())}:${two(d.getMinutes())}` : s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** "2 Mar 2027". */
|
||||||
|
export function shortDate(iso: string | null | undefined): string {
|
||||||
|
if (!iso) return "";
|
||||||
|
const d = new Date(iso);
|
||||||
|
return `${d.getDate()} ${MONTHS[d.getMonth()]} ${d.getFullYear()}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** "8 s", "6 minutes", "2 hours", "3 days". */
|
||||||
|
export function duration(secs: number): string {
|
||||||
|
if (secs < 60) return `${Math.max(0, Math.round(secs))} s`;
|
||||||
|
const m = Math.round(secs / 60);
|
||||||
|
if (m < 60) return m === 1 ? "1 minute" : `${m} minutes`;
|
||||||
|
const h = Math.round(secs / 3600);
|
||||||
|
if (h < 48) return h === 1 ? "1 hour" : `${h} hours`;
|
||||||
|
const days = Math.round(secs / 86400);
|
||||||
|
return `${days} days`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ago(iso: string | null | undefined, now: number): string {
|
||||||
|
if (!iso) return "";
|
||||||
|
return duration((now - Date.parse(iso)) / 1000) + " ago";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** "7 hosts · 5 healthy, 1 degraded, 1 down" (handoff §5.1); short (phone, §5.2): "5 healthy, 1 degraded, 1 down". */
|
||||||
|
export function countsSentence(c: { hosts: number; healthy: number; degraded: number; down: number; unknown: number }, short = false): string {
|
||||||
|
const parts = [`${c.healthy} healthy`];
|
||||||
|
if (c.degraded) parts.push(`${c.degraded} degraded`);
|
||||||
|
if (c.down) parts.push(`${c.down} down`);
|
||||||
|
if (c.unknown) parts.push(`${c.unknown} not checked`);
|
||||||
|
if (short) return parts.join(", ");
|
||||||
|
return `${c.hosts} ${c.hosts === 1 ? "host" : "hosts"} · ${parts.join(", ")}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Split a server message on its first sentence (handoff §7.5). */
|
||||||
|
export function firstSentence(m: string): [string, string] {
|
||||||
|
const i = m.indexOf(". ");
|
||||||
|
return i < 0 ? [m, ""] : [m.slice(0, i + 1), m.slice(i + 2)];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Field labels in sentences (handoff §6.5). */
|
||||||
|
export const FIELD_LABEL: Record<string, string> = {
|
||||||
|
hostname: "address",
|
||||||
|
upstreams: "sends traffic to",
|
||||||
|
tls: "certificate",
|
||||||
|
auth: "who can open it",
|
||||||
|
"health_check.path": "health check address",
|
||||||
|
"health_check.interval_secs": "checks every",
|
||||||
|
share_links: "share links",
|
||||||
|
device_certs: "device certificates",
|
||||||
|
access_log: "visit log",
|
||||||
|
websockets: "websockets",
|
||||||
|
headers: "header rules",
|
||||||
|
};
|
||||||
|
|
||||||
|
export function fieldValue(field: string, v: string): string {
|
||||||
|
if (v === "") return "none";
|
||||||
|
if (field === "tls") return v === "domi" ? "Domi certificate" : "Let's Encrypt";
|
||||||
|
if (field === "auth") return v === "forward-auth" ? "sign in first" : "anyone";
|
||||||
|
if (field === "access_log") return v === "truncated" ? "on" : "off";
|
||||||
|
if (v === "true") return "on";
|
||||||
|
if (v === "false") return "off";
|
||||||
|
if (field === "health_check.interval_secs") return `${v} s`;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The shapes the UI reads from control (docs/api.md, docs/ui-api.md, GET /api/v1/openapi.json).
|
||||||
|
// Only the fields the UI uses are typed.
|
||||||
|
|
||||||
|
export interface ErrorBody {
|
||||||
|
code: string;
|
||||||
|
message: string;
|
||||||
|
field: string | null;
|
||||||
|
params: Record<string, string>;
|
||||||
|
retry_after_s: number | null;
|
||||||
|
detail: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ErrorEnvelope {
|
||||||
|
error: ErrorBody;
|
||||||
|
errors: ErrorBody[];
|
||||||
|
request_id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Blocked {
|
||||||
|
code: string;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Reason {
|
||||||
|
code: string;
|
||||||
|
message: string;
|
||||||
|
hostname?: string | null;
|
||||||
|
upstream?: string | null;
|
||||||
|
field?: string | null;
|
||||||
|
detail?: string | null;
|
||||||
|
params?: Record<string, string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Step {
|
||||||
|
key: "validate" | "compile" | "write" | "reload" | "watch" | "push";
|
||||||
|
state: "pending" | "running" | "done" | "failed" | "skipped";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApplyView {
|
||||||
|
id: string;
|
||||||
|
change_id: string;
|
||||||
|
kind: "add" | "edit" | "remove" | "undo" | "restore" | "share_links";
|
||||||
|
summary: string;
|
||||||
|
hosts: string[];
|
||||||
|
state: "queued" | "validating" | "applying" | "watching" | "kept" | "reverted" | "failed" | "needs_attention";
|
||||||
|
created_at: string;
|
||||||
|
finished_at: string | null;
|
||||||
|
steps: Step[];
|
||||||
|
queue: { position: number; waiting_for: { apply_id: string; summary: string; seconds_left: number | null } | null } | null;
|
||||||
|
watch: { ends_at: string; seconds_left: number; hosts: { hostname: string; passed: number; failed: number; total: number }[] } | null;
|
||||||
|
reason: Reason | null;
|
||||||
|
errors: ErrorBody[];
|
||||||
|
commit_short: string | null;
|
||||||
|
push: { state: "pushed" | "pending" | "failed"; at: string | null; error_code: string | null; next_try_at: string | null } | null;
|
||||||
|
attempted_host?: HostSpec | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface HeaderRule {
|
||||||
|
action: "set" | "remove";
|
||||||
|
name: string;
|
||||||
|
value?: string;
|
||||||
|
secret?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface HostSpec {
|
||||||
|
hostname: string;
|
||||||
|
upstreams: string[];
|
||||||
|
tls: "domi" | "letsencrypt";
|
||||||
|
auth: "none" | "forward-auth";
|
||||||
|
websockets: boolean;
|
||||||
|
share_links: boolean;
|
||||||
|
device_certs?: boolean;
|
||||||
|
access_log: "off" | "truncated";
|
||||||
|
health_check?: { path: string; interval_secs: number } | null;
|
||||||
|
request_headers?: HeaderRule[];
|
||||||
|
response_headers?: HeaderRule[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface HealthView {
|
||||||
|
state: "healthy" | "degraded" | "down" | "unknown" | "pending";
|
||||||
|
last_check_at: string | null;
|
||||||
|
latency_ms: number | null;
|
||||||
|
since: string | null;
|
||||||
|
failure: { kind: string; upstream: string | null; count: number; of: number } | null;
|
||||||
|
upstreams: { url: string; state: string; last_check_at: string | null; latency_ms: number | null; failure_kind: string | null }[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface HostRow {
|
||||||
|
hostname: string;
|
||||||
|
upstreams: string[];
|
||||||
|
tls: string;
|
||||||
|
auth: string;
|
||||||
|
websockets: boolean;
|
||||||
|
share_links: boolean;
|
||||||
|
device_certs: boolean;
|
||||||
|
added_at: string | null;
|
||||||
|
health: HealthView;
|
||||||
|
certificate: { state: "ok" | "pending" | "failed"; not_after: string | null; error_code: string | null };
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PkiRequest {
|
||||||
|
request_id: string;
|
||||||
|
kind: "device" | "intermediate";
|
||||||
|
state: "waiting" | "approved" | "denied" | "expired" | "cancelled" | "failed";
|
||||||
|
match_code: string;
|
||||||
|
created_at: string;
|
||||||
|
expires_at: string;
|
||||||
|
approved_at: string | null;
|
||||||
|
device_id: string | null;
|
||||||
|
name: string | null;
|
||||||
|
csr_pem: string | null;
|
||||||
|
csr_sha256?: string | null;
|
||||||
|
not_after: string | null;
|
||||||
|
message_code: string;
|
||||||
|
message: string;
|
||||||
|
approve_command: string | null;
|
||||||
|
file_base?: string | null;
|
||||||
|
problem: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IntermediateView {
|
||||||
|
state: "ok" | "due" | "urgent" | "expired" | "missing";
|
||||||
|
subject: string | null;
|
||||||
|
not_after: string | null;
|
||||||
|
days_left: number | null;
|
||||||
|
renewal: PkiRequest | null;
|
||||||
|
banner: Blocked | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface EngineView {
|
||||||
|
running: "pingora" | "caddy";
|
||||||
|
state: "running" | "switching" | "stopped";
|
||||||
|
since: string | null;
|
||||||
|
target: string | null;
|
||||||
|
switchable: boolean;
|
||||||
|
fallback_ready: { built_at: string | null; current: boolean; compared: number; matched: number; differences: string[] } | null;
|
||||||
|
last_error: Reason | null;
|
||||||
|
notes: Blocked[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UndoView {
|
||||||
|
available: boolean;
|
||||||
|
target: { change_id: string; summary: string; kept_at: string | null; commit_short: string | null } | null;
|
||||||
|
effect: string | null;
|
||||||
|
blocked: Blocked | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Overview {
|
||||||
|
counts: { hosts: number; healthy: number; degraded: number; down: number; unknown: number };
|
||||||
|
hosts: HostRow[];
|
||||||
|
engine: EngineView;
|
||||||
|
last_apply: ApplyView | null;
|
||||||
|
undo: UndoView;
|
||||||
|
active_apply: { id: string; state: string; summary: string; seconds_left: number | null; kind: string; hosts: string[]; watch_ends_at: string | null; queued: number } | null;
|
||||||
|
repo: { name: string; last_push_at: string | null; unpushed: number; push_error_code: string | null } | null;
|
||||||
|
intermediate: IntermediateView | null;
|
||||||
|
site: { forward_auth_configured: boolean; acme_configured: boolean; secrets: string[]; watch_seconds: number; share_links_available: boolean; auth_logout_url?: string | null } | null;
|
||||||
|
paused: Blocked | null;
|
||||||
|
paused_reason: string | null;
|
||||||
|
paused_detail?: string | null;
|
||||||
|
health_error: Blocked | null;
|
||||||
|
rev: string | null;
|
||||||
|
viewer?: { name: string; via: string } | null;
|
||||||
|
server_time: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface HistoryEntry {
|
||||||
|
change_id: string;
|
||||||
|
summary: string;
|
||||||
|
kind: string;
|
||||||
|
state: string;
|
||||||
|
at: string;
|
||||||
|
commit_short: string | null;
|
||||||
|
hosts: string[];
|
||||||
|
reason_short: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RestorePreview {
|
||||||
|
restorable: boolean;
|
||||||
|
same_as_current: boolean;
|
||||||
|
changes: { hostname: string; effect: "added" | "removed" | "changed"; fields: { field: string; from: string; to: string }[] }[];
|
||||||
|
blocked: Blocked | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ShareLink {
|
||||||
|
id: string;
|
||||||
|
hostname: string;
|
||||||
|
path_prefix: string;
|
||||||
|
created_at: string;
|
||||||
|
expires_at: string;
|
||||||
|
has_password: boolean;
|
||||||
|
state: "active" | "expired" | "stopped";
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MintedLink {
|
||||||
|
id: string;
|
||||||
|
url: string;
|
||||||
|
expires_at: string;
|
||||||
|
path_prefix: string;
|
||||||
|
has_password: boolean;
|
||||||
|
warning: Blocked | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TokenRow {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
created_at: string;
|
||||||
|
last_used_at: string | null;
|
||||||
|
expires_at: string | null;
|
||||||
|
revoked_at?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreatedToken {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
token: string;
|
||||||
|
expires_at: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DeviceRow {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
kind: "phone" | "computer" | "app";
|
||||||
|
created_at: string;
|
||||||
|
not_after: string;
|
||||||
|
state: "valid" | "revoked" | "expired";
|
||||||
|
revoked_at: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CertsView {
|
||||||
|
intermediate: IntermediateView | null;
|
||||||
|
root: { offline: boolean; subject: string; not_after: string; sha256: string };
|
||||||
|
devices: DeviceRow[];
|
||||||
|
device_lifetime_days: number;
|
||||||
|
device_valid_until: string | null;
|
||||||
|
server_lifetime_days: number;
|
||||||
|
approval: string;
|
||||||
|
requests: PkiRequest[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Bundle {
|
||||||
|
download_url: string;
|
||||||
|
one_time_password: string;
|
||||||
|
expires_at: string;
|
||||||
|
filename: string;
|
||||||
|
qr_svg: string | null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
import "@ianitor/ui/tokens.css";
|
||||||
|
import "@ianitor/ui/components.css";
|
||||||
|
import { mount } from "svelte";
|
||||||
|
import App from "./App.svelte";
|
||||||
|
|
||||||
|
const target = document.getElementById("app");
|
||||||
|
if (target) mount(App, { target });
|
||||||
@@ -0,0 +1,257 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §13: Certificates → + Device → Issue (3 clicks), approval with the match code, then
|
||||||
|
// the install (the accepted 4th click). Until Custos can approve, approval is the server
|
||||||
|
// command control names (docs/pki.md).
|
||||||
|
import { onDestroy, onMount } from "svelte";
|
||||||
|
import { Banner, Button, Dialog, Icon, Segmented, Status } from "@ianitor/ui";
|
||||||
|
import HostMenu from "../components/HostMenu.svelte";
|
||||||
|
import IntermediateBanner from "../components/IntermediateBanner.svelte";
|
||||||
|
import { ApiError, del, get, post, sentence } from "../lib/api";
|
||||||
|
import { app, navigate, refresh, secondsLeft, toast } from "../lib/app.svelte";
|
||||||
|
import { atTime, shortDate } from "../lib/format";
|
||||||
|
import type { Bundle, CertsView, DeviceRow, PkiRequest } from "../lib/types";
|
||||||
|
|
||||||
|
let { newDevice }: { newDevice: boolean } = $props();
|
||||||
|
|
||||||
|
let certs = $state<CertsView | null>(null);
|
||||||
|
let problem = $state<string | null>(null);
|
||||||
|
let name = $state("");
|
||||||
|
let kind = $state<"phone" | "computer" | "app">("phone");
|
||||||
|
let nameErr = $state<string | null>(null);
|
||||||
|
let issuing = $state(false);
|
||||||
|
let request = $state<PkiRequest | null>(null);
|
||||||
|
let bundle = $state<{ device: DeviceRow | { id: string; name: string; kind: string }; b: Bundle; format: string } | null>(null);
|
||||||
|
let confirmRevoke = $state<string | null>(null);
|
||||||
|
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||||
|
|
||||||
|
async function load() {
|
||||||
|
try {
|
||||||
|
certs = await get<CertsView>("/certs");
|
||||||
|
problem = null;
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onMount(load);
|
||||||
|
onDestroy(() => clearTimeout(timer));
|
||||||
|
|
||||||
|
async function issue(e?: Event) {
|
||||||
|
e?.preventDefault();
|
||||||
|
issuing = true;
|
||||||
|
nameErr = null;
|
||||||
|
try {
|
||||||
|
request = await post<PkiRequest>("/certs/devices", { name, kind });
|
||||||
|
poll();
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof ApiError && err.body.field === "name") nameErr = err.body.message;
|
||||||
|
else problem = sentence(err);
|
||||||
|
} finally {
|
||||||
|
issuing = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function poll() {
|
||||||
|
clearTimeout(timer);
|
||||||
|
timer = setTimeout(async () => {
|
||||||
|
if (!request) return;
|
||||||
|
try {
|
||||||
|
request = await get<PkiRequest>(`/pki-requests/${encodeURIComponent(request.request_id)}`);
|
||||||
|
} catch {
|
||||||
|
/* keep waiting */
|
||||||
|
}
|
||||||
|
if (request?.state === "waiting") poll();
|
||||||
|
else void load();
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function cancelRequest() {
|
||||||
|
if (!request) return;
|
||||||
|
await del(`/pki-requests/${encodeURIComponent(request.request_id)}`).catch(() => {});
|
||||||
|
request = null;
|
||||||
|
closeForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function install(d: { id: string; name: string; kind: string }, format: "qr" | "p12") {
|
||||||
|
try {
|
||||||
|
const b = await post<Bundle>(`/certs/devices/${encodeURIComponent(d.id)}/bundle`, { format });
|
||||||
|
bundle = { device: d, b, format };
|
||||||
|
if (format === "p12") {
|
||||||
|
// The link's GET is only a page (so link previews cannot use it up); this browser is
|
||||||
|
// signed in on the same host, so it posts to the path and saves the file itself.
|
||||||
|
const res = await fetch(new URL(b.download_url, location.href).pathname, { method: "POST", credentials: "same-origin" });
|
||||||
|
if (!res.ok) {
|
||||||
|
problem = "The install file could not be downloaded. Choose Install again for a new link.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const href = URL.createObjectURL(await res.blob());
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.href = href;
|
||||||
|
a.download = `${d.name}.p12`;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
setTimeout(() => URL.revokeObjectURL(href), 10_000);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function revoke(d: DeviceRow) {
|
||||||
|
try {
|
||||||
|
await del(`/certs/devices/${encodeURIComponent(d.id)}`);
|
||||||
|
toast(`Revoked. ${d.name} can no longer get in.`);
|
||||||
|
confirmRevoke = null;
|
||||||
|
await load();
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeForm() {
|
||||||
|
clearTimeout(timer);
|
||||||
|
name = "";
|
||||||
|
nameErr = null;
|
||||||
|
if (request?.state !== "approved") request = null;
|
||||||
|
navigate("/certificates");
|
||||||
|
}
|
||||||
|
|
||||||
|
const lifetime = $derived(certs?.device_lifetime_days ?? 365);
|
||||||
|
// The server caps it at the intermediate's end (Q7); without one it cannot issue anyway.
|
||||||
|
const until = $derived(shortDate(certs?.device_valid_until ?? new Date(Date.now() + lifetime * 86_400_000).toISOString()));
|
||||||
|
const capped = $derived(
|
||||||
|
!!certs?.device_valid_until && Date.parse(certs.device_valid_until) < Date.now() + (lifetime - 1) * 86_400_000,
|
||||||
|
);
|
||||||
|
const intState = $derived.by((): [import("@ianitor/ui").StatusKind, string] => {
|
||||||
|
switch (certs?.intermediate?.state) {
|
||||||
|
case "ok": return ["healthy", "valid"];
|
||||||
|
case "due": return ["degraded", "renew soon"];
|
||||||
|
case "urgent": return ["down", "renew now"];
|
||||||
|
case "expired": return ["down", "expired"];
|
||||||
|
default: return ["unknown", "not set up"];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const kindIcon = (k: string) => (k === "phone" ? "phone" : k === "computer" ? "laptop" : "app") as "phone" | "laptop" | "app";
|
||||||
|
const issuedDevice = $derived(request?.state === "approved" && request.device_id ? { id: request.device_id, name: request.name ?? name, kind } : null);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="head">
|
||||||
|
<h1 class="ia-display">Certificates</h1>
|
||||||
|
<Button variant="outline" icon="plus" label="Add a device certificate" onclick={() => navigate("/certificates/new")}>Device</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<IntermediateBanner />
|
||||||
|
{#if problem}<Banner tone="notice" live="status" ondismiss={() => (problem = null)}>{#snippet title()}{problem}{/snippet}</Banner>{/if}
|
||||||
|
|
||||||
|
{#if certs}
|
||||||
|
<section class="ia-card">
|
||||||
|
<p class="ia-label">Domi intermediate</p>
|
||||||
|
<p><Status kind={intState[0]} word={intState[1]} /> {#if certs.intermediate?.not_after}expires {shortDate(certs.intermediate.not_after)}{/if}</p>
|
||||||
|
<p class="ia-sub">Root stays offline ({certs.root.subject}, until {shortDate(certs.root.not_after)}).</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<p class="ia-label">Devices</p>
|
||||||
|
{#if certs.devices.length === 0}
|
||||||
|
<div class="ia-frame"><h2 class="ia-h3">No device certificates yet</h2><p class="ia-text2">A device certificate lets a phone, computer or Domi app into hosts that ask for one.</p></div>
|
||||||
|
{:else}
|
||||||
|
<ul class="devices">
|
||||||
|
{#each certs.devices as d (d.id)}
|
||||||
|
<li>
|
||||||
|
<Icon name={kindIcon(d.kind)} />
|
||||||
|
<span class="dname">{d.name}</span>
|
||||||
|
<span class="ia-muted">until {shortDate(d.not_after)}</span>
|
||||||
|
{#if d.state === "revoked"}<Status kind="unknown" word="revoked {d.revoked_at ? shortDate(d.revoked_at) : ''}" />{:else if d.state === "expired"}<Status kind="down" word="expired" />{:else if Date.parse(d.not_after) - app.now < 30 * 86_400_000}<Status kind="degraded" word="renew soon" />{/if}
|
||||||
|
{#if confirmRevoke === d.id}
|
||||||
|
<span class="confirm">Revoke the certificate of "{d.name}"? It can no longer get in.
|
||||||
|
<Button small onclick={() => (confirmRevoke = null)} data-autofocus>Cancel</Button>
|
||||||
|
<Button small variant="danger" onclick={() => revoke(d)}>Revoke</Button></span>
|
||||||
|
{:else if d.state === "valid"}
|
||||||
|
<HostMenu hostname={d.name} items={[
|
||||||
|
{ label: "Install on the device", icon: "key", run: () => install(d, d.kind === "computer" ? "p12" : "qr") },
|
||||||
|
{ label: "Revoke", icon: "trash", danger: true, divider: true, run: () => (confirmRevoke = d.id) },
|
||||||
|
]} />
|
||||||
|
{/if}
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if newDevice}
|
||||||
|
<Dialog title="New device certificate" kind="panel" onclose={closeForm}>
|
||||||
|
{#if !request}
|
||||||
|
<form id="device-form" onsubmit={issue} class="form">
|
||||||
|
<div class="domi-field">
|
||||||
|
<label class="domi-field-label" for="device-name">Device name</label>
|
||||||
|
<input id="device-name" class="domi-input" bind:value={name} autocomplete="off" aria-invalid={nameErr ? "true" : undefined} aria-describedby="device-name-h" />
|
||||||
|
{#if nameErr}<p class="domi-error"><Icon name="ring" />{nameErr}</p>{/if}
|
||||||
|
<p class="ia-hint" id="device-name-h">Shown in this list and inside the certificate.</p>
|
||||||
|
</div>
|
||||||
|
<Segmented legend="What is it" name="kind" bind:value={kind} options={[{ value: "phone", label: "Phone or tablet" }, { value: "computer", label: "Computer" }, { value: "app", label: "Domi app" }]} />
|
||||||
|
<p class="ia-hint">{#if capped}Valid until {until}, when the Domi intermediate certificate ends (renew it to issue for a full year).{:else}Valid for {lifetime} days, until {until}.{/if} It lets this device into hosts that ask for a Domi device certificate.</p>
|
||||||
|
</form>
|
||||||
|
{:else if request.state === "waiting"}
|
||||||
|
<p class="ia-status" data-s="running"><Icon name="clock" /><strong>Waiting for approval</strong></p>
|
||||||
|
<p>Custos cannot approve device certificates yet, so approve it on the server, and only if it shows the same code:</p>
|
||||||
|
<p class="ia-code" aria-label="Match code {request.match_code}">{request.match_code}</p>
|
||||||
|
{#if request.approve_command}<p class="ia-hint">Run on the server:</p><pre class="ia-secret ia-cmd">{request.approve_command}</pre>{/if}
|
||||||
|
<p class="ia-muted">The request stays open for 10 minutes ({Math.floor(secondsLeft(request.expires_at) / 60)}:{String(secondsLeft(request.expires_at) % 60).padStart(2, "0")} left). Nothing is issued until it is approved.</p>
|
||||||
|
<div><Button onclick={cancelRequest}>Cancel request</Button></div>
|
||||||
|
<span class="sr-only" aria-live="polite">Waiting for approval. Code {request.match_code}.</span>
|
||||||
|
{:else if issuedDevice}
|
||||||
|
<Banner tone="kept" live="status">{#snippet title()}<strong>{issuedDevice.name} has a certificate.</strong> Approved {atTime(request?.approved_at, app.now)}.{/snippet}</Banner>
|
||||||
|
<div class="buttons">
|
||||||
|
<Button variant="outline" onclick={() => install(issuedDevice, "qr")}>Show QR code</Button>
|
||||||
|
<Button onclick={() => install(issuedDevice, "p12")}>Download file (.p12)</Button>
|
||||||
|
</div>
|
||||||
|
<p class="ia-hint">The file is protected with a one-time password shown next to the QR code.</p>
|
||||||
|
{:else}
|
||||||
|
<Banner tone="notice" live="status">{#snippet title()}{request?.message}{/snippet}
|
||||||
|
{#snippet actions()}<Button variant="outline" onclick={() => { request = null; void issue(); }}>Try again</Button>{/snippet}</Banner>
|
||||||
|
{/if}
|
||||||
|
{#snippet footer()}
|
||||||
|
{#if !request}
|
||||||
|
<Button onclick={closeForm}>Cancel</Button>
|
||||||
|
<Button variant="primary" type="submit" form="device-form" pending={issuing}>Issue</Button>
|
||||||
|
{:else if request.state !== "waiting"}
|
||||||
|
<Button onclick={() => { request = null; closeForm(); void load(); }}>Close</Button>
|
||||||
|
{/if}
|
||||||
|
{/snippet}
|
||||||
|
</Dialog>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if bundle}
|
||||||
|
<Dialog title="Install on {bundle.device.name}" onclose={() => { bundle = null; void refresh(); }}>
|
||||||
|
<div class="install">
|
||||||
|
{#if bundle.b.qr_svg}
|
||||||
|
<div class="ia-qr" role="img" aria-label="QR code for downloading the certificate">{@html bundle.b.qr_svg}</div>
|
||||||
|
{/if}
|
||||||
|
<div>
|
||||||
|
<p class="ia-label">Password for the file</p>
|
||||||
|
<p class="otp">{bundle.b.one_time_password}</p>
|
||||||
|
<p class="ia-hint">Works once, for 10 minutes ({Math.floor(secondsLeft(bundle.b.expires_at) / 60)}:{String(secondsLeft(bundle.b.expires_at) % 60).padStart(2, "0")} left).</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="ia-text2">
|
||||||
|
{#if bundle.device.kind === "computer"}Open the downloaded file and enter the password when it asks.
|
||||||
|
{:else if bundle.device.kind === "app"}In the app, choose Import certificate, pick the file, and enter the password.
|
||||||
|
{:else}Scan the code with the device's camera, open the link, and enter the password when it asks. Then allow the certificate in the device's settings.{/if}
|
||||||
|
</p>
|
||||||
|
</Dialog>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
|
||||||
|
.devices { list-style: none; margin: 0; padding: 0; border: 1px solid var(--hairline); border-radius: var(--radius-lg); }
|
||||||
|
.devices li { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; min-height: 56px; padding: 6px 10px 6px 16px; border-top: 1px solid var(--hairline); }
|
||||||
|
.devices li:first-child { border-top: 0; }
|
||||||
|
.dname { font-weight: 600; flex: 1 1 140px; }
|
||||||
|
.confirm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex-basis: 100%; }
|
||||||
|
.form { display: flex; flex-direction: column; gap: 16px; }
|
||||||
|
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||||
|
.install { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
|
||||||
|
.otp { font-weight: 700; font-size: 1.4rem; letter-spacing: 0.08em; }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §8.1: History → pick → Restore this version (3 clicks with the nav click).
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
import { Banner, Button, Status } from "@ianitor/ui";
|
||||||
|
import type { StatusKind } from "@ianitor/ui";
|
||||||
|
import HostPanel from "../components/HostPanel.svelte";
|
||||||
|
import { get, post, sentence } from "../lib/api";
|
||||||
|
import { app, changesBlocked, navigate } from "../lib/app.svelte";
|
||||||
|
import { FIELD_LABEL, fieldValue, when } from "../lib/format";
|
||||||
|
import type { ApplyView, HistoryEntry, HostSpec, RestorePreview } from "../lib/types";
|
||||||
|
|
||||||
|
let { host, pick }: { host?: string; pick?: string } = $props();
|
||||||
|
|
||||||
|
let entries = $state<HistoryEntry[]>([]);
|
||||||
|
let next = $state<string | null>(null);
|
||||||
|
let loaded = $state(false);
|
||||||
|
let problem = $state<string | null>(null);
|
||||||
|
let chosen = $state<string | null>(null);
|
||||||
|
let preview = $state<RestorePreview | null>(null);
|
||||||
|
let attempt = $state<ApplyView | null>(null);
|
||||||
|
let restoring = $state(false);
|
||||||
|
let resume = $state<string | null>(null);
|
||||||
|
let editFrom = $state<HostSpec | null>(null);
|
||||||
|
|
||||||
|
async function load(before?: string) {
|
||||||
|
try {
|
||||||
|
const q = new URLSearchParams({ limit: "50" });
|
||||||
|
if (host) q.set("host", host);
|
||||||
|
if (before) q.set("before", before);
|
||||||
|
const r = await get<{ entries: HistoryEntry[]; next_before: string | null }>(`/history?${q}`);
|
||||||
|
entries = before ? [...entries, ...r.entries] : r.entries;
|
||||||
|
next = r.next_before;
|
||||||
|
problem = null;
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
} finally {
|
||||||
|
loaded = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function choose(id: string) {
|
||||||
|
chosen = id;
|
||||||
|
preview = null;
|
||||||
|
attempt = null;
|
||||||
|
try {
|
||||||
|
preview = await get<RestorePreview>(`/history/${encodeURIComponent(id)}/restore-preview`);
|
||||||
|
if (preview.blocked?.code === "restore.not_kept") attempt = await get<ApplyView>(`/history/${encodeURIComponent(id)}`);
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function restore() {
|
||||||
|
if (!chosen) return;
|
||||||
|
restoring = true;
|
||||||
|
try {
|
||||||
|
const a = await post<{ apply: ApplyView }>("/restore", { change_id: chosen, base_rev: app.overview?.rev ?? null });
|
||||||
|
resume = a.apply.id;
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
} finally {
|
||||||
|
restoring = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
void load().then(() => {
|
||||||
|
if (pick) void choose(pick);
|
||||||
|
});
|
||||||
|
const focus = () => void load();
|
||||||
|
window.addEventListener("focus", focus);
|
||||||
|
return () => window.removeEventListener("focus", focus);
|
||||||
|
});
|
||||||
|
|
||||||
|
function stateOf(e: HistoryEntry): [StatusKind, string] {
|
||||||
|
switch (e.state) {
|
||||||
|
case "kept": return ["kept", "kept"];
|
||||||
|
case "reverted": return ["reverted", "reverted"];
|
||||||
|
case "failed": return ["reverted", "not applied"];
|
||||||
|
case "queued": return ["running", "waiting"];
|
||||||
|
default: return ["running", "applying"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const entry = $derived(entries.find((e) => e.change_id === chosen));
|
||||||
|
const n = $derived(preview?.changes.length ?? 0);
|
||||||
|
const paused = $derived(app.overview?.paused ? !["apply.needs_attention", "control.files_unwritten"].includes(app.overview.paused_reason ?? "") : false);
|
||||||
|
const blocked = $derived(paused ? "Changes are paused." : changesBlocked() && !app.overview?.paused ? changesBlocked() : null);
|
||||||
|
|
||||||
|
function key(e: KeyboardEvent, i: number) {
|
||||||
|
const btns = Array.from(document.querySelectorAll<HTMLButtonElement>(".entries button"));
|
||||||
|
if (e.key === "ArrowDown") { e.preventDefault(); btns[Math.min(btns.length - 1, i + 1)]?.focus(); }
|
||||||
|
if (e.key === "ArrowUp") { e.preventDefault(); btns[Math.max(0, i - 1)]?.focus(); }
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h1 class="ia-display">{host ? `History of ${host}` : "History"}</h1>
|
||||||
|
{#if host}<div><button type="button" class="domi-btn link" onclick={() => navigate("/history")}>Show all changes</button></div>{/if}
|
||||||
|
{#if problem}<Banner tone="notice" live="status">{#snippet title()}{problem}{/snippet}</Banner>{/if}
|
||||||
|
|
||||||
|
<div class="cols">
|
||||||
|
<div class="list">
|
||||||
|
{#if loaded && entries.length === 0}
|
||||||
|
<div class="ia-frame"><h2 class="ia-h3">No changes yet</h2><p class="ia-text2">Every change you apply is listed here, newest first.</p></div>
|
||||||
|
{/if}
|
||||||
|
<ul class="entries">
|
||||||
|
{#each entries as e, i (e.change_id)}
|
||||||
|
{@const [k, w] = stateOf(e)}
|
||||||
|
<li>
|
||||||
|
<button type="button" class="entry" aria-current={chosen === e.change_id ? "true" : undefined} onclick={() => choose(e.change_id)} onkeydown={(ev) => key(ev, i)}>
|
||||||
|
<span class="sum">{e.summary}</span><Status kind={k} word={w} />
|
||||||
|
<span class="ia-sub">{when(e.at, app.now)} · {e.state === "kept" ? (e.commit_short ?? "") : (e.reason_short ?? "")}</span>
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
{#if next}<Button onclick={() => load(next ?? undefined)}>Show older changes</Button>{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if chosen && preview}
|
||||||
|
<section class="detail" aria-label="Version">
|
||||||
|
<p class="ia-label">Version of {when(entry?.at, app.now)}</p>
|
||||||
|
{#if preview.blocked?.code === "restore.not_kept"}
|
||||||
|
<h2 class="ia-h3">This change did not stay</h2>
|
||||||
|
{#if attempt?.reason}<p>{attempt.reason.message}</p>{/if}
|
||||||
|
<p class="ia-text2">This change was undone at the time, so there is nothing to go back to.</p>
|
||||||
|
{#if attempt?.attempted_host}<div><Button variant="outline" onclick={() => (editFrom = attempt?.attempted_host ?? null)}>Edit and try again</Button></div>{/if}
|
||||||
|
{:else if preview.blocked?.code === "restore.same"}
|
||||||
|
<h2 class="ia-h3">Go back to this version?</h2>
|
||||||
|
<p class="ia-text2">This version is the same as the current one. Nothing to restore.</p>
|
||||||
|
<div class="buttons"><Button onclick={() => (chosen = null)}>Close</Button></div>
|
||||||
|
{:else}
|
||||||
|
<h2 class="ia-h3">Go back to this version?</h2>
|
||||||
|
<p>{n === 1 ? "Restoring puts 1 host back to how it was then:" : `Restoring puts ${n} hosts back to how they were then:`}</p>
|
||||||
|
<ul>
|
||||||
|
{#each preview.changes as c (c.hostname)}
|
||||||
|
{#if c.effect === "added"}<li><strong>{c.hostname}</strong> is added back</li>
|
||||||
|
{:else if c.effect === "removed"}<li><strong>{c.hostname}</strong> is removed</li>
|
||||||
|
{:else}
|
||||||
|
{#each c.fields as f (f.field)}
|
||||||
|
<li><strong>{c.hostname}</strong>: {#if f.field === "headers"}header rules change{:else}{FIELD_LABEL[f.field] ?? f.field} changes from {fieldValue(f.field, f.from)} to {fieldValue(f.field, f.to)}{/if}</li>
|
||||||
|
{/each}
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
<p class="ia-hint">Applied as a new commit with the same {app.overview?.site?.watch_seconds ?? 60}-second watch. If health checks fail, it is undone.</p>
|
||||||
|
{#if blocked}<p class="ia-hint" id="restore-blocked">{blocked}</p>{/if}
|
||||||
|
<div class="buttons">
|
||||||
|
<Button onclick={() => (chosen = null)}>Close</Button>
|
||||||
|
<Button variant="primary" onclick={restore} pending={restoring} disabled={!!blocked} describedby={blocked ? "restore-blocked" : undefined}>Restore this version</Button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</section>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if resume}
|
||||||
|
<HostPanel resume={resume} onclose={() => { resume = null; void load(); }} />
|
||||||
|
{/if}
|
||||||
|
{#if editFrom}
|
||||||
|
<HostPanel prefill={editFrom} hostname={undefined} onclose={() => { editFrom = null; void load(); }} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.cols { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
|
||||||
|
.list { flex: 1 1 360px; max-width: 520px; display: flex; flex-direction: column; gap: 8px; }
|
||||||
|
.entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
|
||||||
|
.entry { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid transparent; background: none; color: var(--text); text-align: left; cursor: pointer; }
|
||||||
|
.entry:hover { background: var(--surface); }
|
||||||
|
.entry[aria-current="true"] { background: var(--surface-2); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
|
||||||
|
.sum { font-weight: 600; }
|
||||||
|
.detail { flex: 2 1 360px; background: var(--colonnade); border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
|
||||||
|
.detail ul { margin: 0; padding-left: 1.1rem; }
|
||||||
|
.buttons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §5: the main screen.
|
||||||
|
import { tick } from "svelte";
|
||||||
|
import { Banner, Button } from "@ianitor/ui";
|
||||||
|
import ChangeBar from "../components/ChangeBar.svelte";
|
||||||
|
import EngineChip from "../components/EngineChip.svelte";
|
||||||
|
import HostList from "../components/HostList.svelte";
|
||||||
|
import HostPanel from "../components/HostPanel.svelte";
|
||||||
|
import IntermediateBanner from "../components/IntermediateBanner.svelte";
|
||||||
|
import ShareDialog from "../components/ShareDialog.svelte";
|
||||||
|
import { call, newKey, post, sentence } from "../lib/api";
|
||||||
|
import { app, changesBlocked, navigate, refresh, toast } from "../lib/app.svelte";
|
||||||
|
import { atTime, countsSentence } from "../lib/format";
|
||||||
|
import type { ApplyView, HostSpec } from "../lib/types";
|
||||||
|
|
||||||
|
let { route }: { route: { newHost: boolean; edit?: string } } = $props();
|
||||||
|
|
||||||
|
const o = $derived(app.overview);
|
||||||
|
let prefill = $state<HostSpec | null>(null);
|
||||||
|
let focusField = $state<string | undefined>(undefined);
|
||||||
|
let problem = $state<string | null>(null);
|
||||||
|
|
||||||
|
const panelOpen = $derived(route.newHost || !!route.edit || app.panel?.kind === "host");
|
||||||
|
const blocked = $derived(changesBlocked());
|
||||||
|
|
||||||
|
async function closePanel() {
|
||||||
|
prefill = null;
|
||||||
|
focusField = undefined;
|
||||||
|
if (app.panel?.kind === "host") app.panel = null;
|
||||||
|
if (route.newHost || route.edit) navigate("/");
|
||||||
|
await refresh();
|
||||||
|
const h = app.focusHost;
|
||||||
|
app.focusHost = null;
|
||||||
|
if (h) {
|
||||||
|
await tick();
|
||||||
|
document.querySelector<HTMLElement>(`[aria-label="More for ${h.replace(/["\\]/g, "")}"]`)?.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function remove(h: string) {
|
||||||
|
problem = null;
|
||||||
|
try {
|
||||||
|
await call("DELETE", `/hosts/${encodeURIComponent(h)}?base_rev=${encodeURIComponent(o?.rev ?? "")}`, undefined, { idem: newKey() });
|
||||||
|
await refresh();
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function retry(h: string) {
|
||||||
|
try {
|
||||||
|
await post(`/hosts/${encodeURIComponent(h)}/certificate/retry`);
|
||||||
|
toast("Trying Let's Encrypt again.");
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function editAgain(a: ApplyView, field?: string) {
|
||||||
|
prefill = a.attempted_host ?? null;
|
||||||
|
focusField = field;
|
||||||
|
if (a.kind === "add" || !a.hosts[0]) {
|
||||||
|
navigate("/hosts/new");
|
||||||
|
} else {
|
||||||
|
navigate(`/hosts/${encodeURIComponent(a.hosts[0])}/edit`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="head">
|
||||||
|
<div>
|
||||||
|
<h1 class="ia-display">Hosts</h1>
|
||||||
|
{#if o}<p class={app.phone ? "ia-sub" : "ia-text2"}>{countsSentence(o.counts, app.phone)}</p>{/if}
|
||||||
|
</div>
|
||||||
|
<div class="actions">
|
||||||
|
{#if !app.phone}<EngineChip />{/if}
|
||||||
|
<Button variant="primary" icon="plus" label="Add a host" disabled={!!blocked} describedby={blocked ? "add-blocked" : undefined} onclick={() => navigate("/hosts/new")}>Host</Button>
|
||||||
|
{#if blocked}<span class="sr-only" id="add-blocked">{blocked}</span>{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<IntermediateBanner />
|
||||||
|
{#if problem}<Banner tone="notice" live="status" ondismiss={() => (problem = null)}>{#snippet title()}{problem}{/snippet}</Banner>{/if}
|
||||||
|
|
||||||
|
<ChangeBar onshowsteps={(id) => (app.panel = { kind: "host", resume: id })} onedit={editAgain} />
|
||||||
|
|
||||||
|
{#if !o && !app.loadError}
|
||||||
|
<div class="ia-list" aria-busy="true"><span class="sr-only">Loading hosts…</span>
|
||||||
|
{#each [0, 1, 2] as i (i)}<div class="ia-row"><span class="ia-placeholder"></span><span class="ia-placeholder"></span><span class="ia-placeholder"></span><span></span></div>{/each}
|
||||||
|
</div>
|
||||||
|
{:else if app.loadError && !o}
|
||||||
|
<Banner tone="down" live="alert">{#snippet title()}This page could not load. Ianitor's control service may be restarting.{/snippet}
|
||||||
|
{#snippet actions()}<Button onclick={() => refresh()}>Try again now</Button>{/snippet}</Banner>
|
||||||
|
{:else if o && o.hosts.length === 0}
|
||||||
|
<div class="ia-frame"><h2 class="ia-h3">No hosts yet</h2><p class="ia-text2">Add the first one: the name people type, and where Ianitor should send them.</p></div>
|
||||||
|
{:else if o}
|
||||||
|
<HostList hosts={o.hosts}
|
||||||
|
onedit={(h) => navigate(`/hosts/${encodeURIComponent(h)}/edit`)}
|
||||||
|
onremove={remove}
|
||||||
|
onshare={(h) => (app.panel = { kind: "share", hostname: h })}
|
||||||
|
onhistory={(h) => navigate(`/history?host=${encodeURIComponent(h)}`)}
|
||||||
|
onretry={retry} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if o?.repo}
|
||||||
|
<hr class="ia-ornament" />
|
||||||
|
<p class="ia-muted footer">
|
||||||
|
Routes live in the {o.repo.name} repository, one file per host.
|
||||||
|
{#if o.repo.last_push_at}Last pushed to Gitea {atTime(o.repo.last_push_at, app.now)}.{/if}
|
||||||
|
{#if o.repo.unpushed}{o.repo.unpushed} changes not yet pushed.{/if}
|
||||||
|
<button type="button" class="domi-btn link" onclick={() => navigate("/history")}>See history</button>
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if panelOpen}
|
||||||
|
{#key route.edit ?? (app.panel?.kind === "host" ? app.panel.resume : "new")}
|
||||||
|
<HostPanel hostname={route.edit} resume={app.panel?.kind === "host" ? app.panel.resume : undefined} {prefill} {focusField} onclose={closePanel} />
|
||||||
|
{/key}
|
||||||
|
{/if}
|
||||||
|
{#if app.panel?.kind === "share"}
|
||||||
|
<ShareDialog hostname={app.panel.hostname} onclose={() => { app.panel = null; void refresh(); }} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
|
||||||
|
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
|
||||||
|
.footer { text-align: center; }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §13.6: signing the intermediate by hand on the offline computer (the temporary step
|
||||||
|
// until Custos can sign, docs/pki.md). The root key never comes to this server.
|
||||||
|
import { Banner, Button, Icon } from "@ianitor/ui";
|
||||||
|
import { ApiError, post, put, sentence } from "../lib/api";
|
||||||
|
import { app, navigate, refresh } from "../lib/app.svelte";
|
||||||
|
import type { PkiRequest } from "../lib/types";
|
||||||
|
|
||||||
|
const r = $derived(app.overview?.intermediate?.renewal ?? null);
|
||||||
|
let pem = $state("");
|
||||||
|
let paste = $state(false);
|
||||||
|
let err = $state<string | null>(null);
|
||||||
|
let pending = $state(false);
|
||||||
|
let starting = $state(false);
|
||||||
|
const base = $derived(r?.file_base ?? `domi-intermediate-${new Date().toISOString().slice(0, 10)}`);
|
||||||
|
const signCmd = $derived(r?.approve_command ?? `openssl x509 -req -in ${base}.csr -CA domi-root.crt -CAkey domi-root.key -days 365 -sha256 -extfile ${base}.ext -out ${base}.crt`);
|
||||||
|
const checkCmd = $derived(`openssl req -in ${base}.csr -outform DER | openssl dgst -sha256`);
|
||||||
|
let copied = $state(false);
|
||||||
|
// Groups of 8, easier to compare by eye; openssl prints it without spaces.
|
||||||
|
const group = (h: string) => h.match(/.{1,8}/g)?.join(" ") ?? h;
|
||||||
|
async function copy(text: string) {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(text);
|
||||||
|
copied = true;
|
||||||
|
setTimeout(() => (copied = false), 3000);
|
||||||
|
} catch {
|
||||||
|
err = "Your browser did not allow copying. Select the command and copy it.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function save(text: string, name: string, type: string) {
|
||||||
|
const url = URL.createObjectURL(new Blob([text], { type }));
|
||||||
|
const a = document.createElement("a");
|
||||||
|
a.href = url;
|
||||||
|
a.download = name;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function download() {
|
||||||
|
if (r?.csr_pem) save(r.csr_pem, `${base}.csr`, "application/pkcs10");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function downloadExt() {
|
||||||
|
if (!r) return;
|
||||||
|
try {
|
||||||
|
const res = await fetch(`/api/v1/pki-requests/${encodeURIComponent(r.request_id)}/ext`, { headers: { "X-Ianitor-UI": "1" }, redirect: "manual", credentials: "same-origin" });
|
||||||
|
if (res.ok) save(await res.text(), `${base}.ext`, "text/plain");
|
||||||
|
else err = "The signing settings file could not be downloaded. Reload the page and try again.";
|
||||||
|
} catch {
|
||||||
|
err = "Ianitor's control service is not answering.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function file(e: Event) {
|
||||||
|
const f = (e.currentTarget as HTMLInputElement).files?.[0];
|
||||||
|
if (f) pem = await f.text();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function use() {
|
||||||
|
if (!r) return;
|
||||||
|
pending = true;
|
||||||
|
err = null;
|
||||||
|
try {
|
||||||
|
const done = await put<PkiRequest>(`/pki-requests/${encodeURIComponent(r.request_id)}/certificate`, { certificate_pem: pem });
|
||||||
|
app.renewedUntil = done.not_after;
|
||||||
|
await refresh();
|
||||||
|
navigate("/certificates");
|
||||||
|
} catch (e) {
|
||||||
|
err = e instanceof ApiError ? e.body.message : sentence(e);
|
||||||
|
} finally {
|
||||||
|
pending = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function start() {
|
||||||
|
starting = true;
|
||||||
|
try {
|
||||||
|
await post("/certs/intermediate/renewal");
|
||||||
|
await refresh();
|
||||||
|
} catch (e) {
|
||||||
|
err = sentence(e);
|
||||||
|
} finally {
|
||||||
|
starting = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h1 class="ia-display">Sign the intermediate by hand</h1>
|
||||||
|
<p class="ia-text2">Custos cannot sign certificates yet, so the Domi root signs on the offline computer. The root key never comes to this server.</p>
|
||||||
|
|
||||||
|
{#if !r}
|
||||||
|
<Banner tone="notice">{#snippet title()}There is no open renewal request.{/snippet}
|
||||||
|
{#snippet actions()}<Button variant="outline" onclick={start} pending={starting}>Start a renewal</Button>{/snippet}</Banner>
|
||||||
|
{:else}
|
||||||
|
<section class="step">
|
||||||
|
<p class="ia-label">Step 1</p>
|
||||||
|
<h2 class="ia-h3">Download the request</h2>
|
||||||
|
<p class="ia-text2">This file asks the Domi root to sign a new intermediate certificate. It holds no secret.</p>
|
||||||
|
<div class="row"><Button icon="download" onclick={download}>Download the request (.csr)</Button><Button icon="download" onclick={downloadExt}>Download the signing settings (.ext)</Button></div>
|
||||||
|
</section>
|
||||||
|
<section class="step">
|
||||||
|
<p class="ia-label">Step 2</p>
|
||||||
|
<h2 class="ia-h3">Sign it on the offline computer</h2>
|
||||||
|
<p class="ia-text2">Copy both files to the offline computer that holds the Domi root.</p>
|
||||||
|
<p class="ia-text2">First check that the request is the one this server made. This prints its fingerprint:</p>
|
||||||
|
<pre class="ia-secret ia-cmd">{checkCmd}</pre>
|
||||||
|
{#if r.csr_sha256}<p>openssl must print the same fingerprint as this page: <span class="ia-cmd fp" aria-label="Fingerprint {r.csr_sha256}">{group(r.csr_sha256)}</span></p>{/if}
|
||||||
|
<p class="ia-text2">Then sign it:</p>
|
||||||
|
<pre class="ia-secret ia-cmd">{signCmd}</pre>
|
||||||
|
<div class="row"><Button icon="copy" onclick={() => copy(signCmd)}>Copy command</Button>{#if copied}<span class="ia-status" data-s="kept" role="status"><Icon name="check" />Copied</span>{/if}</div>
|
||||||
|
<p class="ia-muted">On a computer with Ianitor installed, <code>ianitor-control ca sign</code> signs it instead and shows the match code {r.match_code}.</p>
|
||||||
|
</section>
|
||||||
|
<section class="step">
|
||||||
|
<p class="ia-label">Step 3</p>
|
||||||
|
<h2 class="ia-h3">Upload the signed certificate</h2>
|
||||||
|
{#if paste}
|
||||||
|
<div class="domi-field">
|
||||||
|
<label class="domi-field-label" for="cert-paste">Signed certificate</label>
|
||||||
|
<textarea id="cert-paste" class="domi-input" rows="8" bind:value={pem} aria-invalid={err ? "true" : undefined}></textarea>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="domi-field">
|
||||||
|
<label class="domi-field-label" for="cert-file">Signed certificate (.crt)</label>
|
||||||
|
<input id="cert-file" class="domi-input" type="file" accept=".crt,.pem" onchange={file} aria-invalid={err ? "true" : undefined} />
|
||||||
|
<div><button type="button" class="domi-btn link" onclick={() => (paste = true)}>Paste it instead</button></div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#if err}<p class="domi-error" role="alert"><Icon name="ring" />{err}</p>{/if}
|
||||||
|
<div><Button variant="primary" onclick={use} {pending} disabled={!pem.includes("BEGIN CERTIFICATE")}>Use this certificate</Button></div>
|
||||||
|
</section>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.row { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||||
|
.step { border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
|
||||||
|
.fp { word-break: break-all; color: var(--accent-strong); }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,280 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §8.3: Settings with General, API (⚙ → API → New token = 3 clicks, Copy token the
|
||||||
|
// accepted 4th), Share links and About.
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
import { Banner, Button, Dialog, Segmented } from "@ianitor/ui";
|
||||||
|
import { ApiError, call, del, get, newKey, patch, post, sentence } from "../lib/api";
|
||||||
|
import { app, navigate, toast } from "../lib/app.svelte";
|
||||||
|
import { longDate, shortDate, whenInline } from "../lib/format";
|
||||||
|
import type { CreatedToken, ShareLink, TokenRow } from "../lib/types";
|
||||||
|
|
||||||
|
let { tab }: { tab: string } = $props();
|
||||||
|
const TABS = [
|
||||||
|
{ id: "general", label: "General" },
|
||||||
|
{ id: "api", label: "API" },
|
||||||
|
{ id: "share-links", label: "Share links" },
|
||||||
|
{ id: "about", label: "About" },
|
||||||
|
];
|
||||||
|
|
||||||
|
let settings = $state<{ repo: { name: string; last_push_at: string | null } | null; watch_seconds: number } | null>(null);
|
||||||
|
let tokens = $state<TokenRow[]>([]);
|
||||||
|
let revoked = $state<Record<string, string>>({});
|
||||||
|
let links = $state<ShareLink[]>([]);
|
||||||
|
let problem = $state<string | null>(null);
|
||||||
|
let expiry = $state<"year" | "never">("year");
|
||||||
|
let made = $state<CreatedToken | null>(null);
|
||||||
|
let tokenName = $state("");
|
||||||
|
let tokenCopied = $state(false);
|
||||||
|
let askClose = $state(false);
|
||||||
|
let nameErr = $state<string | null>(null);
|
||||||
|
let confirmRevoke = $state<string | null>(null);
|
||||||
|
let confirmStopAll = $state(false);
|
||||||
|
let creating = $state(false);
|
||||||
|
|
||||||
|
async function load() {
|
||||||
|
try {
|
||||||
|
if (tab === "general") settings = await get("/settings");
|
||||||
|
if (tab === "api") tokens = (await get<{ items: TokenRow[] }>("/tokens")).items;
|
||||||
|
if (tab === "share-links") links = (await get<{ items: ShareLink[] }>("/share-links")).items;
|
||||||
|
problem = null;
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$effect(() => {
|
||||||
|
void tab;
|
||||||
|
void load();
|
||||||
|
});
|
||||||
|
onMount(() => {
|
||||||
|
const f = () => void load();
|
||||||
|
window.addEventListener("focus", f);
|
||||||
|
return () => window.removeEventListener("focus", f);
|
||||||
|
});
|
||||||
|
|
||||||
|
function tabKey(e: KeyboardEvent, i: number) {
|
||||||
|
let j = i;
|
||||||
|
if (e.key === "ArrowRight") j = (i + 1) % TABS.length;
|
||||||
|
else if (e.key === "ArrowLeft") j = (i - 1 + TABS.length) % TABS.length;
|
||||||
|
else if (e.key === "Home") j = 0;
|
||||||
|
else if (e.key === "End") j = TABS.length - 1;
|
||||||
|
else return;
|
||||||
|
e.preventDefault();
|
||||||
|
navigate(`/settings/${TABS[j].id}`);
|
||||||
|
setTimeout(() => document.getElementById(`tab-${TABS[j].id}`)?.focus(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function newToken() {
|
||||||
|
creating = true;
|
||||||
|
try {
|
||||||
|
const name = `Token made ${shortDate(new Date().toISOString())}`;
|
||||||
|
const body = expiry === "never" ? { name, never_expires: true } : { name, expires_in_days: 365 };
|
||||||
|
made = await post<CreatedToken>("/tokens", body);
|
||||||
|
tokenName = made.name;
|
||||||
|
tokenCopied = false;
|
||||||
|
askClose = false;
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
} finally {
|
||||||
|
creating = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function copyToken() {
|
||||||
|
if (!made) return;
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(made.token);
|
||||||
|
tokenCopied = true;
|
||||||
|
} catch {
|
||||||
|
problem = "Your browser did not allow copying. Select the token and press Ctrl+C.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function closeToken(force = false) {
|
||||||
|
if (!made) return;
|
||||||
|
if (!tokenCopied && !force) {
|
||||||
|
askClose = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (tokenName.trim() && tokenName !== made.name) {
|
||||||
|
try {
|
||||||
|
await patch(`/tokens/${encodeURIComponent(made.id)}`, { name: tokenName.trim() });
|
||||||
|
toast("Renamed.");
|
||||||
|
} catch (e) {
|
||||||
|
if (e instanceof ApiError && e.code === "token.name") {
|
||||||
|
nameErr = e.body.message;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// The token leaves memory with the dialog.
|
||||||
|
made = null;
|
||||||
|
tokenName = "";
|
||||||
|
void load();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function revoke(t: TokenRow) {
|
||||||
|
try {
|
||||||
|
await del(`/tokens/${encodeURIComponent(t.id)}`);
|
||||||
|
revoked = { ...revoked, [t.id]: new Date().toISOString() };
|
||||||
|
confirmRevoke = null;
|
||||||
|
toast(`Revoked. Anything using "${t.name}" stops working now.`);
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function stop(l: ShareLink) {
|
||||||
|
try {
|
||||||
|
await del(`/share-links/${encodeURIComponent(l.id)}`);
|
||||||
|
toast("Stopped. The link stops working within a few seconds.");
|
||||||
|
void load();
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function stopAll() {
|
||||||
|
try {
|
||||||
|
await call("POST", "/share-links/stop-all", {}, { idem: newKey() });
|
||||||
|
toast("All share links are stopped. New ones work as usual.");
|
||||||
|
confirmStopAll = false;
|
||||||
|
void load();
|
||||||
|
} catch (e) {
|
||||||
|
problem = sentence(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const active = $derived(links.filter((l) => l.state === "active"));
|
||||||
|
const ended = $derived(links.filter((l) => l.state !== "active"));
|
||||||
|
const viewer = $derived(app.overview?.viewer ?? null);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<h1 class="ia-display">Settings</h1>
|
||||||
|
<div class="tabs" role="tablist" aria-label="Settings">
|
||||||
|
{#each TABS as t, i (t.id)}
|
||||||
|
<button type="button" role="tab" id="tab-{t.id}" aria-selected={tab === t.id} aria-controls="panel-{t.id}" tabindex={tab === t.id ? 0 : -1}
|
||||||
|
onclick={() => navigate(`/settings/${t.id}`)} onkeydown={(e) => tabKey(e, i)}>{t.label}</button>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{#if problem}<Banner tone="notice" live="status" ondismiss={() => (problem = null)}>{#snippet title()}{problem}{/snippet}</Banner>{/if}
|
||||||
|
|
||||||
|
<div role="tabpanel" id="panel-{tab}" aria-labelledby="tab-{tab}" class="panel">
|
||||||
|
{#if tab === "general"}
|
||||||
|
<p class="ia-label">Routes repository</p>
|
||||||
|
<p>{settings?.repo ? `${settings.repo.name} on Gitea · ${settings.repo.last_push_at ? "pushed " + whenInline(settings.repo.last_push_at, app.now) : "not pushed yet"}` : "No place to push to is set up."}</p>
|
||||||
|
<p class="ia-label">Health watch after apply</p>
|
||||||
|
<p>{settings?.watch_seconds ?? app.overview?.site?.watch_seconds ?? 60} seconds</p>
|
||||||
|
<p class="ia-label">Signed in</p>
|
||||||
|
<p>{viewer ? (viewer.via === "authelia" ? `${viewer.name} through Authelia` : `API token "${viewer.name}"`) : "Through Authelia"}</p>
|
||||||
|
{#if app.overview?.site?.auth_logout_url}<p><a class="domi-btn link" href={app.overview.site.auth_logout_url}>Sign out</a></p>{/if}
|
||||||
|
{:else if tab === "api"}
|
||||||
|
<div class="row">
|
||||||
|
<h2 class="ia-h3">API tokens</h2>
|
||||||
|
<Button variant="outline" icon="plus" onclick={newToken} pending={creating}>New token</Button>
|
||||||
|
<Segmented legend="New tokens expire after" name="token-expiry" bind:value={expiry} options={[{ value: "year", label: "1 year" }, { value: "never", label: "Never" }]} />
|
||||||
|
</div>
|
||||||
|
<p class="ia-hint">The API listens on 127.0.0.1 only. Ianitor keeps a hash of each token, never the token.</p>
|
||||||
|
{#if tokens.length === 0}
|
||||||
|
<div class="ia-frame"><h2 class="ia-h3">No API tokens</h2><p class="ia-text2">Scripts and other Domi apps use a token to talk to Ianitor.</p></div>
|
||||||
|
{:else}
|
||||||
|
<ul class="rows">
|
||||||
|
{#each tokens as t (t.id)}
|
||||||
|
<li>
|
||||||
|
<div class="grow">
|
||||||
|
<span class="tname" class:struck={!!revoked[t.id] || !!t.revoked_at}>{t.name}</span>
|
||||||
|
<span class="ia-sub" style="display:block">
|
||||||
|
{#if revoked[t.id]}Revoked {whenInline(revoked[t.id], app.now)}{:else}Made {shortDate(t.created_at)} · {t.last_used_at ? `last used ${whenInline(t.last_used_at, app.now)}` : "never used"} · {t.expires_at ? `expires ${shortDate(t.expires_at)}` : "never expires"}{/if}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{#if !revoked[t.id] && !t.revoked_at}
|
||||||
|
{#if confirmRevoke === t.id}
|
||||||
|
<span>Revoke "{t.name}"? Anything using it stops working now.</span>
|
||||||
|
<Button small onclick={() => (confirmRevoke = null)} data-autofocus>Cancel</Button>
|
||||||
|
<Button small variant="danger" onclick={() => revoke(t)}>Revoke</Button>
|
||||||
|
{:else}
|
||||||
|
<Button small variant="danger" onclick={() => (confirmRevoke = t.id)}>Revoke</Button>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
{/if}
|
||||||
|
{:else if tab === "share-links"}
|
||||||
|
<div class="row">
|
||||||
|
<h2 class="ia-h3">Share links</h2>
|
||||||
|
{#if active.length}<Button variant="danger" onclick={() => (confirmStopAll = true)}>Stop all share links</Button>{/if}
|
||||||
|
</div>
|
||||||
|
{#if app.overview?.engine.running === "caddy"}
|
||||||
|
<Banner tone="notice">{#snippet title()}Caddy is serving, so these links do not work right now. They work again after switching back to Pingora.{/snippet}</Banner>
|
||||||
|
{/if}
|
||||||
|
{#if confirmStopAll}
|
||||||
|
<p>Stop all {active.length} active links? Every link made so far stops working. New ones work as usual.
|
||||||
|
<Button small onclick={() => (confirmStopAll = false)}>Cancel</Button> <Button small variant="danger" onclick={stopAll}>Stop all</Button></p>
|
||||||
|
{/if}
|
||||||
|
{#if links.length === 0}
|
||||||
|
<div class="ia-frame"><h2 class="ia-h3">No share links</h2><p class="ia-text2">Make one from a host's menu (⋯), Share link.</p></div>
|
||||||
|
{:else}
|
||||||
|
<ul class="rows">
|
||||||
|
{#each active as l (l.id)}
|
||||||
|
<li>
|
||||||
|
<div class="grow"><strong>{l.hostname}</strong>{l.path_prefix !== "/" ? l.path_prefix : ""}
|
||||||
|
<span class="ia-sub" style="display:block">Made {whenInline(l.created_at, app.now)} · expires {whenInline(l.expires_at, app.now)}{l.has_password ? " · password" : ""}</span></div>
|
||||||
|
<Button small onclick={() => stop(l)}>Stop this link</Button>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
{#if ended.length}
|
||||||
|
<details><summary>Ended ({ended.length})</summary>
|
||||||
|
<ul class="rows">{#each ended as l (l.id)}<li><span class="grow">{l.hostname}{l.path_prefix !== "/" ? l.path_prefix : ""}</span><span class="ia-sub">{l.state} {shortDate(l.expires_at)}</span></li>{/each}</ul>
|
||||||
|
</details>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
{:else}
|
||||||
|
<p>Ianitor Domi 0.1.0</p>
|
||||||
|
<p>MPL-2.0</p>
|
||||||
|
<p>Built, tested and signed by Fabrica Domi</p>
|
||||||
|
<p><a class="domi-btn link" href="https://gitea.marek-novak.cz/mnovak/Ianitor" rel="noreferrer">Source on Gitea</a></p>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if made}
|
||||||
|
<Dialog title="Your new token" escape={false} onclose={() => closeToken()}>
|
||||||
|
<p><strong>Copy it now and save it in Custos.</strong></p>
|
||||||
|
<p class="ia-text2">Ianitor cannot show it again; if it is lost, make a new one and revoke this one.</p>
|
||||||
|
<input class="ia-secret" readonly value={made.token} aria-label="New API token" onfocus={(e) => (e.currentTarget as HTMLInputElement).select()} />
|
||||||
|
<div class="grid">
|
||||||
|
<div class="domi-field">
|
||||||
|
<label class="domi-field-label" for="token-name">Name</label>
|
||||||
|
<input id="token-name" class="domi-input" bind:value={tokenName} aria-invalid={nameErr ? "true" : undefined} />
|
||||||
|
{#if nameErr}<p class="domi-error">{nameErr}</p>{/if}
|
||||||
|
<p class="ia-hint">Rename it now or later, so you know what uses it.</p>
|
||||||
|
</div>
|
||||||
|
<Button variant={tokenCopied ? "quiet" : "primary"} icon="copy" onclick={copyToken} data-autofocus>{tokenCopied ? "Copy again" : "Copy token"}</Button>
|
||||||
|
</div>
|
||||||
|
{#if tokenCopied}<p role="status">Copied. Paste it into Custos now. Ianitor cannot show it again.</p>{/if}
|
||||||
|
<p class="ia-muted">{made.expires_at ? `Expires on ${longDate(made.expires_at, false)}.` : "Never expires."}</p>
|
||||||
|
{#if askClose}
|
||||||
|
<p role="alert">Close without copying? The token cannot be shown again.
|
||||||
|
<Button small onclick={() => (askClose = false)}>Go back</Button> <Button small variant="danger" onclick={() => closeToken(true)}>Close anyway</Button></p>
|
||||||
|
{/if}
|
||||||
|
{#snippet footer()}<Button onclick={() => closeToken()}>I have saved it</Button>{/snippet}
|
||||||
|
</Dialog>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.tabs { display: flex; gap: 4px; overflow-x: auto; }
|
||||||
|
.tabs [role="tab"] { min-height: 44px; padding: 0 1rem; border-radius: var(--radius-sm); border: 0; background: none; color: var(--text-2); font-weight: 600; cursor: pointer; }
|
||||||
|
.tabs [role="tab"][aria-selected="true"] { background: var(--surface-2); color: var(--text); }
|
||||||
|
.panel { display: flex; flex-direction: column; gap: 10px; }
|
||||||
|
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
|
||||||
|
.rows { list-style: none; margin: 0; padding: 0; }
|
||||||
|
.rows li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-height: 44px; padding: 8px 0; border-top: 1px solid var(--hairline); }
|
||||||
|
.grow { flex: 1 1 200px; min-width: 0; }
|
||||||
|
.tname { font-weight: 600; }
|
||||||
|
.struck { text-decoration: line-through; color: var(--muted); }
|
||||||
|
.grid { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
|
||||||
|
@media (max-width: 719.98px) { .grid { grid-template-columns: 1fr; } }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||||
|
<script lang="ts">
|
||||||
|
// Handoff §10.2: Authelia sends the sign-in tab back here; it tells the first tab and closes.
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
const back = new URL(location.href).searchParams.get("back");
|
||||||
|
try {
|
||||||
|
const ch = new BroadcastChannel("ianitor-auth");
|
||||||
|
ch.postMessage("signed-in");
|
||||||
|
ch.close();
|
||||||
|
} catch {
|
||||||
|
/* the first tab rechecks with "I have signed in" */
|
||||||
|
}
|
||||||
|
if (back && back.startsWith("/") && !back.startsWith("//")) {
|
||||||
|
location.replace(back);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setTimeout(() => window.close(), 300);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<main class="signed-in">
|
||||||
|
<p class="ia-wordmark">IANITOR DOMI</p>
|
||||||
|
<h1 class="ia-h3">You are signed in again.</h1>
|
||||||
|
<p class="ia-text2">You can close this tab and go back to Ianitor.</p>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.signed-in { max-width: 420px; margin: 20vh auto; padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
|
||||||
|
|
||||||
|
export default { preprocess: vitePreprocess() };
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The release's screenshots (docs/release.md): every shot's screen is drawn from the demo control
|
||||||
|
// plane alone (each click and wait selector found, no call unanswered), and nothing the demo
|
||||||
|
// serves or the page shows names a real host, address or person.
|
||||||
|
|
||||||
|
import { cleanup, render, waitFor } from "@testing-library/svelte";
|
||||||
|
import { afterEach, describe, expect, it } from "vitest";
|
||||||
|
import App from "../src/App.svelte";
|
||||||
|
import { app } from "../src/lib/app.svelte";
|
||||||
|
import { SHOTS, demoApi, realLooking } from "./demo";
|
||||||
|
|
||||||
|
let served: { status: number; path: string; text: string | null }[] = [];
|
||||||
|
|
||||||
|
function start(path: string) {
|
||||||
|
history.replaceState({}, "", path);
|
||||||
|
app.path = path;
|
||||||
|
app.panel = null;
|
||||||
|
app.overview = null;
|
||||||
|
app.etag = null;
|
||||||
|
app.signedOut = false;
|
||||||
|
app.switchResult = null;
|
||||||
|
app.renewedUntil = null;
|
||||||
|
app.dismissed = [];
|
||||||
|
served = [];
|
||||||
|
const api = demoApi();
|
||||||
|
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||||
|
const url = typeof input === "string" ? input : input instanceof URL ? input.pathname + input.search : input.url;
|
||||||
|
const path = url.replace(/^.*\/api\/v1/, "");
|
||||||
|
const a = api(init?.method ?? "GET", path, init?.body ? JSON.parse(String(init.body)) : {});
|
||||||
|
served.push({ status: a.status, path, text: a.text });
|
||||||
|
return new Response(a.text, { status: a.status, headers: { "Content-Type": "application/json" } });
|
||||||
|
}) as typeof fetch;
|
||||||
|
render(App);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pageText(): string[] {
|
||||||
|
const out: string[] = [];
|
||||||
|
const walk = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
|
||||||
|
for (let n = walk.nextNode(); n; n = walk.nextNode()) if (n.textContent?.trim()) out.push(n.textContent);
|
||||||
|
document.querySelectorAll<HTMLInputElement | HTMLTextAreaElement>("input, textarea").forEach((i) => out.push(i.value));
|
||||||
|
document.querySelectorAll("[href]").forEach((a) => out.push(a.getAttribute("href") ?? ""));
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEach(() => cleanup());
|
||||||
|
|
||||||
|
describe("realLooking", () => {
|
||||||
|
it("passes invented names and refuses real-looking ones", () => {
|
||||||
|
expect(realLooking("wiki.home.test http://192.0.2.10:3000 on 127.0.0.1 for ada")).toEqual([]);
|
||||||
|
expect(realLooking("http://10.0.0.2:3000")).toEqual(["10.0.0.2"]);
|
||||||
|
expect(realLooking("gitea.example.cz and Mark's phone")).toEqual(["gitea.example.cz", "mark"]);
|
||||||
|
expect(realLooking("flowers.stage")).toEqual(["flowers.stage", "flowers"]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("the release's screenshots from the demo control plane", () => {
|
||||||
|
for (const shot of SHOTS) {
|
||||||
|
it(`${shot.name}: drawn from invented data only`, async () => {
|
||||||
|
start(shot.path);
|
||||||
|
for (const sel of shot.click ?? []) {
|
||||||
|
const el = await waitFor(() => {
|
||||||
|
const e = document.querySelector<HTMLElement>(sel);
|
||||||
|
expect(e, `click ${sel}`).not.toBeNull();
|
||||||
|
return e as HTMLElement;
|
||||||
|
}, { timeout: 5000 });
|
||||||
|
el.click();
|
||||||
|
}
|
||||||
|
await waitFor(() => expect(document.querySelector(shot.wait), `wait ${shot.wait}`).not.toBeNull(), { timeout: 5000 });
|
||||||
|
|
||||||
|
expect(served.filter((s) => s.status === 404).map((s) => s.path)).toEqual([]);
|
||||||
|
// Control's codes (apply.kept, pki.renew_due) are dotted words, not names.
|
||||||
|
const json = served.map((s) => (s.text ?? "").replace(/"(?:code|message_code|error_code)":"[^"]*"/g, ""));
|
||||||
|
const seen = [...json, ...pageText()];
|
||||||
|
expect(seen.flatMap(realLooking)).toEqual([]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -0,0 +1,291 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The demo control plane for the release's screenshots (docs/release.md): control's answers
|
||||||
|
// (docs/api.md) for a small invented home server, built on the click smoke test's stand-in
|
||||||
|
// (mockApi.ts), whose routes answer every call the demo does not replace. Everything here is
|
||||||
|
// invented: hostnames under .test, addresses in the documentation ranges (RFC 5737), people ada
|
||||||
|
// and felix, made-up commits and fingerprints. demo.test.ts renders every shot from it and fails
|
||||||
|
// on any other name or address.
|
||||||
|
|
||||||
|
import { apply, host, mockRoutes, newMock, nowMs, respond, type Route } from "./mockApi";
|
||||||
|
|
||||||
|
/** One screenshot: the page, the selectors clicked in order, and the selector that means "drawn". */
|
||||||
|
export interface Shot {
|
||||||
|
name: string;
|
||||||
|
title: string;
|
||||||
|
path: string;
|
||||||
|
click?: string[];
|
||||||
|
wait: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The viewport in CSS pixels; the PNGs are this size. */
|
||||||
|
export const SIZE = { width: 1440, height: 900 } as const;
|
||||||
|
|
||||||
|
export const SHOTS: Shot[] = [
|
||||||
|
{ name: "hosts", title: "Every host, its health and where it sends traffic", path: "/", wait: "[aria-label=Hosts] .ia-row:nth-child(8) .ia-host" },
|
||||||
|
{ name: "host", title: "Editing a host", path: "/hosts/wiki.home.test/edit", wait: "#host-form input[readonly]" },
|
||||||
|
{ name: "engine", title: "Pingora serving, Caddy ready as the fallback", path: "/", click: ["[data-engine-chip]"], wait: "dialog.ia-popover[open] .ia-card" },
|
||||||
|
{ name: "history", title: "History: going back to a kept version", path: "/history/ch_0006", wait: "section.detail ul li:nth-child(2)" },
|
||||||
|
{ name: "certificates", title: "The Domi CA and the device certificates", path: "/certificates", wait: "ul.devices li:nth-child(5)" },
|
||||||
|
];
|
||||||
|
|
||||||
|
type Json = Record<string, unknown>;
|
||||||
|
|
||||||
|
const DAY = 86_400;
|
||||||
|
const at = (s: number) => new Date(nowMs() + s * 1000).toISOString();
|
||||||
|
|
||||||
|
interface Health {
|
||||||
|
state: string;
|
||||||
|
latency?: number | null;
|
||||||
|
upstreams?: Json[];
|
||||||
|
failure?: Json | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function demoHost(hostname: string, upstreams: string[], h: Health, over: Json = {}): Json {
|
||||||
|
const base = host(hostname, false);
|
||||||
|
return {
|
||||||
|
...base,
|
||||||
|
upstreams,
|
||||||
|
health: {
|
||||||
|
state: h.state,
|
||||||
|
last_check_at: h.state === "unknown" ? null : at(-4),
|
||||||
|
latency_ms: h.latency ?? null,
|
||||||
|
since: at(-6 * DAY),
|
||||||
|
failure: h.failure ?? null,
|
||||||
|
upstreams: h.upstreams ?? [],
|
||||||
|
},
|
||||||
|
...over,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const MUSIC = ["http://192.0.2.20:4533", "http://192.0.2.21:4533"];
|
||||||
|
|
||||||
|
function hosts(): Json[] {
|
||||||
|
return [
|
||||||
|
demoHost("wiki.home.test", ["http://192.0.2.10:3000"], { state: "healthy", latency: 9 }, { share_links: true }),
|
||||||
|
demoHost("photos.home.test", ["http://192.0.2.11:2342"], { state: "healthy", latency: 23 }),
|
||||||
|
demoHost("recipes.home.test", ["http://192.0.2.12:9000"], { state: "healthy", latency: 14 }, { added_at: at(-2 * 3600) }),
|
||||||
|
demoHost("music.home.test", MUSIC, {
|
||||||
|
state: "degraded",
|
||||||
|
latency: 18,
|
||||||
|
failure: { kind: "refused", upstream: MUSIC[1], count: 3, of: 3 },
|
||||||
|
upstreams: [
|
||||||
|
{ url: MUSIC[0], state: "healthy", last_check_at: at(-4), latency_ms: 18, failure_kind: null },
|
||||||
|
{ url: MUSIC[1], state: "down", last_check_at: at(-4), latency_ms: null, failure_kind: "refused" },
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
demoHost("cameras.home.test", ["https://192.0.2.30:7443"], { state: "healthy", latency: 31 }, { device_certs: true }),
|
||||||
|
demoHost("status.home.test", ["http://192.0.2.40:3001"], { state: "healthy", latency: 6 }, { tls: "letsencrypt", auth: "none" }),
|
||||||
|
demoHost("printer.home.test", ["http://192.0.2.50:631"], { state: "unknown" }, { websockets: false }),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function lastApply(): Json {
|
||||||
|
return {
|
||||||
|
...apply("ch_0008", "kept", "Added recipes.home.test", ["recipes.home.test"]),
|
||||||
|
created_at: at(-2 * 3600 - 70),
|
||||||
|
finished_at: at(-2 * 3600),
|
||||||
|
reason: { code: "apply.kept", message: "recipes.home.test is live. Health checks passed for 60 s." },
|
||||||
|
commit_short: "c41d7e2",
|
||||||
|
push: { state: "pushed", at: at(-2 * 3600), error_code: null, next_try_at: null },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function intermediate(): Json {
|
||||||
|
return { state: "ok", subject: "Demo Intermediate CA", not_after: at(212 * DAY), days_left: 212, renewal: null, banner: null };
|
||||||
|
}
|
||||||
|
|
||||||
|
function overview(added: Json[] = []): Json {
|
||||||
|
const list = [...hosts(), ...added];
|
||||||
|
const count = (s: string) => list.filter((h) => (h.health as Json).state === s).length;
|
||||||
|
return {
|
||||||
|
counts: { hosts: list.length, healthy: count("healthy"), degraded: count("degraded"), down: count("down"), unknown: count("unknown") },
|
||||||
|
hosts: list,
|
||||||
|
engine: {
|
||||||
|
running: "pingora",
|
||||||
|
state: "running",
|
||||||
|
since: at(-6 * DAY),
|
||||||
|
target: null,
|
||||||
|
switchable: true,
|
||||||
|
fallback_ready: {
|
||||||
|
built_at: at(-2 * 3600),
|
||||||
|
current: true,
|
||||||
|
compared: list.length,
|
||||||
|
matched: list.length,
|
||||||
|
differences: ["Every host: Caddy adds its own Server and Via headers to answers, and a Content-Type when your service sends none."],
|
||||||
|
},
|
||||||
|
last_error: null,
|
||||||
|
notes: [],
|
||||||
|
},
|
||||||
|
last_apply: lastApply(),
|
||||||
|
undo: {
|
||||||
|
available: true,
|
||||||
|
target: { change_id: "ch_0008", summary: "Added recipes.home.test", kept_at: at(-2 * 3600), commit_short: "c41d7e2" },
|
||||||
|
effect: "Removes recipes.home.test",
|
||||||
|
blocked: null,
|
||||||
|
},
|
||||||
|
active_apply: null,
|
||||||
|
repo: { name: "home-routes", last_push_at: at(-2 * 3600), unpushed: 0, push_error_code: null },
|
||||||
|
intermediate: intermediate(),
|
||||||
|
site: { forward_auth_configured: true, acme_configured: true, secrets: ["photos_api_key"], watch_seconds: 60, share_links_available: true, auth_logout_url: "https://auth.home.test/logout" },
|
||||||
|
paused: null,
|
||||||
|
paused_reason: null,
|
||||||
|
health_error: null,
|
||||||
|
rev: "rev-demo-8",
|
||||||
|
viewer: { name: "ada", via: "authelia" },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function spec(hostname: string): Json | null {
|
||||||
|
const row = hosts().find((h) => h.hostname === hostname);
|
||||||
|
if (!row) return null;
|
||||||
|
const wiki = hostname === "wiki.home.test";
|
||||||
|
return {
|
||||||
|
hostname,
|
||||||
|
upstreams: row.upstreams,
|
||||||
|
tls: row.tls,
|
||||||
|
auth: row.auth,
|
||||||
|
websockets: row.websockets,
|
||||||
|
share_links: row.share_links,
|
||||||
|
device_certs: row.device_certs,
|
||||||
|
access_log: wiki ? "truncated" : "off",
|
||||||
|
health_check: (row.health as Json).state === "unknown" ? null : { path: wiki ? "/healthz" : "/", interval_secs: 30 },
|
||||||
|
request_headers: [],
|
||||||
|
response_headers: wiki ? [{ action: "set", name: "X-Frame-Options", value: "SAMEORIGIN" }] : [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const HISTORY = [
|
||||||
|
{ change_id: "ch_0008", summary: "Added recipes.home.test", kind: "add", state: "kept", ago: 2 * 3600, commit_short: "c41d7e2", hosts: ["recipes.home.test"], reason_short: null },
|
||||||
|
{ change_id: "ch_0007", summary: "Changed music.home.test", kind: "edit", state: "kept", ago: 1 * DAY, commit_short: "8e03b5a", hosts: ["music.home.test"], reason_short: null },
|
||||||
|
{ change_id: "ch_0006", summary: "Turned share links on for wiki.home.test", kind: "share_links", state: "kept", ago: 2 * DAY, commit_short: "5a9f210", hosts: ["wiki.home.test"], reason_short: null },
|
||||||
|
{ change_id: "ch_0005", summary: "Changed photos.home.test", kind: "edit", state: "reverted", ago: 3 * DAY, commit_short: null, hosts: ["photos.home.test"], reason_short: "photos.home.test answered 502 during the watch" },
|
||||||
|
{ change_id: "ch_0004", summary: "Added cameras.home.test", kind: "add", state: "kept", ago: 5 * DAY, commit_short: "0b7c4e9", hosts: ["cameras.home.test"], reason_short: null },
|
||||||
|
{ change_id: "ch_0003", summary: "Added printer.home.test", kind: "add", state: "kept", ago: 9 * DAY, commit_short: "e2d81f6", hosts: ["printer.home.test"], reason_short: null },
|
||||||
|
{ change_id: "ch_0002", summary: "Added status.home.test", kind: "add", state: "kept", ago: 12 * DAY, commit_short: "73a6c05", hosts: ["status.home.test"], reason_short: null },
|
||||||
|
{ change_id: "ch_0001", summary: "Added wiki.home.test", kind: "add", state: "kept", ago: 20 * DAY, commit_short: "1f4b9a3", hosts: ["wiki.home.test"], reason_short: null },
|
||||||
|
];
|
||||||
|
|
||||||
|
function history(): Json {
|
||||||
|
return { entries: HISTORY.map(({ ago, ...e }) => ({ ...e, at: at(-ago) })), next_before: null };
|
||||||
|
}
|
||||||
|
|
||||||
|
function restorePreview(id: string): Json {
|
||||||
|
if (id === "ch_0008") return { restorable: false, same_as_current: true, changes: [], blocked: { code: "restore.same", message: "This version is the same as the current one." } };
|
||||||
|
return {
|
||||||
|
restorable: true,
|
||||||
|
same_as_current: false,
|
||||||
|
changes: [
|
||||||
|
{ hostname: "recipes.home.test", effect: "removed", fields: [] },
|
||||||
|
{ hostname: "music.home.test", effect: "changed", fields: [{ field: "upstreams", from: MUSIC.join(", "), to: MUSIC[0] }] },
|
||||||
|
],
|
||||||
|
blocked: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function certs(): Json {
|
||||||
|
const device = (id: string, name: string, kind: string, made: number, until: number, revoked: number | null = null) => ({
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
kind,
|
||||||
|
created_at: at(-made * DAY),
|
||||||
|
not_after: at(until * DAY),
|
||||||
|
state: revoked === null ? "valid" : "revoked",
|
||||||
|
revoked_at: revoked === null ? null : at(-revoked * DAY),
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
intermediate: intermediate(),
|
||||||
|
root: { offline: true, subject: "Demo Root CA", not_after: at(3000 * DAY), sha256: "5c0f9e2a71d84b36a8e1f40c2d9b7e6315a2c8d04f9b1e7a6c3d5f8e0b2a4c61" },
|
||||||
|
devices: [
|
||||||
|
device("dv_1", "ada's phone", "phone", 40, 325),
|
||||||
|
device("dv_2", "felix's laptop", "computer", 61, 304),
|
||||||
|
device("dv_3", "Kitchen tablet", "phone", 345, 20),
|
||||||
|
device("dv_4", "Notes app on the desk PC", "app", 12, 353),
|
||||||
|
device("dv_5", "Old phone", "phone", 200, 165, 30),
|
||||||
|
],
|
||||||
|
device_lifetime_days: 365,
|
||||||
|
device_valid_until: null,
|
||||||
|
server_lifetime_days: 90,
|
||||||
|
approval: "manual",
|
||||||
|
requests: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The demo's own answers, first; the smoke test's stand-in answers the rest. A host added in the
|
||||||
|
* demo (the e2e suite's Add host flow) is listed from then on, healthy, with the upstream it was
|
||||||
|
* given; a device certificate request carries the name it was asked with. */
|
||||||
|
export function demoRoutes(): Route[] {
|
||||||
|
const m = newMock();
|
||||||
|
const added: Json[] = [];
|
||||||
|
let device = "";
|
||||||
|
const request = (state: "waiting" | "approved"): Json => ({
|
||||||
|
request_id: "pr_dev",
|
||||||
|
kind: "device",
|
||||||
|
state,
|
||||||
|
match_code: "47 19 83",
|
||||||
|
created_at: at(-5),
|
||||||
|
expires_at: at(600),
|
||||||
|
approved_at: state === "approved" ? at(0) : null,
|
||||||
|
device_id: state === "approved" ? "dv_1" : null,
|
||||||
|
name: device,
|
||||||
|
csr_pem: null,
|
||||||
|
not_after: state === "approved" ? at(365 * DAY) : null,
|
||||||
|
message_code: state === "approved" ? "pki.issued" : "pki.waiting.manual",
|
||||||
|
message: state === "approved" ? `${device} has a certificate.` : "Approve it on the server with the match code.",
|
||||||
|
approve_command: state === "approved" ? null : "ianitor-control pki approve 47 19 83",
|
||||||
|
problem: null,
|
||||||
|
});
|
||||||
|
return [
|
||||||
|
["GET", /^\/overview$/, () => [200, overview(added)]],
|
||||||
|
["POST", /^\/hosts$/, (_, b) => {
|
||||||
|
const h = b.host as Json;
|
||||||
|
const name = String(h.hostname);
|
||||||
|
m.state.hostsAdded.push(name);
|
||||||
|
const ups = Array.isArray(h.upstreams) ? h.upstreams.map(String) : [];
|
||||||
|
added.push(demoHost(name, ups, { state: "healthy", latency: 11 }, { added_at: at(0) }));
|
||||||
|
return [202, { apply: apply("ch_new", "queued", `Added ${name}`, [name]) }];
|
||||||
|
}],
|
||||||
|
["POST", /^\/certs\/devices$/, (_, b) => {
|
||||||
|
device = String(b.name ?? "");
|
||||||
|
return [202, request("waiting")];
|
||||||
|
}],
|
||||||
|
["GET", /^\/pki-requests\/pr_dev$/, () => [200, request("approved")]],
|
||||||
|
// A share link whose token cannot be read as a name (the stand-in's `ish1.abc` would be).
|
||||||
|
["POST", /^\/hosts\/([^/]+)\/share-links$/, (mm) => [201, { id: "sl_demo", url: `https://${decodeURIComponent(mm[1])}/?share=ish1.4f9c2a7e1b0d`, expires_at: at(7 * DAY), path_prefix: "/", has_password: false, warning: null }]],
|
||||||
|
["GET", /^\/hosts\/([^/?]+)$/, (mm) => {
|
||||||
|
const s = spec(decodeURIComponent(mm[1]));
|
||||||
|
return s ? [200, { host: s, rev: "rev-demo-8" }] : [404, { error: { code: "host.not_found", message: "There is no such host.", field: null, params: {}, retry_after_s: null, detail: null }, errors: [], request_id: "demo" }];
|
||||||
|
}],
|
||||||
|
["GET", /^\/history(\?.*)?$/, () => [200, history()]],
|
||||||
|
["GET", /^\/history\/([^/]+)\/restore-preview$/, (mm) => [200, restorePreview(decodeURIComponent(mm[1]))]],
|
||||||
|
["GET", /^\/certs$/, () => [200, certs()]],
|
||||||
|
["GET", /^\/settings$/, () => [200, { repo: { name: "home-routes", last_push_at: at(-2 * 3600) }, watch_seconds: 60 }]],
|
||||||
|
...mockRoutes(m),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Control's API for the demo: `path` is what follows /api/v1 (with its query). */
|
||||||
|
export function demoApi(): (method: string, path: string, body: Json) => { status: number; text: string | null } {
|
||||||
|
const routes = demoRoutes();
|
||||||
|
return (method, path, body) => respond(routes, method.toUpperCase(), path, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// What the demo may show (demo.test.ts, and the e2e suite on every page it visits).
|
||||||
|
const ALLOWED_TLDS = new Set(["test", "example", "invalid"]);
|
||||||
|
const DOC_NETS = ["192.0.2.", "198.51.100.", "203.0.113."];
|
||||||
|
const FORBIDDEN = ["mark", "marek", "novak", "flowers", "esp32", "hyperv"];
|
||||||
|
|
||||||
|
/** What in a text could be real: addresses outside the documentation ranges, names outside .test. */
|
||||||
|
export function realLooking(text: string): string[] {
|
||||||
|
const found: string[] = [];
|
||||||
|
for (const m of text.matchAll(/(?<![\w.])\d{1,3}(?:\.\d{1,3}){3}(?![\w.])/g)) {
|
||||||
|
if (m[0] !== "127.0.0.1" && !DOC_NETS.some((n) => m[0].startsWith(n))) found.push(m[0]);
|
||||||
|
}
|
||||||
|
for (const m of text.matchAll(/(?<![\w.-])(?:[a-z0-9-]+\.)+([a-z][a-z0-9-]*)(?![\w-])/gi)) {
|
||||||
|
if (!ALLOWED_TLDS.has(m[1].toLowerCase())) found.push(m[0]);
|
||||||
|
}
|
||||||
|
for (const w of FORBIDDEN) if (new RegExp(`\\b${w}\\b`, "i").test(text)) found.push(w);
|
||||||
|
return found;
|
||||||
|
}
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// The smoke test of every ROADMAP §4 flow with its clicks counted (handoff §4, §15): the real
|
||||||
|
// app against a stand-in for control's API. Typing, focus and waiting are not clicks.
|
||||||
|
|
||||||
|
import { cleanup, render, screen, waitFor, within } from "@testing-library/svelte";
|
||||||
|
import userEvent from "@testing-library/user-event";
|
||||||
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
import App from "../src/App.svelte";
|
||||||
|
import { app } from "../src/lib/app.svelte";
|
||||||
|
import { installMock, type Mock } from "./mockApi";
|
||||||
|
|
||||||
|
let mock: Mock;
|
||||||
|
let clicks = 0;
|
||||||
|
let user: ReturnType<typeof userEvent.setup>;
|
||||||
|
|
||||||
|
async function click(el: Element) {
|
||||||
|
clicks++;
|
||||||
|
await user.click(el);
|
||||||
|
}
|
||||||
|
|
||||||
|
function start(path = "/") {
|
||||||
|
history.replaceState({}, "", path);
|
||||||
|
app.path = path;
|
||||||
|
app.panel = null;
|
||||||
|
app.overview = null;
|
||||||
|
app.etag = null;
|
||||||
|
app.signedOut = false;
|
||||||
|
app.switchResult = null;
|
||||||
|
app.renewedUntil = null;
|
||||||
|
app.dismissed = [];
|
||||||
|
mock = installMock();
|
||||||
|
clicks = 0;
|
||||||
|
user = userEvent.setup();
|
||||||
|
render(App);
|
||||||
|
}
|
||||||
|
|
||||||
|
const called = (method: string, path: string) => mock.calls.some((c) => c.method === method && c.path.startsWith(path));
|
||||||
|
const T = { timeout: 5000 };
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
try {
|
||||||
|
sessionStorage.clear();
|
||||||
|
} catch {
|
||||||
|
/* none */
|
||||||
|
}
|
||||||
|
});
|
||||||
|
afterEach(() => cleanup());
|
||||||
|
|
||||||
|
describe("ROADMAP §4 flows, clicks counted", () => {
|
||||||
|
it("Add host: + Host → fill → Apply = 2 clicks, auto-kept", async () => {
|
||||||
|
start();
|
||||||
|
await click(await screen.findByRole("button", { name: "Add a host" }));
|
||||||
|
await user.type(await screen.findByLabelText("Hostname"), "recipes.home.test");
|
||||||
|
await user.type(screen.getByLabelText("Send traffic to"), "http://10.0.0.5:8080");
|
||||||
|
await click(screen.getByRole("button", { name: "Apply" }));
|
||||||
|
// Kept: the panel closes by itself and the new host is in the list.
|
||||||
|
await waitFor(() => expect(called("GET", "/applies/ch_new")).toBe(true), T);
|
||||||
|
await waitFor(() => expect(document.querySelector("dialog.ia-panel")).toBeNull(), T);
|
||||||
|
await screen.findByRole("button", { name: "More for recipes.home.test" }, T);
|
||||||
|
expect(called("POST", "/hosts")).toBe(true);
|
||||||
|
const sent = mock.calls.find((c) => c.method === "POST" && c.path === "/hosts")?.body as { host: Record<string, unknown> };
|
||||||
|
// Every field is sent explicitly, with the design's defaults.
|
||||||
|
expect(sent.host).toMatchObject({ hostname: "recipes.home.test", tls: "domi", auth: "forward-auth", websockets: true });
|
||||||
|
expect(clicks).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Undo last change = 1 click", async () => {
|
||||||
|
start();
|
||||||
|
await click(await screen.findByRole("button", { name: /^Undo: Added recipes\.home\.test/ }));
|
||||||
|
await waitFor(() => expect(called("POST", "/undo")).toBe(true));
|
||||||
|
const body = mock.calls.find((c) => c.path === "/undo" && c.method === "POST")?.body as Record<string, string>;
|
||||||
|
expect(body.target_change_id).toBe("ch_1");
|
||||||
|
expect(clicks).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Restore: History → pick → Restore = 3 clicks", async () => {
|
||||||
|
start();
|
||||||
|
await screen.findByRole("button", { name: "Add a host" });
|
||||||
|
const nav = screen.getAllByRole("navigation", { name: "Main" })[0];
|
||||||
|
await click(within(nav).getByRole("link", { name: "History" }));
|
||||||
|
await click(await screen.findByRole("button", { name: /Changed wiki\.home\.test/ }));
|
||||||
|
await screen.findByText(/sends traffic to changes from/);
|
||||||
|
await click(await screen.findByRole("button", { name: "Restore this version" }));
|
||||||
|
await waitFor(() => expect(called("POST", "/restore")).toBe(true));
|
||||||
|
expect(clicks).toBe(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Share link: ⋯ → Share link → Copy = 3 clicks (default expiry 7 days)", async () => {
|
||||||
|
start();
|
||||||
|
await click(await screen.findByRole("button", { name: "More for wiki.home.test" }));
|
||||||
|
await click(await screen.findByRole("menuitem", { name: /Share link/ }));
|
||||||
|
const copy = await screen.findByRole("button", { name: "Copy link" });
|
||||||
|
await waitFor(() => expect(copy.getAttribute("aria-disabled")).toBeNull());
|
||||||
|
await click(copy);
|
||||||
|
await screen.findByText("Copied");
|
||||||
|
const mint = mock.calls.find((c) => c.method === "POST" && c.path.endsWith("/share-links"))?.body as Record<string, unknown>;
|
||||||
|
expect(mint.expires_in_s).toBe(604800);
|
||||||
|
expect(await navigator.clipboard.readText()).toContain("?share=ish1.");
|
||||||
|
expect(clicks).toBe(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Share link on a host with links off: 4 clicks (Mark, Q1: the accepted 4th)", async () => {
|
||||||
|
start();
|
||||||
|
await click(await screen.findByRole("button", { name: "More for photos.home.test" }));
|
||||||
|
await click(await screen.findByRole("menuitem", { name: /Share link/ }));
|
||||||
|
await click(await screen.findByRole("button", { name: "Turn on share links" }));
|
||||||
|
const copy = await screen.findByRole("button", { name: "Copy link" }, T);
|
||||||
|
await waitFor(() => expect(copy.getAttribute("aria-disabled")).toBeNull());
|
||||||
|
await click(copy);
|
||||||
|
await screen.findByText("Copied");
|
||||||
|
expect(called("PATCH", "/hosts/photos.home.test")).toBe(true);
|
||||||
|
expect(clicks).toBe(4);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Switch engine: engine chip → Switch to Caddy = 2 clicks", async () => {
|
||||||
|
start();
|
||||||
|
await click(await screen.findByRole("button", { name: /^Engine: Pingora/ }));
|
||||||
|
await click(await screen.findByRole("button", { name: "Switch to Caddy" }));
|
||||||
|
await waitFor(() => expect(called("POST", "/engine")).toBe(true));
|
||||||
|
const body = mock.calls.find((c) => c.method === "POST" && c.path === "/engine")?.body as Record<string, string>;
|
||||||
|
expect(body.target).toBe("caddy");
|
||||||
|
await screen.findByText("Now serving with Caddy.", {}, T);
|
||||||
|
expect(clicks).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Device certificate: Certificates → + Device → Issue = 3 clicks; install is the accepted 4th", async () => {
|
||||||
|
start();
|
||||||
|
await screen.findByRole("button", { name: "Add a host" });
|
||||||
|
const nav = screen.getAllByRole("navigation", { name: "Main" })[0];
|
||||||
|
await click(within(nav).getByRole("link", { name: "Certificates" }));
|
||||||
|
await click(await screen.findByRole("button", { name: "Add a device certificate" }));
|
||||||
|
await user.type(await screen.findByLabelText("Device name"), "Mark's phone");
|
||||||
|
await click(screen.getByRole("button", { name: "Issue" }));
|
||||||
|
await screen.findByLabelText("Match code 47 19 83");
|
||||||
|
expect(clicks).toBe(3);
|
||||||
|
// Approved on the server (the stand-in approves on the first poll).
|
||||||
|
await click(await screen.findByRole("button", { name: "Show QR code" }, T));
|
||||||
|
await screen.findByText("ABCD-EFGH-JKLM-NPQR");
|
||||||
|
expect(clicks).toBe(4);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Renew intermediate: banner Renew = 1 click", async () => {
|
||||||
|
start();
|
||||||
|
await click(await screen.findByRole("button", { name: "Renew" }));
|
||||||
|
await waitFor(() => expect(called("POST", "/certs/intermediate/renewal")).toBe(true));
|
||||||
|
// The renewal is waiting: the banner says where to sign it (no code to compare with openssl).
|
||||||
|
await screen.findByRole("button", { name: "Sign it by hand" });
|
||||||
|
expect(clicks).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("API token: ⚙ → API → New token = 3 clicks; Copy token is the accepted 4th", async () => {
|
||||||
|
start();
|
||||||
|
await screen.findByRole("button", { name: "Add a host" });
|
||||||
|
const nav = screen.getAllByRole("navigation", { name: "Main" })[0];
|
||||||
|
await click(within(nav).getByRole("link", { name: "Settings" }));
|
||||||
|
await click(await screen.findByRole("tab", { name: "API" }));
|
||||||
|
await click(await screen.findByRole("button", { name: "New token" }));
|
||||||
|
const box = (await screen.findByLabelText("New API token")) as HTMLInputElement;
|
||||||
|
expect(box.value).toBe("ian_tk1_secretvalue");
|
||||||
|
expect(clicks).toBe(3);
|
||||||
|
await click(screen.getByRole("button", { name: "Copy token" }));
|
||||||
|
expect(await navigator.clipboard.readText()).toBe("ian_tk1_secretvalue");
|
||||||
|
expect(clicks).toBe(4);
|
||||||
|
// The token is never stored by the page.
|
||||||
|
expect(JSON.stringify({ ...sessionStorage })).not.toContain("ian_tk1");
|
||||||
|
expect(JSON.stringify({ ...localStorage })).not.toContain("ian_tk1");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("focus", () => {
|
||||||
|
it("+ Host puts the cursor in Hostname, so typing right after the click lands there", async () => {
|
||||||
|
start();
|
||||||
|
await click(await screen.findByRole("button", { name: "Add a host" }));
|
||||||
|
await user.keyboard("recipes.home.test");
|
||||||
|
expect((await screen.findByLabelText("Hostname") as HTMLInputElement).value).toBe("recipes.home.test");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("the share dialog opens on Copy link and gives focus back to the row's More button", async () => {
|
||||||
|
start();
|
||||||
|
const more = await screen.findByRole("button", { name: "More for wiki.home.test" });
|
||||||
|
await click(more);
|
||||||
|
await click(await screen.findByRole("menuitem", { name: /Share link/ }));
|
||||||
|
const copy = await screen.findByRole("button", { name: "Copy link" });
|
||||||
|
await waitFor(() => expect(document.activeElement).toBe(copy));
|
||||||
|
// jsdom fires no cancel event on Esc for a modal dialog: close it with its button.
|
||||||
|
await click(screen.getByRole("button", { name: "Close" }));
|
||||||
|
await waitFor(() => expect(screen.queryByRole("button", { name: "Copy link" })).toBeNull());
|
||||||
|
await waitFor(() => expect(document.activeElement).toBe(more));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("the engine popover closes with Esc and focus goes back to the chip", async () => {
|
||||||
|
start();
|
||||||
|
const chip = await screen.findByRole("button", { name: /^Engine: Pingora/ });
|
||||||
|
await click(chip);
|
||||||
|
await screen.findByRole("button", { name: "Switch to Caddy" });
|
||||||
|
await user.keyboard("{Escape}");
|
||||||
|
await waitFor(() => expect(screen.queryByRole("button", { name: "Switch to Caddy" })).toBeNull());
|
||||||
|
expect(document.activeElement).toBe(screen.getByRole("button", { name: /^Engine: Pingora/ }));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("a click on the engine chip while its popover is open closes it", async () => {
|
||||||
|
start();
|
||||||
|
const chip = await screen.findByRole("button", { name: /^Engine: Pingora/ });
|
||||||
|
await click(chip);
|
||||||
|
await screen.findByRole("button", { name: "Switch to Caddy" });
|
||||||
|
await new Promise((r) => setTimeout(r, 10));
|
||||||
|
await click(chip);
|
||||||
|
await waitFor(() => expect(screen.queryByRole("button", { name: "Switch to Caddy" })).toBeNull());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("sign-in and contact", () => {
|
||||||
|
it("a 401 without Ianitor's envelope shows the signed-out dialog", async () => {
|
||||||
|
start();
|
||||||
|
await screen.findByRole("button", { name: "Add a host" });
|
||||||
|
globalThis.fetch = (async () => new Response("", { status: 401 })) as typeof fetch;
|
||||||
|
app.etag = null;
|
||||||
|
await click(screen.getByRole("button", { name: "Add a host" }));
|
||||||
|
await user.type(await screen.findByLabelText("Hostname"), "x.home.test");
|
||||||
|
await user.type(screen.getByLabelText("Send traffic to"), "http://10.0.0.5:8080");
|
||||||
|
await click(screen.getByRole("button", { name: "Apply" }));
|
||||||
|
await screen.findByRole("alertdialog", { name: "Your sign-in has ended" });
|
||||||
|
// What was typed is still there.
|
||||||
|
expect((screen.getByLabelText("Hostname") as HTMLInputElement).value).toBe("x.home.test");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("every request carries the UI header and no token", async () => {
|
||||||
|
const seen: Headers[] = [];
|
||||||
|
start();
|
||||||
|
const inner = globalThis.fetch;
|
||||||
|
globalThis.fetch = (async (i: RequestInfo | URL, init?: RequestInit) => {
|
||||||
|
seen.push(new Headers(init?.headers));
|
||||||
|
return inner(i, init);
|
||||||
|
}) as typeof fetch;
|
||||||
|
await click(await screen.findByRole("button", { name: /^Undo:/ }));
|
||||||
|
await waitFor(() => expect(seen.length).toBeGreaterThan(0));
|
||||||
|
for (const h of seen) {
|
||||||
|
expect(h.get("X-Ianitor-UI")).toBe("1");
|
||||||
|
expect(h.get("Authorization")).toBeNull();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// A stateful stand-in for control's API, shaped like the real answers (docs/api.md), so the
|
||||||
|
// smoke tests can walk every §4 flow and count its clicks. Its builders and routes are also the
|
||||||
|
// base of the screenshots' demo control plane (demo.ts, docs/release.md).
|
||||||
|
|
||||||
|
type Json = Record<string, unknown>;
|
||||||
|
|
||||||
|
export interface Mock {
|
||||||
|
calls: { method: string; path: string; body: unknown }[];
|
||||||
|
state: {
|
||||||
|
engine: "pingora" | "caddy";
|
||||||
|
switching: number;
|
||||||
|
intermediate: "ok" | "due";
|
||||||
|
renewal: boolean;
|
||||||
|
requestPolls: number;
|
||||||
|
hostsAdded: string[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The stand-in's clock: the real one, or a fixed instant (the e2e suite's, so two takes of a screen match). */
|
||||||
|
export const clock: { fixed: number | null } = { fixed: null };
|
||||||
|
export const nowMs = () => clock.fixed ?? Date.now();
|
||||||
|
const now = () => new Date(nowMs()).toISOString();
|
||||||
|
const later = (s: number) => new Date(nowMs() + s * 1000).toISOString();
|
||||||
|
|
||||||
|
export function host(hostname: string, share: boolean) {
|
||||||
|
return {
|
||||||
|
hostname,
|
||||||
|
upstreams: ["http://10.0.0.2:3000"],
|
||||||
|
tls: "domi",
|
||||||
|
auth: "forward-auth",
|
||||||
|
websockets: true,
|
||||||
|
share_links: share,
|
||||||
|
device_certs: false,
|
||||||
|
added_at: null,
|
||||||
|
health: { state: "healthy", last_check_at: now(), latency_ms: 12, since: now(), failure: null, upstreams: [] },
|
||||||
|
certificate: { state: "ok", not_after: later(86400 * 80), error_code: null },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function apply(id: string, state: string, summary: string, hosts: string[]) {
|
||||||
|
return {
|
||||||
|
id,
|
||||||
|
change_id: id,
|
||||||
|
kind: "add",
|
||||||
|
summary,
|
||||||
|
hosts,
|
||||||
|
state,
|
||||||
|
created_at: now(),
|
||||||
|
finished_at: state === "kept" ? now() : null,
|
||||||
|
steps: ["validate", "compile", "write", "reload", "watch", "push"].map((key) => ({ key, state: state === "kept" ? "done" : "pending" })),
|
||||||
|
queue: null,
|
||||||
|
watch: null,
|
||||||
|
reason: state === "kept" ? { code: "apply.kept", message: `${hosts[0]} is live. Health checks passed for 60 s.` } : null,
|
||||||
|
errors: [],
|
||||||
|
commit_short: "4f1c2ab",
|
||||||
|
push: null,
|
||||||
|
attempted_host: null,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** One API call: method, the path after /api/v1, and its answer as [status, body]. */
|
||||||
|
export type Route = [string, RegExp, (mm: RegExpMatchArray, body: Json) => [number, unknown]];
|
||||||
|
|
||||||
|
export function newMock(): Mock {
|
||||||
|
return {
|
||||||
|
calls: [],
|
||||||
|
state: { engine: "pingora", switching: 0, intermediate: "due", renewal: false, requestPolls: 0, hostsAdded: [] },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The first route that matches answers, with server_time added as control does; else control's 404. */
|
||||||
|
export function respond(routes: Route[], method: string, path: string, body: Json): { status: number; text: string | null } {
|
||||||
|
for (const [mm, re, f] of routes) {
|
||||||
|
const match = path.match(re);
|
||||||
|
if (mm === method && match) {
|
||||||
|
const [status, data] = f(match, body);
|
||||||
|
const withTime = data && typeof data === "object" ? { ...(data as Json), server_time: now() } : data;
|
||||||
|
return { status, text: status === 204 ? null : JSON.stringify(withTime) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { status: 404, text: JSON.stringify({ error: { code: "request.not_found", message: "There is no such API call.", field: null, params: {}, retry_after_s: null, detail: null }, errors: [], request_id: "x" }) };
|
||||||
|
}
|
||||||
|
|
||||||
|
export function mockRoutes(m: Mock): Route[] {
|
||||||
|
const overview = (): Json => ({
|
||||||
|
counts: { hosts: 2 + m.state.hostsAdded.length, healthy: 2, degraded: 0, down: 0, unknown: 0 },
|
||||||
|
hosts: [host("wiki.home.test", true), host("photos.home.test", false), ...m.state.hostsAdded.map((h) => host(h, false))],
|
||||||
|
engine: {
|
||||||
|
running: m.state.engine,
|
||||||
|
state: m.state.switching > 0 ? "switching" : "running",
|
||||||
|
since: now(),
|
||||||
|
target: null,
|
||||||
|
switchable: true,
|
||||||
|
fallback_ready: { built_at: now(), current: true, compared: 3, matched: 3, differences: ["Every host: Caddy adds its own Server and Via headers to answers, and a Content-Type when your service sends none."] },
|
||||||
|
last_error: null,
|
||||||
|
notes: [],
|
||||||
|
},
|
||||||
|
last_apply: apply("ch_1", "kept", "Added recipes.home.test", ["recipes.home.test"]),
|
||||||
|
undo: {
|
||||||
|
available: true,
|
||||||
|
target: { change_id: "ch_1", summary: "Added recipes.home.test", kept_at: now(), commit_short: "4f1c2ab" },
|
||||||
|
effect: "Removes recipes.home.test",
|
||||||
|
blocked: null,
|
||||||
|
},
|
||||||
|
active_apply: null,
|
||||||
|
repo: { name: "ianitor-routes", last_push_at: now(), unpushed: 0, push_error_code: null },
|
||||||
|
intermediate:
|
||||||
|
m.state.intermediate === "due"
|
||||||
|
? {
|
||||||
|
state: "due",
|
||||||
|
subject: "Ianitor Domi Intermediate 2025-12",
|
||||||
|
not_after: later(86400 * 23),
|
||||||
|
days_left: 23,
|
||||||
|
renewal: m.state.renewal
|
||||||
|
? { request_id: "pr_int", kind: "intermediate", state: "waiting", match_code: "47 19 83", created_at: now(), expires_at: later(3600), approved_at: null, device_id: null, name: null, csr_pem: "-----BEGIN CERTIFICATE REQUEST-----\nx\n-----END CERTIFICATE REQUEST-----\n", not_after: null, message_code: "pki.renew.manual", message: "Sign this request…", approve_command: "ianitor-control ca sign …", problem: null }
|
||||||
|
: null,
|
||||||
|
banner: m.state.renewal ? null : { code: "pki.renew_due", message: "The Domi intermediate certificate expires in 23 days, on 30 November 2026." },
|
||||||
|
}
|
||||||
|
: { state: "ok", subject: "x", not_after: later(86400 * 300), days_left: 300, renewal: null, banner: null },
|
||||||
|
site: { forward_auth_configured: true, acme_configured: true, secrets: ["api_key"], watch_seconds: 60, share_links_available: true },
|
||||||
|
paused: null,
|
||||||
|
paused_reason: null,
|
||||||
|
health_error: null,
|
||||||
|
rev: "rev1",
|
||||||
|
viewer: { name: "mark", via: "authelia" },
|
||||||
|
server_time: now(),
|
||||||
|
});
|
||||||
|
|
||||||
|
return [
|
||||||
|
["GET", /^\/overview$/, () => [200, overview()]],
|
||||||
|
["POST", /^\/hosts\/validate/, () => [200, { message: "This host can be applied." }]],
|
||||||
|
["POST", /^\/hosts$/, (_, b) => {
|
||||||
|
const h = (b.host as Json).hostname as string;
|
||||||
|
m.state.hostsAdded.push(h);
|
||||||
|
return [202, { apply: apply("ch_new", "queued", `Added ${h}`, [h]) }];
|
||||||
|
}],
|
||||||
|
["GET", /^\/applies\/ch_new$/, () => [200, apply("ch_new", "kept", `Added ${m.state.hostsAdded.at(-1)}`, [m.state.hostsAdded.at(-1) ?? ""])]],
|
||||||
|
["GET", /^\/applies\/(.+)$/, (mm) => [200, apply(mm[1], "kept", "Done", ["x.home.test"])]],
|
||||||
|
["POST", /^\/undo$/, () => [202, { apply: apply("ch_undo", "queued", "Undid: Added recipes.home.test", ["recipes.home.test"]) }]],
|
||||||
|
["GET", /^\/history(\?.*)?$/, () => [200, { entries: [{ change_id: "ch_old", summary: "Changed wiki.home.test", kind: "edit", state: "kept", at: now(), commit_short: "9b20e7d", hosts: ["wiki.home.test"], reason_short: null }], next_before: null }]],
|
||||||
|
["GET", /^\/history\/ch_old\/restore-preview$/, () => [200, { restorable: true, same_as_current: false, changes: [{ hostname: "wiki.home.test", effect: "changed", fields: [{ field: "upstreams", from: "http://10.0.0.2:3000", to: "http://10.0.0.9:3000" }] }], blocked: null }]],
|
||||||
|
["POST", /^\/restore$/, () => [202, { apply: apply("ch_restore", "queued", "Restored the version of 5 November 2026", ["wiki.home.test"]) }]],
|
||||||
|
["POST", /^\/hosts\/([^/]+)\/share-links$/, (mm) => [201, { id: "sl_1", url: `https://${decodeURIComponent(mm[1])}/?share=ish1.abc`, expires_at: later(7 * 86400), path_prefix: "/", has_password: false, warning: null }]],
|
||||||
|
["PATCH", /^\/hosts\/([^/]+)$/, (mm) => [202, { apply: apply("ch_share", "queued", `Turned share links on for ${decodeURIComponent(mm[1])}`, [decodeURIComponent(mm[1])]) }]],
|
||||||
|
["DELETE", /^\/share-links\/.+$/, () => [204, null]],
|
||||||
|
["GET", /^\/engine$/, () => {
|
||||||
|
if (m.state.switching > 0) {
|
||||||
|
m.state.switching--;
|
||||||
|
if (m.state.switching === 0) m.state.engine = "caddy";
|
||||||
|
}
|
||||||
|
return [200, { running: m.state.engine, state: m.state.switching > 0 ? "switching" : "running", target: null, since: now(), switchable: true, last_error: null, notes: [] }];
|
||||||
|
}],
|
||||||
|
["POST", /^\/engine$/, () => {
|
||||||
|
m.state.switching = 1;
|
||||||
|
return [202, { running: m.state.engine, state: "switching", target: "caddy", since: now(), switchable: true, last_error: null, notes: [] }];
|
||||||
|
}],
|
||||||
|
["GET", /^\/certs$/, () => [200, { intermediate: overview().intermediate, root: { offline: true, subject: "Domi PKI Root", not_after: later(86400 * 3000), sha256: "ab" }, devices: [], device_lifetime_days: 365, server_lifetime_days: 90, approval: "manual", requests: [] }]],
|
||||||
|
["POST", /^\/certs\/devices$/, (_, b) => [202, { request_id: "pr_dev", kind: "device", state: "waiting", match_code: "47 19 83", created_at: now(), expires_at: later(600), approved_at: null, device_id: null, name: b.name, csr_pem: null, not_after: null, message_code: "pki.waiting.manual", message: "Approve it on the server…", approve_command: "ianitor-control pki approve 47 19 83", problem: null }]],
|
||||||
|
["GET", /^\/pki-requests\/pr_dev$/, () => {
|
||||||
|
m.state.requestPolls++;
|
||||||
|
return [200, { request_id: "pr_dev", kind: "device", state: "approved", match_code: "47 19 83", created_at: now(), expires_at: later(600), approved_at: now(), device_id: "dv_1", name: "Mark's phone", csr_pem: null, not_after: null, message_code: "pki.issued", message: "Mark's phone has a certificate.", approve_command: null, problem: null }];
|
||||||
|
}],
|
||||||
|
["POST", /^\/certs\/devices\/dv_1\/bundle$/, () => [200, { download_url: "https://ui.home.test/api/v1/device-bundles/abc", one_time_password: "ABCD-EFGH-JKLM-NPQR", expires_at: later(600), filename: "domi-device.p12", qr_svg: "<svg xmlns=\"http://www.w3.org/2000/svg\"></svg>" }]],
|
||||||
|
["POST", /^\/certs\/intermediate\/renewal$/, () => {
|
||||||
|
m.state.renewal = true;
|
||||||
|
return [202, { request_id: "pr_int", kind: "intermediate", state: "waiting", match_code: "47 19 83" }];
|
||||||
|
}],
|
||||||
|
["GET", /^\/settings$/, () => [200, { repo: { name: "ianitor-routes", last_push_at: now() }, watch_seconds: 60 }]],
|
||||||
|
["GET", /^\/tokens$/, () => [200, { items: [] }]],
|
||||||
|
["POST", /^\/tokens$/, (_, b) => [201, { id: "tk_1", name: b.name, token: "ian_tk1_secretvalue", expires_at: later(365 * 86400) }]],
|
||||||
|
["GET", /^\/share-links$/, () => [200, { items: [], epoch: 0 }]],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export function installMock(): Mock {
|
||||||
|
const m = newMock();
|
||||||
|
const routes = mockRoutes(m);
|
||||||
|
|
||||||
|
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||||
|
const url = typeof input === "string" ? input : input instanceof URL ? input.pathname + input.search : input.url;
|
||||||
|
const path = url.replace(/^.*\/api\/v1/, "");
|
||||||
|
const method = (init?.method ?? "GET").toUpperCase();
|
||||||
|
const body = init?.body ? JSON.parse(String(init.body)) : {};
|
||||||
|
m.calls.push({ method, path, body });
|
||||||
|
const a = respond(routes, method, path, body);
|
||||||
|
return new Response(a.text, { status: a.status, headers: { "Content-Type": "application/json" } });
|
||||||
|
}) as typeof fetch;
|
||||||
|
|
||||||
|
return m;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
// jsdom lacks a few browser features the UI uses.
|
||||||
|
|
||||||
|
if (typeof HTMLDialogElement !== "undefined") {
|
||||||
|
const p = HTMLDialogElement.prototype as HTMLDialogElement & Record<string, unknown>;
|
||||||
|
if (!p.showModal) {
|
||||||
|
p.showModal = function (this: HTMLDialogElement) {
|
||||||
|
this.setAttribute("open", "");
|
||||||
|
};
|
||||||
|
p.show = function (this: HTMLDialogElement) {
|
||||||
|
this.setAttribute("open", "");
|
||||||
|
};
|
||||||
|
p.close = function (this: HTMLDialogElement) {
|
||||||
|
this.removeAttribute("open");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const clipboard = { text: "", writeText: async (t: string) => void (clipboard.text = t) };
|
||||||
|
Object.defineProperty(globalThis.navigator, "clipboard", { value: clipboard, configurable: true });
|
||||||
|
(globalThis as unknown as { __clipboard: typeof clipboard }).__clipboard = clipboard;
|
||||||
|
|
||||||
|
if (!("BroadcastChannel" in globalThis)) {
|
||||||
|
(globalThis as unknown as { BroadcastChannel: unknown }).BroadcastChannel = class {
|
||||||
|
onmessage: unknown = null;
|
||||||
|
postMessage() {}
|
||||||
|
close() {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!("randomUUID" in crypto)) {
|
||||||
|
Object.defineProperty(crypto, "randomUUID", { value: () => Math.random().toString(36).slice(2) });
|
||||||
|
}
|
||||||
|
|
||||||
|
window.open = () => null;
|
||||||
|
HTMLAnchorElement.prototype.click = function () {};
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"types": ["vite/client"],
|
||||||
|
"lib": ["ES2022", "DOM", "DOM.Iterable"]
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.ts", "src/**/*.svelte", "tests/**/*.ts", "../../packages/ui/src/**/*.ts", "../../packages/ui/src/**/*.svelte"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
||||||
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
|
// Dev server: 127.0.0.1 only (CLAUDE.md), never --host 0.0.0.0. /api goes to control's --dev on
|
||||||
|
// 127.0.0.1:7878. In production edge sends Authelia's identity and the per-boot proof; in dev
|
||||||
|
// there is no Authelia, so the dev proxy (never the browser) adds the dev API token from
|
||||||
|
// $IANITOR_DEV_TOKEN, which `ianitor-control --dev` prints.
|
||||||
|
const control = process.env.IANITOR_CONTROL ?? "http://127.0.0.1:7878";
|
||||||
|
const token = process.env.IANITOR_DEV_TOKEN;
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [svelte()],
|
||||||
|
server: {
|
||||||
|
host: "127.0.0.1",
|
||||||
|
port: 5173,
|
||||||
|
strictPort: true,
|
||||||
|
proxy: {
|
||||||
|
"/api": {
|
||||||
|
target: control,
|
||||||
|
changeOrigin: true,
|
||||||
|
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
preview: { host: "127.0.0.1" },
|
||||||
|
build: { outDir: "dist", sourcemap: false, assetsInlineLimit: 0 },
|
||||||
|
resolve: process.env.VITEST ? { conditions: ["browser"] } : undefined,
|
||||||
|
test: {
|
||||||
|
environment: "jsdom",
|
||||||
|
setupFiles: ["./tests/setup.ts"],
|
||||||
|
include: ["tests/**/*.test.ts"],
|
||||||
|
testTimeout: 20000,
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
# Benchmarks and conformance (ROADMAP §5 layers 2 and 5)
|
||||||
|
|
||||||
|
Data, not marketing: every run's raw output is committed here, and this page summarises it, including where Caddy
|
||||||
|
wins.
|
||||||
|
|
||||||
|
| Folder | What | Made by |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| `results/<date>-<label>.csv` and `results/<date>-<label>/` | load and soak runs: one CSV row per engine, scenario and concurrency; oha's raw JSON; `machine.txt` | `scripts/bench.sh <label>` |
|
||||||
|
| `conformance/` | h2spec and testssl.sh outputs for Ianitor and for Caddy | `scripts/conformance.sh` |
|
||||||
|
|
||||||
|
## How the runs are made
|
||||||
|
|
||||||
|
`tests/diff/src/bin/pair.rs` (`ianitor-pair`) compiles one route, `localhost` → a small upstream that answers
|
||||||
|
`200 ok`, for both engines with Ianitor's compilers, and starts Ianitor's edge (in its own process with the
|
||||||
|
upstream in a child) and two Caddys: one as Go starts it (every core) and one with `GOMAXPROCS=2`. Edge runs Pingora
|
||||||
|
with **two worker threads** (`crates/edge/src/lib.rs`), a deliberate budget for a home server, so the second Caddy
|
||||||
|
is the like-for-like comparison and the first shows what Caddy does with the whole machine.
|
||||||
|
|
||||||
|
[oha](https://github.com/hatoo/oha) then drives each engine in turn, the same way:
|
||||||
|
|
||||||
|
| Scenario | What it measures |
|
||||||
|
| :-- | :-- |
|
||||||
|
| `https-h1-keepalive`, 1/16/64/256 connections | HTTP/1.1 over TLS, connections reused: the proxy path itself |
|
||||||
|
| `https-h2`, 1/16/64/256 connections | the same over HTTP/2 |
|
||||||
|
| `https-h1-new-conn`, 16 connections | a new TLS handshake per request |
|
||||||
|
| `http-redirect`, 64 connections | the plain-HTTP listener's 308 (no upstream) |
|
||||||
|
| `soak-https-h1`, 32 connections, 5 minutes | latency and errors over time, memory after (`rss_kb_after`) |
|
||||||
|
|
||||||
|
Caveats that apply to every number: the load generator, both proxies and the upstream share one machine and its
|
||||||
|
cores; loopback has no network latency, so small differences in CPU per request dominate; the upstream is trivial.
|
||||||
|
Compare rows of one file with each other, not numbers across machines. `machine.txt` records the CPU, the kernel,
|
||||||
|
whether it is WSL2, the build (release or debug) and the tool versions.
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
### Load and soak: 2026-11-18, WSL2 Ubuntu 26.04 (`results/2026-11-18-wsl2-ubuntu.csv`)
|
||||||
|
|
||||||
|
AMD Ryzen 7 5800X3D (16 threads), 32 GB, WSL2 kernel 6.18; release build; Caddy v2.11.7 built with Go 1.26.8 from
|
||||||
|
its official module (no Nix on this machine: Caddy reports its version as "unknown"); oha 1.17; 15 s a run, one run
|
||||||
|
each. Requests per second (higher is better), and p99 latency in ms:
|
||||||
|
|
||||||
|
| Scenario | Ianitor (2 threads) | Caddy (all cores) | Caddy (GOMAXPROCS=2) |
|
||||||
|
| :-- | --: | --: | --: |
|
||||||
|
| HTTP/1.1, keep-alive, 1 conn | 1,861 / 9.0 | 1,757 / 2.5 | **2,351** / 0.8 |
|
||||||
|
| HTTP/2, 1 conn | **2,173** / 0.8 | 1,375 / 1.4 | 1,588 / 1.4 |
|
||||||
|
| HTTP/1.1, 16 conns | 3,843 / 28.8 | 6,905 / 45.5 | **7,759** / 11.2 |
|
||||||
|
| HTTP/2, 16 conns | 4,723 / 27.5 | **6,090** / 35.6 | 3,426 / 28.6 |
|
||||||
|
| HTTP/1.1, 64 conns | 6,596 / 50.9 | **15,653** / 31.3 | 6,561 / 39.8 |
|
||||||
|
| HTTP/2, 64 conns | **11,726** / 23.2 | 8,472 / 59.6 | 5,708 / 37.3 |
|
||||||
|
| HTTP/1.1, 256 conns | 4,421 / 155.6 | **12,632** / 101.9 | 4,473 / 147.0 |
|
||||||
|
| HTTP/2, 256 conns | 3,981 / 146.6 | **10,077** / 101.9 | 3,607 / 134.4 |
|
||||||
|
| New TLS connection per request, 16 | 1,218 / 50.6 | **2,236** / 65.0 | 1,823 / 21.4 |
|
||||||
|
| Plain-HTTP redirect, 64 | 13,582 / 32.4 | **54,027** / 16.3 | 17,027 / 15.5 |
|
||||||
|
| Soak, HTTP/1.1, 32 conns, 5 min | 6,245 / 31.3 | **13,031** / 35.4 | (not run) |
|
||||||
|
|
||||||
|
Every request of every run succeeded (success rate 1.0, no unexpected status). Memory (resident, after each run, the
|
||||||
|
process that serves the port): Ianitor 13 MB at the start, 56 MB after the soak; Caddy 60 MB and 77 MB.
|
||||||
|
|
||||||
|
**Where Caddy wins:** almost everywhere with the whole machine, by about 2× under HTTP/1.1 load and 4× on the
|
||||||
|
plain-HTTP redirect; with the same two cores it is still ahead on HTTP/1.1 at 1 to 16 connections, on new TLS
|
||||||
|
connections (about 1.5×, so rustls handshakes cost Ianitor more than Go's) and on the redirect.
|
||||||
|
**Where Ianitor wins:** HTTP/2 at 1 and 64 connections (ahead of both Caddys), HTTP/2 at 16 and 256 connections
|
||||||
|
against Caddy on two cores, and memory, which stays below Caddy's in every run. At 64 and 256 HTTP/1.1 connections
|
||||||
|
Ianitor and Caddy on two cores are even.
|
||||||
|
|
||||||
|
How much to read into it: one run each, on a desktop that was doing other things; a 2-second smoke run of the same
|
||||||
|
script just before gave Ianitor 14,341 requests/s on HTTP/1.1 with 16 connections, against 3,843 here, so single
|
||||||
|
numbers move a lot on this machine. The ordering at 64 connections and above, the redirect and the handshake cost
|
||||||
|
were the same in both runs. For a home server, every row is far beyond what it will see; the numbers are here to
|
||||||
|
keep the comparison honest, not to choose an engine.
|
||||||
|
|
||||||
|
### Conformance: 2026-11-18, same machine (`conformance/`)
|
||||||
|
|
||||||
|
| | h2spec (145 cases) | testssl.sh 3.2.2 |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| Ianitor | 144 passed, 1 skipped, **0 failed** | A+; TLS 1.2 and 1.3; no server cipher order (rustls follows the client) |
|
||||||
|
| Caddy 2.11.7 | 140 passed, 1 skipped, **4 failed** | A+; TLS 1.2 and 1.3; server cipher order; session tickets valid 7 days (LOW) |
|
||||||
|
|
||||||
|
Slow clients (QC phase 4, `tests/support/probes`, rerun 2026-11-22 with Caddy's version now read from its build
|
||||||
|
info, `conformance/run.json`):
|
||||||
|
|
||||||
|
| | A TLS handshake that never starts | An HTTP/2 header block, one CONTINUATION byte every 0.5 s |
|
||||||
|
| :-- | :-- | :-- |
|
||||||
|
| Ianitor | closed after 60 s | closed after 2.5 s (GOAWAY, ENHANCE_YOUR_CALM) |
|
||||||
|
| Caddy 2.11.7 | closed after 60 s | **still open** after 75 s (the probe's limit; QC saw 150 s) |
|
||||||
|
|
||||||
|
Caddy's four h2spec failures (Go's HTTP/2 server): HEADERS larger than SETTINGS_MAX_FRAME_SIZE (4.2/3), several
|
||||||
|
SETTINGS_INITIAL_WINDOW_SIZE values (6.5.3/1), a connection-specific header field and a `TE` other than
|
||||||
|
`trailers` (8.1.2.2/1 and 2). The two HIGH findings testssl.sh reports for both engines belong to the throwaway test
|
||||||
|
certificate (a validity of about 2,100 years, no CRL or OCSP URL), not to the engines; HSTS and security headers
|
||||||
|
are the routes' business (header rules), not set on the test route.
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
1: Sends a HEADERS frame that contains the connection-specific header field
|
||||||
|
1: Sends multiple values of SETTINGS_INITIAL_WINDOW_SIZE
|
||||||
|
2: Sends a HEADERS frame that contains the TE header field with any value other than "trailers"
|
||||||
|
3: Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||||
@@ -0,0 +1,314 @@
|
|||||||
|
Generic tests for HTTP/2 server
|
||||||
|
1. Starting HTTP/2
|
||||||
|
1: Sends a client connection preface
✔ 1: Sends a client connection preface
|
||||||
|
|
||||||
|
2. Streams and Multiplexing
|
||||||
|
1: Sends a PRIORITY frame on idle stream
✔ 1: Sends a PRIORITY frame on idle stream
|
||||||
|
2: Sends a WINDOW_UPDATE frame on half-closed (remote) stream
✔ 2: Sends a WINDOW_UPDATE frame on half-closed (remote) stream
|
||||||
|
3: Sends a PRIORITY frame on half-closed (remote) stream
✔ 3: Sends a PRIORITY frame on half-closed (remote) stream
|
||||||
|
4: Sends a RST_STREAM frame on half-closed (remote) stream
✔ 4: Sends a RST_STREAM frame on half-closed (remote) stream
|
||||||
|
5: Sends a PRIORITY frame on closed stream
✔ 5: Sends a PRIORITY frame on closed stream
|
||||||
|
|
||||||
|
3. Frame Definitions
|
||||||
|
3.1. DATA
|
||||||
|
1: Sends a DATA frame
✔ 1: Sends a DATA frame
|
||||||
|
2: Sends multiple DATA frames
✔ 2: Sends multiple DATA frames
|
||||||
|
3: Sends a DATA frame with padding
✔ 3: Sends a DATA frame with padding
|
||||||
|
|
||||||
|
3.2. HEADERS
|
||||||
|
1: Sends a HEADERS frame
✔ 1: Sends a HEADERS frame
|
||||||
|
2: Sends a HEADERS frame with padding
✔ 2: Sends a HEADERS frame with padding
|
||||||
|
3: Sends a HEADERS frame with priority
✔ 3: Sends a HEADERS frame with priority
|
||||||
|
|
||||||
|
3.3. PRIORITY
|
||||||
|
1: Sends a PRIORITY frame with priority 1
✔ 1: Sends a PRIORITY frame with priority 1
|
||||||
|
2: Sends a PRIORITY frame with priority 256
✔ 2: Sends a PRIORITY frame with priority 256
|
||||||
|
3: Sends a PRIORITY frame with stream dependency
✔ 3: Sends a PRIORITY frame with stream dependency
|
||||||
|
4: Sends a PRIORITY frame with exclusive
✔ 4: Sends a PRIORITY frame with exclusive
|
||||||
|
5: Sends a PRIORITY frame for an idle stream, then send a HEADER frame for a lower stream ID
✔ 5: Sends a PRIORITY frame for an idle stream, then send a HEADER frame for a lower stream ID
|
||||||
|
|
||||||
|
3.4. RST_STREAM
|
||||||
|
1: Sends a RST_STREAM frame
✔ 1: Sends a RST_STREAM frame
|
||||||
|
|
||||||
|
3.5. SETTINGS
|
||||||
|
1: Sends a SETTINGS frame
✔ 1: Sends a SETTINGS frame
|
||||||
|
|
||||||
|
3.7. PING
|
||||||
|
1: Sends a PING frame
✔ 1: Sends a PING frame
|
||||||
|
|
||||||
|
3.8. GOAWAY
|
||||||
|
1: Sends a GOAWAY frame
✔ 1: Sends a GOAWAY frame
|
||||||
|
|
||||||
|
3.9. WINDOW_UPDATE
|
||||||
|
1: Sends a WINDOW_UPDATE frame with stream ID 0
✔ 1: Sends a WINDOW_UPDATE frame with stream ID 0
|
||||||
|
2: Sends a WINDOW_UPDATE frame with stream ID 1
✔ 2: Sends a WINDOW_UPDATE frame with stream ID 1
|
||||||
|
|
||||||
|
3.10. CONTINUATION
|
||||||
|
1: Sends a CONTINUATION frame
✔ 1: Sends a CONTINUATION frame
|
||||||
|
2: Sends multiple CONTINUATION frames
✔ 2: Sends multiple CONTINUATION frames
|
||||||
|
|
||||||
|
4. HTTP Message Exchanges
|
||||||
|
1: Sends a GET request
✔ 1: Sends a GET request
|
||||||
|
2: Sends a HEAD request
✔ 2: Sends a HEAD request
|
||||||
|
3: Sends a POST request
✔ 3: Sends a POST request
|
||||||
|
4: Sends a POST request with trailers
✔ 4: Sends a POST request with trailers
|
||||||
|
|
||||||
|
5. HPACK
|
||||||
|
1: Sends a indexed header field representation
✔ 1: Sends a indexed header field representation
|
||||||
|
2: Sends a literal header field with incremental indexing - indexed name
✔ 2: Sends a literal header field with incremental indexing - indexed name
|
||||||
|
3: Sends a literal header field with incremental indexing - indexed name (with Huffman coding)
✔ 3: Sends a literal header field with incremental indexing - indexed name (with Huffman coding)
|
||||||
|
4: Sends a literal header field with incremental indexing - new name
✔ 4: Sends a literal header field with incremental indexing - new name
|
||||||
|
5: Sends a literal header field with incremental indexing - new name (with Huffman coding)
✔ 5: Sends a literal header field with incremental indexing - new name (with Huffman coding)
|
||||||
|
6: Sends a literal header field without indexing - indexed name
✔ 6: Sends a literal header field without indexing - indexed name
|
||||||
|
7: Sends a literal header field without indexing - indexed name (with Huffman coding)
✔ 7: Sends a literal header field without indexing - indexed name (with Huffman coding)
|
||||||
|
8: Sends a literal header field without indexing - new name
✔ 8: Sends a literal header field without indexing - new name
|
||||||
|
9: Sends a literal header field without indexing - new name (huffman encoded)
✔ 9: Sends a literal header field without indexing - new name (huffman encoded)
|
||||||
|
10: Sends a literal header field never indexed - indexed name
✔ 10: Sends a literal header field never indexed - indexed name
|
||||||
|
11: Sends a literal header field never indexed - indexed name (huffman encoded)
✔ 11: Sends a literal header field never indexed - indexed name (huffman encoded)
|
||||||
|
12: Sends a literal header field never indexed - new name
✔ 12: Sends a literal header field never indexed - new name
|
||||||
|
13: Sends a literal header field never indexed - new name (huffman encoded)
✔ 13: Sends a literal header field never indexed - new name (huffman encoded)
|
||||||
|
14: Sends a dynamic table size update
✔ 14: Sends a dynamic table size update
|
||||||
|
15: Sends multiple dynamic table size update
✔ 15: Sends multiple dynamic table size update
|
||||||
|
|
||||||
|
Hypertext Transfer Protocol Version 2 (HTTP/2)
|
||||||
|
3. Starting HTTP/2
|
||||||
|
3.5. HTTP/2 Connection Preface
|
||||||
|
1: Sends client connection preface
✔ 1: Sends client connection preface
|
||||||
|
2: Sends invalid connection preface
✔ 2: Sends invalid connection preface
|
||||||
|
|
||||||
|
4. HTTP Frames
|
||||||
|
4.1. Frame Format
|
||||||
|
1: Sends a frame with unknown type
✔ 1: Sends a frame with unknown type
|
||||||
|
2: Sends a frame with undefined flag
✔ 2: Sends a frame with undefined flag
|
||||||
|
3: Sends a frame with reserved field bit
✔ 3: Sends a frame with reserved field bit
|
||||||
|
|
||||||
|
4.2. Frame Size
|
||||||
|
1: Sends a DATA frame with 2^14 octets in length
✔ 1: Sends a DATA frame with 2^14 octets in length
|
||||||
|
2: Sends a large size DATA frame that exceeds the SETTINGS_MAX_FRAME_SIZE
✔ 2: Sends a large size DATA frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||||
|
3: Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE
× 3: Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||||
|
-> The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.
|
||||||
|
Expected: GOAWAY Frame (Error Code: FRAME_SIZE_ERROR)
|
||||||
|
Connection closed
|
||||||
|
Actual: DATA Frame (length:63, flags:0x01, stream_id:1)
|
||||||
|
|
||||||
|
4.3. Header Compression and Decompression
|
||||||
|
1: Sends invalid header block fragment
✔ 1: Sends invalid header block fragment
|
||||||
|
2: Sends a PRIORITY frame while sending the header blocks
✔ 2: Sends a PRIORITY frame while sending the header blocks
|
||||||
|
3: Sends a HEADERS frame to another stream while sending the header blocks
✔ 3: Sends a HEADERS frame to another stream while sending the header blocks
|
||||||
|
|
||||||
|
5. Streams and Multiplexing
|
||||||
|
5.1. Stream States
|
||||||
|
1: idle: Sends a DATA frame
✔ 1: idle: Sends a DATA frame
|
||||||
|
2: idle: Sends a RST_STREAM frame
✔ 2: idle: Sends a RST_STREAM frame
|
||||||
|
3: idle: Sends a WINDOW_UPDATE frame
✔ 3: idle: Sends a WINDOW_UPDATE frame
|
||||||
|
4: idle: Sends a CONTINUATION frame
✔ 4: idle: Sends a CONTINUATION frame
|
||||||
|
5: half closed (remote): Sends a DATA frame
✔ 5: half closed (remote): Sends a DATA frame
|
||||||
|
6: half closed (remote): Sends a HEADERS frame
✔ 6: half closed (remote): Sends a HEADERS frame
|
||||||
|
7: half closed (remote): Sends a CONTINUATION frame
✔ 7: half closed (remote): Sends a CONTINUATION frame
|
||||||
|
8: closed: Sends a DATA frame after sending RST_STREAM frame
✔ 8: closed: Sends a DATA frame after sending RST_STREAM frame
|
||||||
|
9: closed: Sends a HEADERS frame after sending RST_STREAM frame
✔ 9: closed: Sends a HEADERS frame after sending RST_STREAM frame
|
||||||
|
10: closed: Sends a CONTINUATION frame after sending RST_STREAM frame
✔ 10: closed: Sends a CONTINUATION frame after sending RST_STREAM frame
|
||||||
|
11: closed: Sends a DATA frame
✔ 11: closed: Sends a DATA frame
|
||||||
|
12: closed: Sends a HEADERS frame
✔ 12: closed: Sends a HEADERS frame
|
||||||
|
13: closed: Sends a CONTINUATION frame
✔ 13: closed: Sends a CONTINUATION frame
|
||||||
|
|
||||||
|
5.1.1. Stream Identifiers
|
||||||
|
1: Sends even-numbered stream identifier
✔ 1: Sends even-numbered stream identifier
|
||||||
|
2: Sends stream identifier that is numerically smaller than previous
✔ 2: Sends stream identifier that is numerically smaller than previous
|
||||||
|
|
||||||
|
5.1.2. Stream Concurrency
|
||||||
|
1: Sends HEADERS frames that causes their advertised concurrent stream limit to be exceeded
✔ 1: Sends HEADERS frames that causes their advertised concurrent stream limit to be exceeded
|
||||||
|
|
||||||
|
5.3. Stream Priority
|
||||||
|
5.3.1. Stream Dependencies
|
||||||
|
1: Sends HEADERS frame that depend on itself
✔ 1: Sends HEADERS frame that depend on itself
|
||||||
|
2: Sends PRIORITY frame that depend on itself
✔ 2: Sends PRIORITY frame that depend on itself
|
||||||
|
|
||||||
|
5.4. Error Handling
|
||||||
|
5.4.1. Connection Error Handling
|
||||||
|
1: Sends an invalid PING frame for connection close
✔ 1: Sends an invalid PING frame for connection close
|
||||||
|
|
||||||
|
5.5. Extending HTTP/2
|
||||||
|
1: Sends an unknown extension frame
✔ 1: Sends an unknown extension frame
|
||||||
|
2: Sends an unknown extension frame in the middle of a header block
✔ 2: Sends an unknown extension frame in the middle of a header block
|
||||||
|
|
||||||
|
6. Frame Definitions
|
||||||
|
6.1. DATA
|
||||||
|
1: Sends a DATA frame with 0x0 stream identifier
✔ 1: Sends a DATA frame with 0x0 stream identifier
|
||||||
|
2: Sends a DATA frame on the stream that is not in "open" or "half-closed (local)" state
✔ 2: Sends a DATA frame on the stream that is not in "open" or "half-closed (local)" state
|
||||||
|
3: Sends a DATA frame with invalid pad length
✔ 3: Sends a DATA frame with invalid pad length
|
||||||
|
|
||||||
|
6.2. HEADERS
|
||||||
|
1: Sends a HEADERS frame without the END_HEADERS flag, and a PRIORITY frame
✔ 1: Sends a HEADERS frame without the END_HEADERS flag, and a PRIORITY frame
|
||||||
|
2: Sends a HEADERS frame to another stream while sending a HEADERS frame
✔ 2: Sends a HEADERS frame to another stream while sending a HEADERS frame
|
||||||
|
3: Sends a HEADERS frame with 0x0 stream identifier
✔ 3: Sends a HEADERS frame with 0x0 stream identifier
|
||||||
|
4: Sends a HEADERS frame with invalid pad length
✔ 4: Sends a HEADERS frame with invalid pad length
|
||||||
|
|
||||||
|
6.3. PRIORITY
|
||||||
|
1: Sends a PRIORITY frame with 0x0 stream identifier
✔ 1: Sends a PRIORITY frame with 0x0 stream identifier
|
||||||
|
2: Sends a PRIORITY frame with a length other than 5 octets
✔ 2: Sends a PRIORITY frame with a length other than 5 octets
|
||||||
|
|
||||||
|
6.4. RST_STREAM
|
||||||
|
1: Sends a RST_STREAM frame with 0x0 stream identifier
✔ 1: Sends a RST_STREAM frame with 0x0 stream identifier
|
||||||
|
2: Sends a RST_STREAM frame on a idle stream
✔ 2: Sends a RST_STREAM frame on a idle stream
|
||||||
|
3: Sends a RST_STREAM frame with a length other than 4 octets
✔ 3: Sends a RST_STREAM frame with a length other than 4 octets
|
||||||
|
|
||||||
|
6.5. SETTINGS
|
||||||
|
1: Sends a SETTINGS frame with ACK flag and payload
✔ 1: Sends a SETTINGS frame with ACK flag and payload
|
||||||
|
2: Sends a SETTINGS frame with a stream identifier other than 0x0
✔ 2: Sends a SETTINGS frame with a stream identifier other than 0x0
|
||||||
|
3: Sends a SETTINGS frame with a length other than a multiple of 6 octets
✔ 3: Sends a SETTINGS frame with a length other than a multiple of 6 octets
|
||||||
|
|
||||||
|
6.5.2. Defined SETTINGS Parameters
|
||||||
|
1: SETTINGS_ENABLE_PUSH (0x2): Sends the value other than 0 or 1
✔ 1: SETTINGS_ENABLE_PUSH (0x2): Sends the value other than 0 or 1
|
||||||
|
2: SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size
✔ 2: SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size
|
||||||
|
3: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value
✔ 3: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value
|
||||||
|
4: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size
✔ 4: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size
|
||||||
|
5: Sends a SETTINGS frame with unknown identifier
✔ 5: Sends a SETTINGS frame with unknown identifier
|
||||||
|
|
||||||
|
6.5.3. Settings Synchronization
|
||||||
|
1: Sends multiple values of SETTINGS_INITIAL_WINDOW_SIZE
× 1: Sends multiple values of SETTINGS_INITIAL_WINDOW_SIZE
|
||||||
|
-> The endpoint MUST process the values in the settings in the order they apper.
|
||||||
|
Expected: SETTINGS Frame (length:0, flags:0x01, stream_id:0)
|
||||||
|
Actual: Connection closed
|
||||||
|
2: Sends a SETTINGS frame without ACK flag
✔ 2: Sends a SETTINGS frame without ACK flag
|
||||||
|
|
||||||
|
6.7. PING
|
||||||
|
1: Sends a PING frame
✔ 1: Sends a PING frame
|
||||||
|
2: Sends a PING frame with ACK
✔ 2: Sends a PING frame with ACK
|
||||||
|
3: Sends a PING frame with a stream identifier field value other than 0x0
✔ 3: Sends a PING frame with a stream identifier field value other than 0x0
|
||||||
|
4: Sends a PING frame with a length field value other than 8
✔ 4: Sends a PING frame with a length field value other than 8
|
||||||
|
|
||||||
|
6.8. GOAWAY
|
||||||
|
1: Sends a GOAWAY frame with a stream identifier other than 0x0
✔ 1: Sends a GOAWAY frame with a stream identifier other than 0x0
|
||||||
|
|
||||||
|
6.9. WINDOW_UPDATE
|
||||||
|
1: Sends a WINDOW_UPDATE frame with a flow control window increment of 0
✔ 1: Sends a WINDOW_UPDATE frame with a flow control window increment of 0
|
||||||
|
2: Sends a WINDOW_UPDATE frame with a flow control window increment of 0 on a stream
✔ 2: Sends a WINDOW_UPDATE frame with a flow control window increment of 0 on a stream
|
||||||
|
3: Sends a WINDOW_UPDATE frame with a length other than 4 octets
✔ 3: Sends a WINDOW_UPDATE frame with a length other than 4 octets
|
||||||
|
|
||||||
|
6.9.1. The Flow-Control Window
|
||||||
|
1: Sends SETTINGS frame to set the initial window size to 1 and sends HEADERS frame
✔ 1: Sends SETTINGS frame to set the initial window size to 1 and sends HEADERS frame
|
||||||
|
2: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1
✔ 2: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1
|
||||||
|
3: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1 on a stream
✔ 3: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1 on a stream
|
||||||
|
|
||||||
|
6.9.2. Initial Flow-Control Window Size
|
||||||
|
1: Changes SETTINGS_INITIAL_WINDOW_SIZE after sending HEADERS frame
✔ 1: Changes SETTINGS_INITIAL_WINDOW_SIZE after sending HEADERS frame
|
||||||
|
2: Sends a SETTINGS frame for window size to be negative
2: Sends a SETTINGS frame for window size to be negative
|
||||||
|
3: Sends a SETTINGS_INITIAL_WINDOW_SIZE settings with an exceeded maximum window size value
✔ 3: Sends a SETTINGS_INITIAL_WINDOW_SIZE settings with an exceeded maximum window size value
|
||||||
|
|
||||||
|
6.10. CONTINUATION
|
||||||
|
1: Sends multiple CONTINUATION frames preceded by a HEADERS frame
✔ 1: Sends multiple CONTINUATION frames preceded by a HEADERS frame
|
||||||
|
2: Sends a CONTINUATION frame followed by any frame other than CONTINUATION
✔ 2: Sends a CONTINUATION frame followed by any frame other than CONTINUATION
|
||||||
|
3: Sends a CONTINUATION frame with 0x0 stream identifier
✔ 3: Sends a CONTINUATION frame with 0x0 stream identifier
|
||||||
|
4: Sends a CONTINUATION frame preceded by a HEADERS frame with END_HEADERS flag
✔ 4: Sends a CONTINUATION frame preceded by a HEADERS frame with END_HEADERS flag
|
||||||
|
5: Sends a CONTINUATION frame preceded by a CONTINUATION frame with END_HEADERS flag
✔ 5: Sends a CONTINUATION frame preceded by a CONTINUATION frame with END_HEADERS flag
|
||||||
|
6: Sends a CONTINUATION frame preceded by a DATA frame
✔ 6: Sends a CONTINUATION frame preceded by a DATA frame
|
||||||
|
|
||||||
|
7. Error Codes
|
||||||
|
1: Sends a GOAWAY frame with unknown error code
✔ 1: Sends a GOAWAY frame with unknown error code
|
||||||
|
2: Sends a RST_STREAM frame with unknown error code
✔ 2: Sends a RST_STREAM frame with unknown error code
|
||||||
|
|
||||||
|
8. HTTP Message Exchanges
|
||||||
|
8.1. HTTP Request/Response Exchange
|
||||||
|
1: Sends a second HEADERS frame without the END_STREAM flag
✔ 1: Sends a second HEADERS frame without the END_STREAM flag
|
||||||
|
|
||||||
|
8.1.2. HTTP Header Fields
|
||||||
|
1: Sends a HEADERS frame that contains the header field name in uppercase letters
✔ 1: Sends a HEADERS frame that contains the header field name in uppercase letters
|
||||||
|
|
||||||
|
8.1.2.1. Pseudo-Header Fields
|
||||||
|
1: Sends a HEADERS frame that contains a unknown pseudo-header field
✔ 1: Sends a HEADERS frame that contains a unknown pseudo-header field
|
||||||
|
2: Sends a HEADERS frame that contains the pseudo-header field defined for response
✔ 2: Sends a HEADERS frame that contains the pseudo-header field defined for response
|
||||||
|
3: Sends a HEADERS frame that contains a pseudo-header field as trailers
✔ 3: Sends a HEADERS frame that contains a pseudo-header field as trailers
|
||||||
|
4: Sends a HEADERS frame that contains a pseudo-header field that appears in a header block after a regular header field
✔ 4: Sends a HEADERS frame that contains a pseudo-header field that appears in a header block after a regular header field
|
||||||
|
|
||||||
|
8.1.2.2. Connection-Specific Header Fields
|
||||||
|
1: Sends a HEADERS frame that contains the connection-specific header field
× 1: Sends a HEADERS frame that contains the connection-specific header field
|
||||||
|
-> The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
||||||
|
Expected: GOAWAY Frame (Error Code: PROTOCOL_ERROR)
|
||||||
|
RST_STREAM Frame (Error Code: PROTOCOL_ERROR)
|
||||||
|
Connection closed
|
||||||
|
Actual: DATA Frame (length:51, flags:0x01, stream_id:1)
|
||||||
|
2: Sends a HEADERS frame that contains the TE header field with any value other than "trailers"
× 2: Sends a HEADERS frame that contains the TE header field with any value other than "trailers"
|
||||||
|
-> The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
||||||
|
Expected: GOAWAY Frame (Error Code: PROTOCOL_ERROR)
|
||||||
|
RST_STREAM Frame (Error Code: PROTOCOL_ERROR)
|
||||||
|
Connection closed
|
||||||
|
Actual: DATA Frame (length:53, flags:0x01, stream_id:1)
|
||||||
|
|
||||||
|
8.1.2.3. Request Pseudo-Header Fields
|
||||||
|
1: Sends a HEADERS frame with empty ":path" pseudo-header field
✔ 1: Sends a HEADERS frame with empty ":path" pseudo-header field
|
||||||
|
2: Sends a HEADERS frame that omits ":method" pseudo-header field
✔ 2: Sends a HEADERS frame that omits ":method" pseudo-header field
|
||||||
|
3: Sends a HEADERS frame that omits ":scheme" pseudo-header field
✔ 3: Sends a HEADERS frame that omits ":scheme" pseudo-header field
|
||||||
|
4: Sends a HEADERS frame that omits ":path" pseudo-header field
✔ 4: Sends a HEADERS frame that omits ":path" pseudo-header field
|
||||||
|
5: Sends a HEADERS frame with duplicated ":method" pseudo-header field
✔ 5: Sends a HEADERS frame with duplicated ":method" pseudo-header field
|
||||||
|
6: Sends a HEADERS frame with duplicated ":scheme" pseudo-header field
✔ 6: Sends a HEADERS frame with duplicated ":scheme" pseudo-header field
|
||||||
|
7: Sends a HEADERS frame with duplicated ":path" pseudo-header field
✔ 7: Sends a HEADERS frame with duplicated ":path" pseudo-header field
|
||||||
|
|
||||||
|
8.1.2.6. Malformed Requests and Responses
|
||||||
|
1: Sends a HEADERS frame with the "content-length" header field which does not equal the DATA frame payload length
✔ 1: Sends a HEADERS frame with the "content-length" header field which does not equal the DATA frame payload length
|
||||||
|
2: Sends a HEADERS frame with the "content-length" header field which does not equal the sum of the multiple DATA frames payload length
✔ 2: Sends a HEADERS frame with the "content-length" header field which does not equal the sum of the multiple DATA frames payload length
|
||||||
|
|
||||||
|
8.2. Server Push
|
||||||
|
1: Sends a PUSH_PROMISE frame
✔ 1: Sends a PUSH_PROMISE frame
|
||||||
|
|
||||||
|
HPACK: Header Compression for HTTP/2
|
||||||
|
2. Compression Process Overview
|
||||||
|
2.3. Indexing Tables
|
||||||
|
2.3.3. Index Address Space
|
||||||
|
1: Sends a header field representation with invalid index
✔ 1: Sends a header field representation with invalid index
|
||||||
|
|
||||||
|
4. Dynamic Table Management
|
||||||
|
4.2. Maximum Table Size
|
||||||
|
1: Sends a dynamic table size update at the end of header block
✔ 1: Sends a dynamic table size update at the end of header block
|
||||||
|
|
||||||
|
5. Primitive Type Representations
|
||||||
|
5.2. String Literal Representation
|
||||||
|
1: Sends a Huffman-encoded string literal representation with padding longer than 7 bits
✔ 1: Sends a Huffman-encoded string literal representation with padding longer than 7 bits
|
||||||
|
2: Sends a Huffman-encoded string literal representation padded by zero
✔ 2: Sends a Huffman-encoded string literal representation padded by zero
|
||||||
|
3: Sends a Huffman-encoded string literal representation containing the EOS symbol
✔ 3: Sends a Huffman-encoded string literal representation containing the EOS symbol
|
||||||
|
|
||||||
|
6. Binary Format
|
||||||
|
6.1. Indexed Header Field Representation
|
||||||
|
1: Sends a indexed header field representation with index 0
✔ 1: Sends a indexed header field representation with index 0
|
||||||
|
|
||||||
|
6.3. Dynamic Table Size Update
|
||||||
|
1: Sends a dynamic table size update larger than the value of SETTINGS_HEADER_TABLE_SIZE
✔ 1: Sends a dynamic table size update larger than the value of SETTINGS_HEADER_TABLE_SIZE
|
||||||
|
|
||||||
|
Failures:
|
||||||
|
|
||||||
|
Hypertext Transfer Protocol Version 2 (HTTP/2)
|
||||||
|
4. HTTP Frames
|
||||||
|
4.2. Frame Size
|
||||||
|
× 3: Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||||
|
-> The endpoint MUST respond with a connection error of type FRAME_SIZE_ERROR.
|
||||||
|
Expected: GOAWAY Frame (Error Code: FRAME_SIZE_ERROR)
|
||||||
|
Connection closed
|
||||||
|
Actual: DATA Frame (length:63, flags:0x01, stream_id:1)
|
||||||
|
|
||||||
|
6. Frame Definitions
|
||||||
|
6.5. SETTINGS
|
||||||
|
6.5.3. Settings Synchronization
|
||||||
|
× 1: Sends multiple values of SETTINGS_INITIAL_WINDOW_SIZE
|
||||||
|
-> The endpoint MUST process the values in the settings in the order they apper.
|
||||||
|
Expected: SETTINGS Frame (length:0, flags:0x01, stream_id:0)
|
||||||
|
Actual: Connection closed
|
||||||
|
|
||||||
|
8. HTTP Message Exchanges
|
||||||
|
8.1. HTTP Request/Response Exchange
|
||||||
|
8.1.2. HTTP Header Fields
|
||||||
|
8.1.2.2. Connection-Specific Header Fields
|
||||||
|
× 1: Sends a HEADERS frame that contains the connection-specific header field
|
||||||
|
-> The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
||||||
|
Expected: GOAWAY Frame (Error Code: PROTOCOL_ERROR)
|
||||||
|
RST_STREAM Frame (Error Code: PROTOCOL_ERROR)
|
||||||
|
Connection closed
|
||||||
|
Actual: DATA Frame (length:51, flags:0x01, stream_id:1)
|
||||||
|
× 2: Sends a HEADERS frame that contains the TE header field with any value other than "trailers"
|
||||||
|
-> The endpoint MUST respond with a stream error of type PROTOCOL_ERROR.
|
||||||
|
Expected: GOAWAY Frame (Error Code: PROTOCOL_ERROR)
|
||||||
|
RST_STREAM Frame (Error Code: PROTOCOL_ERROR)
|
||||||
|
Connection closed
|
||||||
|
Actual: DATA Frame (length:53, flags:0x01, stream_id:1)
|
||||||
|
|
||||||
|
Finished in 20.7059 seconds
|
||||||
|
145 tests, 140 passed, 1 skipped, 4 failed
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
h2 22513: STILL OPEN after 75s; frames [(4, 0, '0005001000000003'), (8, 0, '000f0001'), (4, 1, '')]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
idle 22513: closed after 60.0s (b'')
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,197 @@
|
|||||||
|
|
||||||
|
Start 2026-11-22 19:16:53 -->> 127.0.0.1:22513 (localhost) <<--
|
||||||
|
|
||||||
|
A record via: supplied IP "127.0.0.1"
|
||||||
|
rDNS (127.0.0.1): localhost. kubernetes.docker.internal.
|
||||||
|
Service detected: HTTP
|
||||||
|
|
||||||
|
Testing protocols via sockets except NPN+ALPN
|
||||||
|
|
||||||
|
SSLv2 not offered (OK)
|
||||||
|
SSLv3 not offered (OK)
|
||||||
|
TLS 1 not offered
|
||||||
|
TLS 1.1 not offered
|
||||||
|
TLS 1.2 offered (OK)
|
||||||
|
TLS 1.3 offered (OK): final
|
||||||
|
NPN/SPDY not offered
|
||||||
|
ALPN/HTTP2 h2, http/1.1 (offered)
|
||||||
|
|
||||||
|
Testing cipher categories
|
||||||
|
|
||||||
|
NULL ciphers (no encryption) not offered (OK)
|
||||||
|
Anonymous NULL Ciphers (no authentication) not offered (OK)
|
||||||
|
Export ciphers (w/o ADH+NULL) not offered (OK)
|
||||||
|
LOW: 64 Bit + DES, RC[2,4], MD5 (w/o export) not offered (OK)
|
||||||
|
Triple DES Ciphers / IDEA not offered
|
||||||
|
Obsoleted CBC ciphers (AES, ARIA etc.) not offered
|
||||||
|
Strong encryption (AEAD ciphers) with no FS not offered
|
||||||
|
Forward Secrecy strong encryption (AEAD ciphers) offered (OK)
|
||||||
|
|
||||||
|
|
||||||
|
Testing server's cipher preferences
|
||||||
|
|
||||||
|
Hexcode Cipher Suite Name (OpenSSL) KeyExch. Encryption Bits Cipher Suite Name (IANA/RFC)
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------------
|
||||||
|
SSLv2
|
||||||
|
-
|
||||||
|
SSLv3
|
||||||
|
-
|
||||||
|
TLSv1
|
||||||
|
-
|
||||||
|
TLSv1.1
|
||||||
|
-
|
||||||
|
TLSv1.2 (server order -- server prioritizes ChaCha ciphers when preferred by clients)
|
||||||
|
xc02b ECDHE-ECDSA-AES128-GCM-SHA256 ECDH 253 AESGCM 128 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
|
||||||
|
xc02c ECDHE-ECDSA-AES256-GCM-SHA384 ECDH 253 AESGCM 256 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||||
|
xcca9 ECDHE-ECDSA-CHACHA20-POLY1305 ECDH 253 ChaCha20 256 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
|
||||||
|
TLSv1.3 (no server order, thus listed by strength)
|
||||||
|
x1302 TLS_AES_256_GCM_SHA384 ECDH/MLKEM AESGCM 256 TLS_AES_256_GCM_SHA384
|
||||||
|
x1303 TLS_CHACHA20_POLY1305_SHA256 ECDH/MLKEM ChaCha20 256 TLS_CHACHA20_POLY1305_SHA256
|
||||||
|
x1301 TLS_AES_128_GCM_SHA256 ECDH/MLKEM AESGCM 128 TLS_AES_128_GCM_SHA256
|
||||||
|
|
||||||
|
Has server cipher order? yes (OK) -- only for < TLS 1.3
|
||||||
|
|
||||||
|
|
||||||
|
Testing robust forward secrecy (FS) -- omitting Null Authentication/Encryption, 3DES, RC4
|
||||||
|
|
||||||
|
FS is offered (OK) TLS_AES_256_GCM_SHA384
|
||||||
|
TLS_CHACHA20_POLY1305_SHA256
|
||||||
|
ECDHE-ECDSA-AES256-GCM-SHA384
|
||||||
|
ECDHE-ECDSA-CHACHA20-POLY1305
|
||||||
|
TLS_AES_128_GCM_SHA256
|
||||||
|
ECDHE-ECDSA-AES128-GCM-SHA256
|
||||||
|
KEMs offered X25519MLKEM768
|
||||||
|
Elliptic curves offered: prime256v1 X25519
|
||||||
|
TLS 1.2 sig_algs offered: ECDSA+SHA512 ECDSA+SHA384 ECDSA+SHA256
|
||||||
|
TLS 1.3 sig_algs offered: ECDSA+SHA256
|
||||||
|
|
||||||
|
Testing server defaults (Server Hello)
|
||||||
|
|
||||||
|
TLS extensions (standard) "server name/#0" "EC point formats/#11"
|
||||||
|
"application layer protocol negotiation/#16"
|
||||||
|
"extended master secret/#23" "session ticket/#35"
|
||||||
|
"supported versions/#43" "key share/#51"
|
||||||
|
"renegotiation info/#65281"
|
||||||
|
Session Ticket RFC 5077 hint 604800 seconds but: FS requires session ticket keys to be rotated < daily !
|
||||||
|
SSL Session ID support yes
|
||||||
|
Session Resumption Tickets: yes, ID: yes
|
||||||
|
TLS clock skew Random values, no fingerprinting possible
|
||||||
|
Certificate Compression none
|
||||||
|
Client Authentication none
|
||||||
|
Signature Algorithm ECDSA with SHA256
|
||||||
|
Server key size EC 256 bits (curve P-256)
|
||||||
|
Server key usage Digital Signature
|
||||||
|
Server extended key usage TLS Web Server Authentication
|
||||||
|
Serial 4FACDAB031F57BFDD07B95B92D64D3DD961BBE52 (OK: length 20)
|
||||||
|
Fingerprints SHA1 CCC98BD66BED804F5229E746BD9A063FCB608008
|
||||||
|
SHA256 8890533F47576EDA7B8F9E56E317548BF3C583318FF4A2B2971F79223D640691
|
||||||
|
Common Name (CN) localhost (request w/o SNI didn't succeed, usual for EC certificates)
|
||||||
|
subjectAltName (SAN) localhost
|
||||||
|
Trust (hostname) Ok via SAN and CN (SNI mandatory)
|
||||||
|
Chain of trust Ok
|
||||||
|
EV cert (experimental) no
|
||||||
|
Certificate Validity (UTC) 755726 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00)
|
||||||
|
>= 10 years is way too long
|
||||||
|
ETS/"eTLS", visibility info not present
|
||||||
|
Certificate Revocation List --
|
||||||
|
OCSP URI --
|
||||||
|
NOT ok -- neither CRL nor OCSP URI provided
|
||||||
|
OCSP stapling not offered
|
||||||
|
OCSP must staple extension --
|
||||||
|
DNS CAA RR (experimental) not offered
|
||||||
|
Certificate Transparency --
|
||||||
|
Certificates provided 1
|
||||||
|
Issuer Ianitor Pair Test CA
|
||||||
|
Intermediate Bad OCSP (exp.) Ok
|
||||||
|
|
||||||
|
|
||||||
|
Testing HTTP header response @ "/"
|
||||||
|
|
||||||
|
HTTP Status Code 200 OK
|
||||||
|
HTTP clock skew 0 sec from localtime
|
||||||
|
Strict Transport Security not offered
|
||||||
|
Public Key Pinning --
|
||||||
|
Server banner (no "Server" line in header, interesting!)
|
||||||
|
Application banner --
|
||||||
|
Cookie(s) (none issued at "/")
|
||||||
|
Security headers --
|
||||||
|
Reverse Proxy banner Via: 1.1 Caddy
|
||||||
|
|
||||||
|
|
||||||
|
Testing vulnerabilities
|
||||||
|
|
||||||
|
Heartbleed (CVE-2014-0160) not vulnerable (OK), no heartbeat extension
|
||||||
|
CCS (CVE-2014-0224) not vulnerable (OK)
|
||||||
|
Ticketbleed (CVE-2016-9244), experiment. not vulnerable (OK)
|
||||||
|
ROBOT Server does not support any cipher suites that use RSA key transport
|
||||||
|
Secure Renegotiation (RFC 5746) supported (OK)
|
||||||
|
Secure Client-Initiated Renegotiation not vulnerable (OK)
|
||||||
|
CRIME, TLS (CVE-2012-4929) not vulnerable (OK)
|
||||||
|
BREACH (CVE-2013-3587) no gzip/deflate/compress/br HTTP compression (OK) - only supplied "/" tested
|
||||||
|
POODLE, SSL (CVE-2014-3566) not vulnerable (OK), no SSLv3 support
|
||||||
|
TLS_FALLBACK_SCSV (RFC 7507) No fallback possible (OK), no protocol below TLS 1.2 offered
|
||||||
|
SWEET32 (CVE-2016-2183, CVE-2016-6329) not vulnerable (OK)
|
||||||
|
FREAK (CVE-2015-0204) not vulnerable (OK)
|
||||||
|
DROWN (CVE-2016-0800, CVE-2016-0703) not vulnerable on this host and port (OK)
|
||||||
|
no RSA certificate, thus certificate can't be used with SSLv2 elsewhere
|
||||||
|
LOGJAM (CVE-2015-4000), experimental not vulnerable (OK): no DH EXPORT ciphers, no DH key detected with <= TLS 1.2
|
||||||
|
BEAST (CVE-2011-3389) not vulnerable (OK), no SSL3 or TLS1
|
||||||
|
LUCKY13 (CVE-2013-0169), experimental not vulnerable (OK)
|
||||||
|
Winshock (CVE-2014-6321), experimental not vulnerable (OK)
|
||||||
|
RC4 (CVE-2013-2566, CVE-2015-2808) no RC4 ciphers detected (OK)
|
||||||
|
|
||||||
|
|
||||||
|
Running client simulations (HTTP) via sockets
|
||||||
|
|
||||||
|
Browser Protocol Cipher Suite Name (OpenSSL) Forward Secrecy
|
||||||
|
------------------------------------------------------------------------------------------------
|
||||||
|
Android 7.0 (native) TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||||
|
Android 8.1 (native) TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 253 bit ECDH (X25519)
|
||||||
|
Android 9.0 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Android 10.0 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Android 11/12 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Android 13/14 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Android 15 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 X25519MLKEM768
|
||||||
|
Chrome 101 (Win 10) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Chromium 137 (Win 11) TLSv1.3 TLS_AES_128_GCM_SHA256 X25519MLKEM768
|
||||||
|
Firefox 100 (Win 10) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Firefox 137 (Win 11) TLSv1.3 TLS_AES_128_GCM_SHA256 X25519MLKEM768
|
||||||
|
IE 8 Win 7 No connection
|
||||||
|
IE 11 Win 7 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||||
|
IE 11 Win 8.1 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||||
|
IE 11 Win Phone 8.1 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||||
|
IE 11 Win 10 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||||
|
Edge 15 Win 10 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 253 bit ECDH (X25519)
|
||||||
|
Edge 101 Win 10 21H2 TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Edge 133 Win 11 23H2 TLSv1.3 TLS_AES_128_GCM_SHA256 X25519MLKEM768
|
||||||
|
Safari 18.4 (iOS 18.4) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Safari 15.4 (macOS 12.3.1) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Safari 18.4 (macOS 15.4) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Java 7u25 No connection
|
||||||
|
Java 8u442 (OpenJDK) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Java 11.0.2 (OpenJDK) TLSv1.3 TLS_AES_128_GCM_SHA256 256 bit ECDH (P-256)
|
||||||
|
Java 17.0.3 (OpenJDK) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Java 21.0.6 (OpenJDK) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
go 1.17.8 TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
LibreSSL 3.3.6 (macOS) TLSv1.3 TLS_CHACHA20_POLY1305_SHA256 253 bit ECDH (X25519)
|
||||||
|
OpenSSL 1.0.2e TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||||
|
OpenSSL 1.1.1d (Debian) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
OpenSSL 3.0.15 (Debian) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
OpenSSL 3.5.0 (git) TLSv1.3 TLS_AES_128_GCM_SHA256 X25519MLKEM768
|
||||||
|
Apple Mail (16.0) TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||||
|
Thunderbird (91.9) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
|
||||||
|
|
||||||
|
Rating (experimental)
|
||||||
|
|
||||||
|
Rating specs (not complete) SSL Labs's 'SSL Server Rating Guide' (version 2009r from 2025-05-16)
|
||||||
|
Specification documentation https://github.com/ssllabs/research/wiki/SSL-Server-Rating-Guide
|
||||||
|
Protocol Support (weighted) 100 (30)
|
||||||
|
Key Exchange (weighted) 100 (30)
|
||||||
|
Cipher Strength (weighted) 90 (36)
|
||||||
|
Final Score 96
|
||||||
|
Overall Grade A+
|
||||||
|
|
||||||
|
Done 2026-11-22 19:18:22 [ 95s] -->> 127.0.0.1:22513 (localhost) <<--
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,261 @@
|
|||||||
|
Generic tests for HTTP/2 server
|
||||||
|
1. Starting HTTP/2
|
||||||
|
1: Sends a client connection preface
✔ 1: Sends a client connection preface
|
||||||
|
|
||||||
|
2. Streams and Multiplexing
|
||||||
|
1: Sends a PRIORITY frame on idle stream
✔ 1: Sends a PRIORITY frame on idle stream
|
||||||
|
2: Sends a WINDOW_UPDATE frame on half-closed (remote) stream
✔ 2: Sends a WINDOW_UPDATE frame on half-closed (remote) stream
|
||||||
|
3: Sends a PRIORITY frame on half-closed (remote) stream
✔ 3: Sends a PRIORITY frame on half-closed (remote) stream
|
||||||
|
4: Sends a RST_STREAM frame on half-closed (remote) stream
✔ 4: Sends a RST_STREAM frame on half-closed (remote) stream
|
||||||
|
5: Sends a PRIORITY frame on closed stream
✔ 5: Sends a PRIORITY frame on closed stream
|
||||||
|
|
||||||
|
3. Frame Definitions
|
||||||
|
3.1. DATA
|
||||||
|
1: Sends a DATA frame
✔ 1: Sends a DATA frame
|
||||||
|
2: Sends multiple DATA frames
✔ 2: Sends multiple DATA frames
|
||||||
|
3: Sends a DATA frame with padding
✔ 3: Sends a DATA frame with padding
|
||||||
|
|
||||||
|
3.2. HEADERS
|
||||||
|
1: Sends a HEADERS frame
✔ 1: Sends a HEADERS frame
|
||||||
|
2: Sends a HEADERS frame with padding
✔ 2: Sends a HEADERS frame with padding
|
||||||
|
3: Sends a HEADERS frame with priority
✔ 3: Sends a HEADERS frame with priority
|
||||||
|
|
||||||
|
3.3. PRIORITY
|
||||||
|
1: Sends a PRIORITY frame with priority 1
✔ 1: Sends a PRIORITY frame with priority 1
|
||||||
|
2: Sends a PRIORITY frame with priority 256
✔ 2: Sends a PRIORITY frame with priority 256
|
||||||
|
3: Sends a PRIORITY frame with stream dependency
✔ 3: Sends a PRIORITY frame with stream dependency
|
||||||
|
4: Sends a PRIORITY frame with exclusive
✔ 4: Sends a PRIORITY frame with exclusive
|
||||||
|
5: Sends a PRIORITY frame for an idle stream, then send a HEADER frame for a lower stream ID
✔ 5: Sends a PRIORITY frame for an idle stream, then send a HEADER frame for a lower stream ID
|
||||||
|
|
||||||
|
3.4. RST_STREAM
|
||||||
|
1: Sends a RST_STREAM frame
✔ 1: Sends a RST_STREAM frame
|
||||||
|
|
||||||
|
3.5. SETTINGS
|
||||||
|
1: Sends a SETTINGS frame
✔ 1: Sends a SETTINGS frame
|
||||||
|
|
||||||
|
3.7. PING
|
||||||
|
1: Sends a PING frame
✔ 1: Sends a PING frame
|
||||||
|
|
||||||
|
3.8. GOAWAY
|
||||||
|
1: Sends a GOAWAY frame
✔ 1: Sends a GOAWAY frame
|
||||||
|
|
||||||
|
3.9. WINDOW_UPDATE
|
||||||
|
1: Sends a WINDOW_UPDATE frame with stream ID 0
✔ 1: Sends a WINDOW_UPDATE frame with stream ID 0
|
||||||
|
2: Sends a WINDOW_UPDATE frame with stream ID 1
✔ 2: Sends a WINDOW_UPDATE frame with stream ID 1
|
||||||
|
|
||||||
|
3.10. CONTINUATION
|
||||||
|
1: Sends a CONTINUATION frame
✔ 1: Sends a CONTINUATION frame
|
||||||
|
2: Sends multiple CONTINUATION frames
✔ 2: Sends multiple CONTINUATION frames
|
||||||
|
|
||||||
|
4. HTTP Message Exchanges
|
||||||
|
1: Sends a GET request
✔ 1: Sends a GET request
|
||||||
|
2: Sends a HEAD request
✔ 2: Sends a HEAD request
|
||||||
|
3: Sends a POST request
✔ 3: Sends a POST request
|
||||||
|
4: Sends a POST request with trailers
✔ 4: Sends a POST request with trailers
|
||||||
|
|
||||||
|
5. HPACK
|
||||||
|
1: Sends a indexed header field representation
✔ 1: Sends a indexed header field representation
|
||||||
|
2: Sends a literal header field with incremental indexing - indexed name
✔ 2: Sends a literal header field with incremental indexing - indexed name
|
||||||
|
3: Sends a literal header field with incremental indexing - indexed name (with Huffman coding)
✔ 3: Sends a literal header field with incremental indexing - indexed name (with Huffman coding)
|
||||||
|
4: Sends a literal header field with incremental indexing - new name
✔ 4: Sends a literal header field with incremental indexing - new name
|
||||||
|
5: Sends a literal header field with incremental indexing - new name (with Huffman coding)
✔ 5: Sends a literal header field with incremental indexing - new name (with Huffman coding)
|
||||||
|
6: Sends a literal header field without indexing - indexed name
✔ 6: Sends a literal header field without indexing - indexed name
|
||||||
|
7: Sends a literal header field without indexing - indexed name (with Huffman coding)
✔ 7: Sends a literal header field without indexing - indexed name (with Huffman coding)
|
||||||
|
8: Sends a literal header field without indexing - new name
✔ 8: Sends a literal header field without indexing - new name
|
||||||
|
9: Sends a literal header field without indexing - new name (huffman encoded)
✔ 9: Sends a literal header field without indexing - new name (huffman encoded)
|
||||||
|
10: Sends a literal header field never indexed - indexed name
✔ 10: Sends a literal header field never indexed - indexed name
|
||||||
|
11: Sends a literal header field never indexed - indexed name (huffman encoded)
✔ 11: Sends a literal header field never indexed - indexed name (huffman encoded)
|
||||||
|
12: Sends a literal header field never indexed - new name
✔ 12: Sends a literal header field never indexed - new name
|
||||||
|
13: Sends a literal header field never indexed - new name (huffman encoded)
✔ 13: Sends a literal header field never indexed - new name (huffman encoded)
|
||||||
|
14: Sends a dynamic table size update
✔ 14: Sends a dynamic table size update
|
||||||
|
15: Sends multiple dynamic table size update
✔ 15: Sends multiple dynamic table size update
|
||||||
|
|
||||||
|
Hypertext Transfer Protocol Version 2 (HTTP/2)
|
||||||
|
3. Starting HTTP/2
|
||||||
|
3.5. HTTP/2 Connection Preface
|
||||||
|
1: Sends client connection preface
✔ 1: Sends client connection preface
|
||||||
|
2: Sends invalid connection preface
✔ 2: Sends invalid connection preface
|
||||||
|
|
||||||
|
4. HTTP Frames
|
||||||
|
4.1. Frame Format
|
||||||
|
1: Sends a frame with unknown type
✔ 1: Sends a frame with unknown type
|
||||||
|
2: Sends a frame with undefined flag
✔ 2: Sends a frame with undefined flag
|
||||||
|
3: Sends a frame with reserved field bit
✔ 3: Sends a frame with reserved field bit
|
||||||
|
|
||||||
|
4.2. Frame Size
|
||||||
|
1: Sends a DATA frame with 2^14 octets in length
✔ 1: Sends a DATA frame with 2^14 octets in length
|
||||||
|
2: Sends a large size DATA frame that exceeds the SETTINGS_MAX_FRAME_SIZE
✔ 2: Sends a large size DATA frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||||
|
3: Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE
✔ 3: Sends a large size HEADERS frame that exceeds the SETTINGS_MAX_FRAME_SIZE
|
||||||
|
|
||||||
|
4.3. Header Compression and Decompression
|
||||||
|
1: Sends invalid header block fragment
✔ 1: Sends invalid header block fragment
|
||||||
|
2: Sends a PRIORITY frame while sending the header blocks
✔ 2: Sends a PRIORITY frame while sending the header blocks
|
||||||
|
3: Sends a HEADERS frame to another stream while sending the header blocks
✔ 3: Sends a HEADERS frame to another stream while sending the header blocks
|
||||||
|
|
||||||
|
5. Streams and Multiplexing
|
||||||
|
5.1. Stream States
|
||||||
|
1: idle: Sends a DATA frame
✔ 1: idle: Sends a DATA frame
|
||||||
|
2: idle: Sends a RST_STREAM frame
✔ 2: idle: Sends a RST_STREAM frame
|
||||||
|
3: idle: Sends a WINDOW_UPDATE frame
✔ 3: idle: Sends a WINDOW_UPDATE frame
|
||||||
|
4: idle: Sends a CONTINUATION frame
✔ 4: idle: Sends a CONTINUATION frame
|
||||||
|
5: half closed (remote): Sends a DATA frame
✔ 5: half closed (remote): Sends a DATA frame
|
||||||
|
6: half closed (remote): Sends a HEADERS frame
✔ 6: half closed (remote): Sends a HEADERS frame
|
||||||
|
7: half closed (remote): Sends a CONTINUATION frame
✔ 7: half closed (remote): Sends a CONTINUATION frame
|
||||||
|
8: closed: Sends a DATA frame after sending RST_STREAM frame
✔ 8: closed: Sends a DATA frame after sending RST_STREAM frame
|
||||||
|
9: closed: Sends a HEADERS frame after sending RST_STREAM frame
✔ 9: closed: Sends a HEADERS frame after sending RST_STREAM frame
|
||||||
|
10: closed: Sends a CONTINUATION frame after sending RST_STREAM frame
✔ 10: closed: Sends a CONTINUATION frame after sending RST_STREAM frame
|
||||||
|
11: closed: Sends a DATA frame
✔ 11: closed: Sends a DATA frame
|
||||||
|
12: closed: Sends a HEADERS frame
✔ 12: closed: Sends a HEADERS frame
|
||||||
|
13: closed: Sends a CONTINUATION frame
✔ 13: closed: Sends a CONTINUATION frame
|
||||||
|
|
||||||
|
5.1.1. Stream Identifiers
|
||||||
|
1: Sends even-numbered stream identifier
✔ 1: Sends even-numbered stream identifier
|
||||||
|
2: Sends stream identifier that is numerically smaller than previous
✔ 2: Sends stream identifier that is numerically smaller than previous
|
||||||
|
|
||||||
|
5.1.2. Stream Concurrency
|
||||||
|
1: Sends HEADERS frames that causes their advertised concurrent stream limit to be exceeded
✔ 1: Sends HEADERS frames that causes their advertised concurrent stream limit to be exceeded
|
||||||
|
|
||||||
|
5.3. Stream Priority
|
||||||
|
5.3.1. Stream Dependencies
|
||||||
|
1: Sends HEADERS frame that depend on itself
✔ 1: Sends HEADERS frame that depend on itself
|
||||||
|
2: Sends PRIORITY frame that depend on itself
✔ 2: Sends PRIORITY frame that depend on itself
|
||||||
|
|
||||||
|
5.4. Error Handling
|
||||||
|
5.4.1. Connection Error Handling
|
||||||
|
1: Sends an invalid PING frame for connection close
✔ 1: Sends an invalid PING frame for connection close
|
||||||
|
|
||||||
|
5.5. Extending HTTP/2
|
||||||
|
1: Sends an unknown extension frame
✔ 1: Sends an unknown extension frame
|
||||||
|
2: Sends an unknown extension frame in the middle of a header block
✔ 2: Sends an unknown extension frame in the middle of a header block
|
||||||
|
|
||||||
|
6. Frame Definitions
|
||||||
|
6.1. DATA
|
||||||
|
1: Sends a DATA frame with 0x0 stream identifier
✔ 1: Sends a DATA frame with 0x0 stream identifier
|
||||||
|
2: Sends a DATA frame on the stream that is not in "open" or "half-closed (local)" state
✔ 2: Sends a DATA frame on the stream that is not in "open" or "half-closed (local)" state
|
||||||
|
3: Sends a DATA frame with invalid pad length
✔ 3: Sends a DATA frame with invalid pad length
|
||||||
|
|
||||||
|
6.2. HEADERS
|
||||||
|
1: Sends a HEADERS frame without the END_HEADERS flag, and a PRIORITY frame
✔ 1: Sends a HEADERS frame without the END_HEADERS flag, and a PRIORITY frame
|
||||||
|
2: Sends a HEADERS frame to another stream while sending a HEADERS frame
✔ 2: Sends a HEADERS frame to another stream while sending a HEADERS frame
|
||||||
|
3: Sends a HEADERS frame with 0x0 stream identifier
✔ 3: Sends a HEADERS frame with 0x0 stream identifier
|
||||||
|
4: Sends a HEADERS frame with invalid pad length
✔ 4: Sends a HEADERS frame with invalid pad length
|
||||||
|
|
||||||
|
6.3. PRIORITY
|
||||||
|
1: Sends a PRIORITY frame with 0x0 stream identifier
✔ 1: Sends a PRIORITY frame with 0x0 stream identifier
|
||||||
|
2: Sends a PRIORITY frame with a length other than 5 octets
✔ 2: Sends a PRIORITY frame with a length other than 5 octets
|
||||||
|
|
||||||
|
6.4. RST_STREAM
|
||||||
|
1: Sends a RST_STREAM frame with 0x0 stream identifier
✔ 1: Sends a RST_STREAM frame with 0x0 stream identifier
|
||||||
|
2: Sends a RST_STREAM frame on a idle stream
✔ 2: Sends a RST_STREAM frame on a idle stream
|
||||||
|
3: Sends a RST_STREAM frame with a length other than 4 octets
✔ 3: Sends a RST_STREAM frame with a length other than 4 octets
|
||||||
|
|
||||||
|
6.5. SETTINGS
|
||||||
|
1: Sends a SETTINGS frame with ACK flag and payload
✔ 1: Sends a SETTINGS frame with ACK flag and payload
|
||||||
|
2: Sends a SETTINGS frame with a stream identifier other than 0x0
✔ 2: Sends a SETTINGS frame with a stream identifier other than 0x0
|
||||||
|
3: Sends a SETTINGS frame with a length other than a multiple of 6 octets
✔ 3: Sends a SETTINGS frame with a length other than a multiple of 6 octets
|
||||||
|
|
||||||
|
6.5.2. Defined SETTINGS Parameters
|
||||||
|
1: SETTINGS_ENABLE_PUSH (0x2): Sends the value other than 0 or 1
✔ 1: SETTINGS_ENABLE_PUSH (0x2): Sends the value other than 0 or 1
|
||||||
|
2: SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size
✔ 2: SETTINGS_INITIAL_WINDOW_SIZE (0x4): Sends the value above the maximum flow control window size
|
||||||
|
3: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value
✔ 3: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value below the initial value
|
||||||
|
4: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size
✔ 4: SETTINGS_MAX_FRAME_SIZE (0x5): Sends the value above the maximum allowed frame size
|
||||||
|
5: Sends a SETTINGS frame with unknown identifier
✔ 5: Sends a SETTINGS frame with unknown identifier
|
||||||
|
|
||||||
|
6.5.3. Settings Synchronization
|
||||||
|
1: Sends multiple values of SETTINGS_INITIAL_WINDOW_SIZE
✔ 1: Sends multiple values of SETTINGS_INITIAL_WINDOW_SIZE
|
||||||
|
2: Sends a SETTINGS frame without ACK flag
✔ 2: Sends a SETTINGS frame without ACK flag
|
||||||
|
|
||||||
|
6.7. PING
|
||||||
|
1: Sends a PING frame
✔ 1: Sends a PING frame
|
||||||
|
2: Sends a PING frame with ACK
✔ 2: Sends a PING frame with ACK
|
||||||
|
3: Sends a PING frame with a stream identifier field value other than 0x0
✔ 3: Sends a PING frame with a stream identifier field value other than 0x0
|
||||||
|
4: Sends a PING frame with a length field value other than 8
✔ 4: Sends a PING frame with a length field value other than 8
|
||||||
|
|
||||||
|
6.8. GOAWAY
|
||||||
|
1: Sends a GOAWAY frame with a stream identifier other than 0x0
✔ 1: Sends a GOAWAY frame with a stream identifier other than 0x0
|
||||||
|
|
||||||
|
6.9. WINDOW_UPDATE
|
||||||
|
1: Sends a WINDOW_UPDATE frame with a flow control window increment of 0
✔ 1: Sends a WINDOW_UPDATE frame with a flow control window increment of 0
|
||||||
|
2: Sends a WINDOW_UPDATE frame with a flow control window increment of 0 on a stream
✔ 2: Sends a WINDOW_UPDATE frame with a flow control window increment of 0 on a stream
|
||||||
|
3: Sends a WINDOW_UPDATE frame with a length other than 4 octets
✔ 3: Sends a WINDOW_UPDATE frame with a length other than 4 octets
|
||||||
|
|
||||||
|
6.9.1. The Flow-Control Window
|
||||||
|
1: Sends SETTINGS frame to set the initial window size to 1 and sends HEADERS frame
✔ 1: Sends SETTINGS frame to set the initial window size to 1 and sends HEADERS frame
|
||||||
|
2: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1
✔ 2: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1
|
||||||
|
3: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1 on a stream
✔ 3: Sends multiple WINDOW_UPDATE frames increasing the flow control window to above 2^31-1 on a stream
|
||||||
|
|
||||||
|
6.9.2. Initial Flow-Control Window Size
|
||||||
|
1: Changes SETTINGS_INITIAL_WINDOW_SIZE after sending HEADERS frame
✔ 1: Changes SETTINGS_INITIAL_WINDOW_SIZE after sending HEADERS frame
|
||||||
|
2: Sends a SETTINGS frame for window size to be negative
2: Sends a SETTINGS frame for window size to be negative
|
||||||
|
3: Sends a SETTINGS_INITIAL_WINDOW_SIZE settings with an exceeded maximum window size value
✔ 3: Sends a SETTINGS_INITIAL_WINDOW_SIZE settings with an exceeded maximum window size value
|
||||||
|
|
||||||
|
6.10. CONTINUATION
|
||||||
|
1: Sends multiple CONTINUATION frames preceded by a HEADERS frame
✔ 1: Sends multiple CONTINUATION frames preceded by a HEADERS frame
|
||||||
|
2: Sends a CONTINUATION frame followed by any frame other than CONTINUATION
✔ 2: Sends a CONTINUATION frame followed by any frame other than CONTINUATION
|
||||||
|
3: Sends a CONTINUATION frame with 0x0 stream identifier
✔ 3: Sends a CONTINUATION frame with 0x0 stream identifier
|
||||||
|
4: Sends a CONTINUATION frame preceded by a HEADERS frame with END_HEADERS flag
✔ 4: Sends a CONTINUATION frame preceded by a HEADERS frame with END_HEADERS flag
|
||||||
|
5: Sends a CONTINUATION frame preceded by a CONTINUATION frame with END_HEADERS flag
✔ 5: Sends a CONTINUATION frame preceded by a CONTINUATION frame with END_HEADERS flag
|
||||||
|
6: Sends a CONTINUATION frame preceded by a DATA frame
✔ 6: Sends a CONTINUATION frame preceded by a DATA frame
|
||||||
|
|
||||||
|
7. Error Codes
|
||||||
|
1: Sends a GOAWAY frame with unknown error code
✔ 1: Sends a GOAWAY frame with unknown error code
|
||||||
|
2: Sends a RST_STREAM frame with unknown error code
✔ 2: Sends a RST_STREAM frame with unknown error code
|
||||||
|
|
||||||
|
8. HTTP Message Exchanges
|
||||||
|
8.1. HTTP Request/Response Exchange
|
||||||
|
1: Sends a second HEADERS frame without the END_STREAM flag
✔ 1: Sends a second HEADERS frame without the END_STREAM flag
|
||||||
|
|
||||||
|
8.1.2. HTTP Header Fields
|
||||||
|
1: Sends a HEADERS frame that contains the header field name in uppercase letters
✔ 1: Sends a HEADERS frame that contains the header field name in uppercase letters
|
||||||
|
|
||||||
|
8.1.2.1. Pseudo-Header Fields
|
||||||
|
1: Sends a HEADERS frame that contains a unknown pseudo-header field
✔ 1: Sends a HEADERS frame that contains a unknown pseudo-header field
|
||||||
|
2: Sends a HEADERS frame that contains the pseudo-header field defined for response
✔ 2: Sends a HEADERS frame that contains the pseudo-header field defined for response
|
||||||
|
3: Sends a HEADERS frame that contains a pseudo-header field as trailers
✔ 3: Sends a HEADERS frame that contains a pseudo-header field as trailers
|
||||||
|
4: Sends a HEADERS frame that contains a pseudo-header field that appears in a header block after a regular header field
✔ 4: Sends a HEADERS frame that contains a pseudo-header field that appears in a header block after a regular header field
|
||||||
|
|
||||||
|
8.1.2.2. Connection-Specific Header Fields
|
||||||
|
1: Sends a HEADERS frame that contains the connection-specific header field
✔ 1: Sends a HEADERS frame that contains the connection-specific header field
|
||||||
|
2: Sends a HEADERS frame that contains the TE header field with any value other than "trailers"
✔ 2: Sends a HEADERS frame that contains the TE header field with any value other than "trailers"
|
||||||
|
|
||||||
|
8.1.2.3. Request Pseudo-Header Fields
|
||||||
|
1: Sends a HEADERS frame with empty ":path" pseudo-header field
✔ 1: Sends a HEADERS frame with empty ":path" pseudo-header field
|
||||||
|
2: Sends a HEADERS frame that omits ":method" pseudo-header field
✔ 2: Sends a HEADERS frame that omits ":method" pseudo-header field
|
||||||
|
3: Sends a HEADERS frame that omits ":scheme" pseudo-header field
✔ 3: Sends a HEADERS frame that omits ":scheme" pseudo-header field
|
||||||
|
4: Sends a HEADERS frame that omits ":path" pseudo-header field
✔ 4: Sends a HEADERS frame that omits ":path" pseudo-header field
|
||||||
|
5: Sends a HEADERS frame with duplicated ":method" pseudo-header field
✔ 5: Sends a HEADERS frame with duplicated ":method" pseudo-header field
|
||||||
|
6: Sends a HEADERS frame with duplicated ":scheme" pseudo-header field
✔ 6: Sends a HEADERS frame with duplicated ":scheme" pseudo-header field
|
||||||
|
7: Sends a HEADERS frame with duplicated ":path" pseudo-header field
✔ 7: Sends a HEADERS frame with duplicated ":path" pseudo-header field
|
||||||
|
|
||||||
|
8.1.2.6. Malformed Requests and Responses
|
||||||
|
1: Sends a HEADERS frame with the "content-length" header field which does not equal the DATA frame payload length
✔ 1: Sends a HEADERS frame with the "content-length" header field which does not equal the DATA frame payload length
|
||||||
|
2: Sends a HEADERS frame with the "content-length" header field which does not equal the sum of the multiple DATA frames payload length
✔ 2: Sends a HEADERS frame with the "content-length" header field which does not equal the sum of the multiple DATA frames payload length
|
||||||
|
|
||||||
|
8.2. Server Push
|
||||||
|
1: Sends a PUSH_PROMISE frame
✔ 1: Sends a PUSH_PROMISE frame
|
||||||
|
|
||||||
|
HPACK: Header Compression for HTTP/2
|
||||||
|
2. Compression Process Overview
|
||||||
|
2.3. Indexing Tables
|
||||||
|
2.3.3. Index Address Space
|
||||||
|
1: Sends a header field representation with invalid index
✔ 1: Sends a header field representation with invalid index
|
||||||
|
|
||||||
|
4. Dynamic Table Management
|
||||||
|
4.2. Maximum Table Size
|
||||||
|
1: Sends a dynamic table size update at the end of header block
✔ 1: Sends a dynamic table size update at the end of header block
|
||||||
|
|
||||||
|
5. Primitive Type Representations
|
||||||
|
5.2. String Literal Representation
|
||||||
|
1: Sends a Huffman-encoded string literal representation with padding longer than 7 bits
✔ 1: Sends a Huffman-encoded string literal representation with padding longer than 7 bits
|
||||||
|
2: Sends a Huffman-encoded string literal representation padded by zero
✔ 2: Sends a Huffman-encoded string literal representation padded by zero
|
||||||
|
3: Sends a Huffman-encoded string literal representation containing the EOS symbol
✔ 3: Sends a Huffman-encoded string literal representation containing the EOS symbol
|
||||||
|
|
||||||
|
6. Binary Format
|
||||||
|
6.1. Indexed Header Field Representation
|
||||||
|
1: Sends a indexed header field representation with index 0
✔ 1: Sends a indexed header field representation with index 0
|
||||||
|
|
||||||
|
6.3. Dynamic Table Size Update
|
||||||
|
1: Sends a dynamic table size update larger than the value of SETTINGS_HEADER_TABLE_SIZE
✔ 1: Sends a dynamic table size update larger than the value of SETTINGS_HEADER_TABLE_SIZE
|
||||||
|
|
||||||
|
Finished in 0.6470 seconds
|
||||||
|
145 tests, 144 passed, 1 skipped, 0 failed
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
h2 28753: closed after 2.5s; frames from server [(4, 0, '0003000000640006'), (4, 1, ''), (7, 0, '000000000000000b')]
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
idle 28753: closed after 60.0s (b'')
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,196 @@
|
|||||||
|
|
||||||
|
Start 2026-11-22 19:13:48 -->> 127.0.0.1:28753 (localhost) <<--
|
||||||
|
|
||||||
|
A record via: supplied IP "127.0.0.1"
|
||||||
|
rDNS (127.0.0.1): localhost. kubernetes.docker.internal.
|
||||||
|
Service detected: HTTP
|
||||||
|
|
||||||
|
Testing protocols via sockets except NPN+ALPN
|
||||||
|
|
||||||
|
SSLv2 not offered (OK)
|
||||||
|
SSLv3 not offered (OK)
|
||||||
|
TLS 1 not offered
|
||||||
|
TLS 1.1 not offered
|
||||||
|
TLS 1.2 offered (OK)
|
||||||
|
TLS 1.3 offered (OK): final
|
||||||
|
NPN/SPDY not offered
|
||||||
|
ALPN/HTTP2 h2, http/1.1 (offered)
|
||||||
|
|
||||||
|
Testing cipher categories
|
||||||
|
|
||||||
|
NULL ciphers (no encryption) not offered (OK)
|
||||||
|
Anonymous NULL Ciphers (no authentication) not offered (OK)
|
||||||
|
Export ciphers (w/o ADH+NULL) not offered (OK)
|
||||||
|
LOW: 64 Bit + DES, RC[2,4], MD5 (w/o export) not offered (OK)
|
||||||
|
Triple DES Ciphers / IDEA not offered
|
||||||
|
Obsoleted CBC ciphers (AES, ARIA etc.) not offered
|
||||||
|
Strong encryption (AEAD ciphers) with no FS not offered
|
||||||
|
Forward Secrecy strong encryption (AEAD ciphers) offered (OK)
|
||||||
|
|
||||||
|
|
||||||
|
Testing server's cipher preferences
|
||||||
|
|
||||||
|
Hexcode Cipher Suite Name (OpenSSL) KeyExch. Encryption Bits Cipher Suite Name (IANA/RFC)
|
||||||
|
-----------------------------------------------------------------------------------------------------------------------------
|
||||||
|
SSLv2
|
||||||
|
-
|
||||||
|
SSLv3
|
||||||
|
-
|
||||||
|
TLSv1
|
||||||
|
-
|
||||||
|
TLSv1.1
|
||||||
|
-
|
||||||
|
TLSv1.2 (no server order, thus listed by strength)
|
||||||
|
xc02c ECDHE-ECDSA-AES256-GCM-SHA384 ECDH 253 AESGCM 256 TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
|
||||||
|
xcca9 ECDHE-ECDSA-CHACHA20-POLY1305 ECDH 253 ChaCha20 256 TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
|
||||||
|
xc02b ECDHE-ECDSA-AES128-GCM-SHA256 ECDH 253 AESGCM 128 TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
|
||||||
|
TLSv1.3 (no server order, thus listed by strength)
|
||||||
|
x1302 TLS_AES_256_GCM_SHA384 ECDH 253 AESGCM 256 TLS_AES_256_GCM_SHA384
|
||||||
|
x1303 TLS_CHACHA20_POLY1305_SHA256 ECDH 253 ChaCha20 256 TLS_CHACHA20_POLY1305_SHA256
|
||||||
|
x1301 TLS_AES_128_GCM_SHA256 ECDH 253 AESGCM 128 TLS_AES_128_GCM_SHA256
|
||||||
|
|
||||||
|
Has server cipher order? no
|
||||||
|
(limited sense as client will pick)
|
||||||
|
|
||||||
|
Testing robust forward secrecy (FS) -- omitting Null Authentication/Encryption, 3DES, RC4
|
||||||
|
|
||||||
|
FS is offered (OK) TLS_AES_256_GCM_SHA384
|
||||||
|
TLS_CHACHA20_POLY1305_SHA256
|
||||||
|
ECDHE-ECDSA-AES256-GCM-SHA384
|
||||||
|
ECDHE-ECDSA-CHACHA20-POLY1305
|
||||||
|
TLS_AES_128_GCM_SHA256
|
||||||
|
ECDHE-ECDSA-AES128-GCM-SHA256
|
||||||
|
Elliptic curves offered: prime256v1 secp384r1 X25519
|
||||||
|
TLS 1.2 sig_algs offered: ECDSA+SHA256
|
||||||
|
TLS 1.3 sig_algs offered: ECDSA+SHA256
|
||||||
|
|
||||||
|
Testing server defaults (Server Hello)
|
||||||
|
|
||||||
|
TLS extensions (standard) "server name/#0"
|
||||||
|
"application layer protocol negotiation/#16"
|
||||||
|
"extended master secret/#23"
|
||||||
|
"supported versions/#43" "key share/#51"
|
||||||
|
"renegotiation info/#65281"
|
||||||
|
Session Ticket RFC 5077 hint 86400 seconds, session tickets keys seems to be rotated < daily
|
||||||
|
SSL Session ID support yes
|
||||||
|
Session Resumption Tickets: yes, ID: yes
|
||||||
|
TLS clock skew Random values, no fingerprinting possible
|
||||||
|
Certificate Compression none
|
||||||
|
Client Authentication none
|
||||||
|
Signature Algorithm ECDSA with SHA256
|
||||||
|
Server key size EC 256 bits (curve P-256)
|
||||||
|
Server key usage Digital Signature
|
||||||
|
Server extended key usage TLS Web Server Authentication
|
||||||
|
Serial 4FACDAB031F57BFDD07B95B92D64D3DD961BBE52 (OK: length 20)
|
||||||
|
Fingerprints SHA1 CCC98BD66BED804F5229E746BD9A063FCB608008
|
||||||
|
SHA256 8890533F47576EDA7B8F9E56E317548BF3C583318FF4A2B2971F79223D640691
|
||||||
|
Common Name (CN) localhost (request w/o SNI didn't succeed, usual for EC certificates)
|
||||||
|
subjectAltName (SAN) localhost
|
||||||
|
Trust (hostname) Ok via SAN and CN (SNI mandatory)
|
||||||
|
Chain of trust Ok
|
||||||
|
EV cert (experimental) no
|
||||||
|
Certificate Validity (UTC) 755726 >= 60 days (1975-01-01 00:00 --> 4096-01-01 00:00)
|
||||||
|
>= 10 years is way too long
|
||||||
|
ETS/"eTLS", visibility info not present
|
||||||
|
Certificate Revocation List --
|
||||||
|
OCSP URI --
|
||||||
|
NOT ok -- neither CRL nor OCSP URI provided
|
||||||
|
OCSP stapling not offered
|
||||||
|
OCSP must staple extension --
|
||||||
|
DNS CAA RR (experimental) not offered
|
||||||
|
Certificate Transparency --
|
||||||
|
Certificates provided 1
|
||||||
|
Issuer Ianitor Pair Test CA
|
||||||
|
Intermediate Bad OCSP (exp.) Ok
|
||||||
|
|
||||||
|
|
||||||
|
Testing HTTP header response @ "/"
|
||||||
|
|
||||||
|
HTTP Status Code 200 OK
|
||||||
|
HTTP clock skew 0 sec from localtime
|
||||||
|
Strict Transport Security not offered
|
||||||
|
Public Key Pinning --
|
||||||
|
Server banner (no "Server" line in header, interesting!)
|
||||||
|
Application banner --
|
||||||
|
Cookie(s) (none issued at "/")
|
||||||
|
Security headers --
|
||||||
|
Reverse Proxy banner --
|
||||||
|
|
||||||
|
|
||||||
|
Testing vulnerabilities
|
||||||
|
|
||||||
|
Heartbleed (CVE-2014-0160) not vulnerable (OK), no heartbeat extension
|
||||||
|
CCS (CVE-2014-0224) not vulnerable (OK)
|
||||||
|
Ticketbleed (CVE-2016-9244), experiment. not vulnerable (OK), no session ticket extension
|
||||||
|
ROBOT Server does not support any cipher suites that use RSA key transport
|
||||||
|
Secure Renegotiation (RFC 5746) supported (OK)
|
||||||
|
Secure Client-Initiated Renegotiation not vulnerable (OK) -- mitigated (1 successful reneg within 10 in 33s(timeout))
|
||||||
|
CRIME, TLS (CVE-2012-4929) not vulnerable (OK)
|
||||||
|
BREACH (CVE-2013-3587) no gzip/deflate/compress/br HTTP compression (OK) - only supplied "/" tested
|
||||||
|
POODLE, SSL (CVE-2014-3566) not vulnerable (OK), no SSLv3 support
|
||||||
|
TLS_FALLBACK_SCSV (RFC 7507) No fallback possible (OK), no protocol below TLS 1.2 offered
|
||||||
|
SWEET32 (CVE-2016-2183, CVE-2016-6329) not vulnerable (OK)
|
||||||
|
FREAK (CVE-2015-0204) not vulnerable (OK)
|
||||||
|
DROWN (CVE-2016-0800, CVE-2016-0703) not vulnerable on this host and port (OK)
|
||||||
|
no RSA certificate, thus certificate can't be used with SSLv2 elsewhere
|
||||||
|
LOGJAM (CVE-2015-4000), experimental not vulnerable (OK): no DH EXPORT ciphers, no DH key detected with <= TLS 1.2
|
||||||
|
BEAST (CVE-2011-3389) not vulnerable (OK), no SSL3 or TLS1
|
||||||
|
LUCKY13 (CVE-2013-0169), experimental not vulnerable (OK)
|
||||||
|
Winshock (CVE-2014-6321), experimental not vulnerable (OK)
|
||||||
|
RC4 (CVE-2013-2566, CVE-2015-2808) no RC4 ciphers detected (OK)
|
||||||
|
|
||||||
|
|
||||||
|
Running client simulations (HTTP) via sockets
|
||||||
|
|
||||||
|
Browser Protocol Cipher Suite Name (OpenSSL) Forward Secrecy
|
||||||
|
------------------------------------------------------------------------------------------------
|
||||||
|
Android 7.0 (native) TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||||
|
Android 8.1 (native) TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 253 bit ECDH (X25519)
|
||||||
|
Android 9.0 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Android 10.0 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Android 11/12 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Android 13/14 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Android 15 (native) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Chrome 101 (Win 10) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Chromium 137 (Win 11) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Firefox 100 (Win 10) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Firefox 137 (Win 11) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
IE 8 Win 7 No connection
|
||||||
|
IE 11 Win 7 TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 256 bit ECDH (P-256)
|
||||||
|
IE 11 Win 8.1 TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 256 bit ECDH (P-256)
|
||||||
|
IE 11 Win Phone 8.1 TLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256 256 bit ECDH (P-256)
|
||||||
|
IE 11 Win 10 TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 256 bit ECDH (P-256)
|
||||||
|
Edge 15 Win 10 TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 253 bit ECDH (X25519)
|
||||||
|
Edge 101 Win 10 21H2 TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Edge 133 Win 11 23H2 TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Safari 18.4 (iOS 18.4) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Safari 15.4 (macOS 12.3.1) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Safari 18.4 (macOS 15.4) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
Java 7u25 No connection
|
||||||
|
Java 8u442 (OpenJDK) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||||
|
Java 11.0.2 (OpenJDK) TLSv1.3 TLS_AES_128_GCM_SHA256 256 bit ECDH (P-256)
|
||||||
|
Java 17.0.3 (OpenJDK) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||||
|
Java 21.0.6 (OpenJDK) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||||
|
go 1.17.8 TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
LibreSSL 3.3.6 (macOS) TLSv1.3 TLS_CHACHA20_POLY1305_SHA256 253 bit ECDH (X25519)
|
||||||
|
OpenSSL 1.0.2e TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 256 bit ECDH (P-256)
|
||||||
|
OpenSSL 1.1.1d (Debian) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||||
|
OpenSSL 3.0.15 (Debian) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||||
|
OpenSSL 3.5.0 (git) TLSv1.3 TLS_AES_256_GCM_SHA384 253 bit ECDH (X25519)
|
||||||
|
Apple Mail (16.0) TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384 256 bit ECDH (P-256)
|
||||||
|
Thunderbird (91.9) TLSv1.3 TLS_AES_128_GCM_SHA256 253 bit ECDH (X25519)
|
||||||
|
|
||||||
|
|
||||||
|
Rating (experimental)
|
||||||
|
|
||||||
|
Rating specs (not complete) SSL Labs's 'SSL Server Rating Guide' (version 2009r from 2025-05-16)
|
||||||
|
Specification documentation https://github.com/ssllabs/research/wiki/SSL-Server-Rating-Guide
|
||||||
|
Protocol Support (weighted) 100 (30)
|
||||||
|
Key Exchange (weighted) 100 (30)
|
||||||
|
Cipher Strength (weighted) 90 (36)
|
||||||
|
Final Score 96
|
||||||
|
Overall Grade A+
|
||||||
|
|
||||||
|
Done 2026-11-22 19:15:25 [ 103s] -->> 127.0.0.1:28753 (localhost) <<--
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"build":"release","caddy_version":"v2.11.7 (go install; /root/go/bin/caddy: go1.26.8)","edge_threads":2}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
engine,scenario,connections,duration_s,requests,rps,p50_ms,p90_ms,p99_ms,max_ms,success_rate,non_2xx,rss_kb_after
|
||||||
|
ianitor,https-h1-keepalive,1,15,27924,1861,0.3,0.34,9.03,82.42,1.0,0,13228
|
||||||
|
ianitor,https-h2,1,15,32594,2173,0.37,0.41,0.77,33.56,1.0,0,13444
|
||||||
|
ianitor,https-h1-keepalive,16,15.03,57767,3843,1.85,11.28,28.77,130.96,1.0,0,15408
|
||||||
|
ianitor,https-h2,16,15,70840,4723,1.51,9.54,27.5,80.67,1.0,0,16388
|
||||||
|
ianitor,https-h1-keepalive,64,15.04,99114,6596,4.94,27.15,50.88,137.67,1.0,0,21272
|
||||||
|
ianitor,https-h2,64,15.02,176136,11726,4.55,7.93,23.21,65.82,1.0,0,24520
|
||||||
|
ianitor,https-h1-keepalive,256,15.02,66156,4421,52.26,98.36,155.59,307.77,1.0,0,38620
|
||||||
|
ianitor,https-h2,256,15,59482,3981,60.98,101.34,146.55,233.81,1.0,0,52184
|
||||||
|
ianitor,https-h1-new-conn,16,15,18250,1218,8.57,30.28,50.64,122.99,1.0,0,52200
|
||||||
|
ianitor,http-redirect,64,15,203706,13582,1.84,15.68,32.41,87.56,1.0,203706,55620
|
||||||
|
caddy,https-h1-keepalive,1,15,26362,1757,0.46,0.53,2.48,106.04,1.0,0,59828
|
||||||
|
caddy,https-h2,1,15,20631,1375,0.64,0.72,1.4,33.45,1.0,0,60084
|
||||||
|
caddy,https-h1-keepalive,16,15.01,103603,6905,0.54,2.83,45.47,162.27,1.0,0,65660
|
||||||
|
caddy,https-h2,16,15.02,91438,6090,0.74,5.56,35.64,134.4,1.0,0,69348
|
||||||
|
caddy,https-h1-keepalive,64,15.02,234993,15653,1.94,9.85,31.3,146.84,1.0,0,79068
|
||||||
|
caddy,https-h2,64,15.01,127103,8472,2.46,19.38,59.58,156.96,1.0,0,82992
|
||||||
|
caddy,https-h1-keepalive,256,15.02,189465,12632,13.37,48.12,101.94,418.37,1.0,0,130136
|
||||||
|
caddy,https-h2,256,15.09,151866,10077,19.21,53.91,101.9,464.76,1.0,0,130716
|
||||||
|
caddy,https-h1-new-conn,16,15,33531,2236,2.41,16.71,65.02,173.34,1.0,0,98300
|
||||||
|
caddy,http-redirect,64,15.02,811365,54027,0.23,2.49,16.27,82.11,1.0,811365,104520
|
||||||
|
caddy_gomaxprocs2,https-h1-keepalive,1,15,35264,2351,0.41,0.48,0.79,48.27,1.0,0,56800
|
||||||
|
caddy_gomaxprocs2,https-h2,1,15,23823,1588,0.59,0.68,1.41,27.62,1.0,0,57684
|
||||||
|
caddy_gomaxprocs2,https-h1-keepalive,16,15,116399,7759,1.57,3.49,11.23,60.1,1.0,0,61076
|
||||||
|
caddy_gomaxprocs2,https-h2,16,15,51386,3426,2.71,11,28.59,68.23,1.0,0,61652
|
||||||
|
caddy_gomaxprocs2,https-h1-keepalive,64,15.02,98458,6561,7.37,19.47,39.84,166.73,1.0,0,68012
|
||||||
|
caddy_gomaxprocs2,https-h2,64,15,85584,5708,10.26,19.29,37.34,79.44,1.0,0,68616
|
||||||
|
caddy_gomaxprocs2,https-h1-keepalive,256,15,66867,4473,52.61,92.37,147.03,218.19,1.0,0,95680
|
||||||
|
caddy_gomaxprocs2,https-h2,256,15.01,53887,3607,68.4,97.91,134.35,193.25,1.0,0,98972
|
||||||
|
caddy_gomaxprocs2,https-h1-new-conn,16,15,27335,1823,7.93,14.23,21.39,67.37,1.0,0,78728
|
||||||
|
caddy_gomaxprocs2,http-redirect,64,15,255374,17027,2.85,8.19,15.52,59.82,1.0,255374,79764
|
||||||
|
ianitor,soak-https-h1,32,300.04,1873622,6245,3.23,10.32,31.29,134.28,1.0,0,55588
|
||||||
|
caddy,soak-https-h1,32,300,3909309,13031,0.81,4,35.44,204.14,1.0,0,76592
|
||||||
|
@@ -0,0 +1,103 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.018795747,
|
||||||
|
"slowest": 0.0821075,
|
||||||
|
"fastest": 0.0000375,
|
||||||
|
"average": 0.001179247194193746,
|
||||||
|
"requestsPerSec": 54027.367684395205,
|
||||||
|
"totalData": 0,
|
||||||
|
"sizePerRequest": 0,
|
||||||
|
"sizePerSec": 0.0
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 54027.367684395205,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.038,
|
||||||
|
"mean": 1.179,
|
||||||
|
"p50": 0.23,
|
||||||
|
"p95": 5.971,
|
||||||
|
"p99": 16.271,
|
||||||
|
"max": 82.108
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0000375": 1,
|
||||||
|
"0.0082445": 782396,
|
||||||
|
"0.0164515": 21154,
|
||||||
|
"0.024658500000000003": 4721,
|
||||||
|
"0.032865500000000006": 1979,
|
||||||
|
"0.041072500000000005": 642,
|
||||||
|
"0.04927950000000001": 285,
|
||||||
|
"0.05748650000000001": 97,
|
||||||
|
"0.0656935": 69,
|
||||||
|
"0.07390050000000001": 13,
|
||||||
|
"0.0821075": 8
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0001,
|
||||||
|
"p25": 0.0001339,
|
||||||
|
"p50": 0.0002301,
|
||||||
|
"p75": 0.0006239,
|
||||||
|
"p90": 0.0024874,
|
||||||
|
"p95": 0.0059708,
|
||||||
|
"p99": 0.0162705,
|
||||||
|
"p99.9": 0.035564001,
|
||||||
|
"p99.99": 0.058229699
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"NaN": 0
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": null,
|
||||||
|
"p25": null,
|
||||||
|
"p50": null,
|
||||||
|
"p75": null,
|
||||||
|
"p90": null,
|
||||||
|
"p95": null,
|
||||||
|
"p99": null,
|
||||||
|
"p99.9": null,
|
||||||
|
"p99.99": null
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 54291.93014905917,
|
||||||
|
"stddev": 35527.321305323385,
|
||||||
|
"max": 242214.53287198595,
|
||||||
|
"min": 34.10571407133535,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 10336.487801940571,
|
||||||
|
"p25": 27170.358145573246,
|
||||||
|
"p50": 50733.48409950603,
|
||||||
|
"p75": 75221.81432615055,
|
||||||
|
"p90": 101909.04267567223,
|
||||||
|
"p95": 115807.99195777836,
|
||||||
|
"p99": 156641.40862929283,
|
||||||
|
"p99.9": 221158.1045172193,
|
||||||
|
"p99.99": 242214.53287198595
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.0003536109375000002,
|
||||||
|
"fastest": 0.0001347,
|
||||||
|
"slowest": 0.0007735
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.000012493750000000002,
|
||||||
|
"fastest": 3.3e-6,
|
||||||
|
"slowest": 0.0000612
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": null,
|
||||||
|
"fastest": null,
|
||||||
|
"slowest": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"308": 811365
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 61
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.002358804,
|
||||||
|
"slowest": 0.1060408,
|
||||||
|
"fastest": 0.0003051,
|
||||||
|
"average": 0.0005643368714058144,
|
||||||
|
"requestsPerSec": 1757.2569983442186,
|
||||||
|
"totalData": 79086,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 5271.57102647843
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 1757.2569983442186,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.305,
|
||||||
|
"mean": 0.564,
|
||||||
|
"p50": 0.462,
|
||||||
|
"p95": 0.581,
|
||||||
|
"p99": 2.482,
|
||||||
|
"max": 106.041
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0003051": 1,
|
||||||
|
"0.01087867": 26273,
|
||||||
|
"0.02145224": 84,
|
||||||
|
"0.03202581": 2,
|
||||||
|
"0.042599380000000006": 1,
|
||||||
|
"0.05317295000000001": 0,
|
||||||
|
"0.06374652": 0,
|
||||||
|
"0.07432009": 0,
|
||||||
|
"0.08489366000000001": 0,
|
||||||
|
"0.09546723000000001": 0,
|
||||||
|
"0.10604080000000002": 1
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.000409,
|
||||||
|
"p25": 0.0004393,
|
||||||
|
"p50": 0.000462,
|
||||||
|
"p75": 0.0004879,
|
||||||
|
"p90": 0.0005264,
|
||||||
|
"p95": 0.0005808,
|
||||||
|
"p99": 0.0024822,
|
||||||
|
"p99.9": 0.0170555,
|
||||||
|
"p99.99": 0.0262408
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0003048": 1,
|
||||||
|
"0.01087831": 26273,
|
||||||
|
"0.021451820000000003": 84,
|
||||||
|
"0.032025330000000005": 2,
|
||||||
|
"0.042598840000000006": 1,
|
||||||
|
"0.05317235000000001": 0,
|
||||||
|
"0.06374586": 0,
|
||||||
|
"0.07431937": 0,
|
||||||
|
"0.08489288": 0,
|
||||||
|
"0.09546639000000001": 0,
|
||||||
|
"0.1060399": 1
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0004086,
|
||||||
|
"p25": 0.0004391,
|
||||||
|
"p50": 0.0004617,
|
||||||
|
"p75": 0.0004876,
|
||||||
|
"p90": 0.0005262,
|
||||||
|
"p95": 0.0005805,
|
||||||
|
"p99": 0.0024819,
|
||||||
|
"p99.9": 0.0170542,
|
||||||
|
"p99.99": 0.0262398
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 1850.6971373175163,
|
||||||
|
"stddev": 606.3350485897364,
|
||||||
|
"max": 2964.7198339758224,
|
||||||
|
"min": 9.387873121017195,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 907.2763563781903,
|
||||||
|
"p25": 1902.682782723684,
|
||||||
|
"p50": 2064.026089289704,
|
||||||
|
"p75": 2140.8910184526935,
|
||||||
|
"p90": 2218.8603126577123,
|
||||||
|
"p95": 2277.2205488101326,
|
||||||
|
"p99": 2732.8211824008627,
|
||||||
|
"p99.9": 2906.8077437358256,
|
||||||
|
"p99.99": 2964.7198339758224
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.104945,
|
||||||
|
"fastest": 0.104945,
|
||||||
|
"slowest": 0.104945
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.000049,
|
||||||
|
"fastest": 0.000049,
|
||||||
|
"slowest": 0.000049
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.0005640438625293983,
|
||||||
|
"fastest": 0.0003048,
|
||||||
|
"slowest": 0.1060399
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 26362
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.005755808,
|
||||||
|
"slowest": 0.162273399,
|
||||||
|
"fastest": 0.0001583,
|
||||||
|
"average": 0.0023110564513672536,
|
||||||
|
"requestsPerSec": 6905.283634214395,
|
||||||
|
"totalData": 310809,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 20712.6521300779
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 6905.283634214395,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.158,
|
||||||
|
"mean": 2.311,
|
||||||
|
"p50": 0.541,
|
||||||
|
"p95": 9.38,
|
||||||
|
"p99": 45.474,
|
||||||
|
"max": 162.273
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0001583": 1,
|
||||||
|
"0.0163698099": 100653,
|
||||||
|
"0.0325813198": 1436,
|
||||||
|
"0.0487928297": 579,
|
||||||
|
"0.0650043396": 448,
|
||||||
|
"0.0812158495": 237,
|
||||||
|
"0.0974273594": 87,
|
||||||
|
"0.1136388693": 95,
|
||||||
|
"0.1298503792": 37,
|
||||||
|
"0.1460618891": 23,
|
||||||
|
"0.162273399": 7
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0003378,
|
||||||
|
"p25": 0.0004132,
|
||||||
|
"p50": 0.0005407,
|
||||||
|
"p75": 0.0007883,
|
||||||
|
"p90": 0.0028318,
|
||||||
|
"p95": 0.0093798,
|
||||||
|
"p99": 0.0454738,
|
||||||
|
"p99.9": 0.1078016,
|
||||||
|
"p99.99": 0.1442385
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0001582": 1,
|
||||||
|
"0.0163696899": 100653,
|
||||||
|
"0.0325811798": 1436,
|
||||||
|
"0.0487926697": 579,
|
||||||
|
"0.0650041596": 448,
|
||||||
|
"0.0812156495": 237,
|
||||||
|
"0.0974271394": 87,
|
||||||
|
"0.1136386293": 95,
|
||||||
|
"0.1298501192": 37,
|
||||||
|
"0.1460616091": 23,
|
||||||
|
"0.162273099": 7
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0003376,
|
||||||
|
"p25": 0.0004129,
|
||||||
|
"p50": 0.0005404,
|
||||||
|
"p75": 0.000788,
|
||||||
|
"p90": 0.0028315,
|
||||||
|
"p95": 0.0093795,
|
||||||
|
"p99": 0.0454736,
|
||||||
|
"p99.9": 0.1078014,
|
||||||
|
"p99.99": 0.1442384
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 8816.869812683235,
|
||||||
|
"stddev": 9654.48862151181,
|
||||||
|
"max": 102040.81632706436,
|
||||||
|
"min": 9.23774728294758,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 71.65839012260524,
|
||||||
|
"p25": 562.980644725513,
|
||||||
|
"p50": 5954.0918983284055,
|
||||||
|
"p75": 14172.200194270597,
|
||||||
|
"p90": 23184.081607967128,
|
||||||
|
"p95": 25967.809489617168,
|
||||||
|
"p99": 31011.019449626285,
|
||||||
|
"p99.9": 90090.0900897522,
|
||||||
|
"p99.99": 102040.81632706436
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.10573826875,
|
||||||
|
"fastest": 0.104618,
|
||||||
|
"slowest": 0.1067038
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.00002766875,
|
||||||
|
"fastest": 4.4e-6,
|
||||||
|
"slowest": 0.0000726
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.002310793509174426,
|
||||||
|
"fastest": 0.0001582,
|
||||||
|
"slowest": 0.162273099
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 103603
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.019466287,
|
||||||
|
"slowest": 0.418366599,
|
||||||
|
"fastest": 0.0001414,
|
||||||
|
"average": 0.020236639322692318,
|
||||||
|
"requestsPerSec": 12631.607300467853,
|
||||||
|
"totalData": 568395,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 37843.88800099845
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 12631.607300467853,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.141,
|
||||||
|
"mean": 20.237,
|
||||||
|
"p50": 13.367,
|
||||||
|
"p95": 62.893,
|
||||||
|
"p99": 101.938,
|
||||||
|
"max": 418.367
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0001414": 1,
|
||||||
|
"0.0419639199": 164473,
|
||||||
|
"0.0837864398": 21159,
|
||||||
|
"0.12560895970000002": 3121,
|
||||||
|
"0.16743147960000002": 413,
|
||||||
|
"0.2092539995": 109,
|
||||||
|
"0.25107651940000003": 74,
|
||||||
|
"0.2928990393": 56,
|
||||||
|
"0.3347215592": 57,
|
||||||
|
"0.37654407910000004": 1,
|
||||||
|
"0.418366599": 1
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.001623,
|
||||||
|
"p25": 0.0041708,
|
||||||
|
"p50": 0.0133667,
|
||||||
|
"p75": 0.0291072,
|
||||||
|
"p90": 0.0481165,
|
||||||
|
"p95": 0.0628933,
|
||||||
|
"p99": 0.1019375,
|
||||||
|
"p99.9": 0.2090671,
|
||||||
|
"p99.99": 0.315375999
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0001413": 1,
|
||||||
|
"0.0419638299": 164474,
|
||||||
|
"0.0837863598": 21158,
|
||||||
|
"0.1256088897": 3121,
|
||||||
|
"0.16743141960000002": 413,
|
||||||
|
"0.20925394950000004": 109,
|
||||||
|
"0.2510764794": 74,
|
||||||
|
"0.2928990093": 56,
|
||||||
|
"0.33472153920000003": 57,
|
||||||
|
"0.37654406910000005": 1,
|
||||||
|
"0.41836659900000006": 1
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0016227,
|
||||||
|
"p25": 0.0041704,
|
||||||
|
"p50": 0.0133662,
|
||||||
|
"p75": 0.0291072,
|
||||||
|
"p90": 0.0481162,
|
||||||
|
"p95": 0.0628933,
|
||||||
|
"p99": 0.1019374,
|
||||||
|
"p99.9": 0.2090671,
|
||||||
|
"p99.99": 0.315375899
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 13597.939292163925,
|
||||||
|
"stddev": 14012.504961474926,
|
||||||
|
"max": 236966.8246483339,
|
||||||
|
"min": 9.57544396545946,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 425.0616339369942,
|
||||||
|
"p25": 3834.2010735762588,
|
||||||
|
"p50": 10721.39684484533,
|
||||||
|
"p75": 19647.584381209752,
|
||||||
|
"p90": 30381.068796506184,
|
||||||
|
"p95": 38585.73140269472,
|
||||||
|
"p99": 52505.77563531388,
|
||||||
|
"p99.9": 177777.77777749032,
|
||||||
|
"p99.99": 236966.8246483339
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.1512655573359374,
|
||||||
|
"fastest": 0.0959749,
|
||||||
|
"slowest": 0.329047699
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 7.044140625000001e-6,
|
||||||
|
"fastest": 2.1e-6,
|
||||||
|
"slowest": 0.0000847
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.020236338316702285,
|
||||||
|
"fastest": 0.0001413,
|
||||||
|
"slowest": 0.418366599
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 189465
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 255
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.016419583,
|
||||||
|
"slowest": 0.1468448,
|
||||||
|
"fastest": 0.00015,
|
||||||
|
"average": 0.004074690958513652,
|
||||||
|
"requestsPerSec": 15653.33192115294,
|
||||||
|
"totalData": 704979,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 46947.20975951568
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 15653.33192115294,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.15,
|
||||||
|
"mean": 4.075,
|
||||||
|
"p50": 1.944,
|
||||||
|
"p95": 14.783,
|
||||||
|
"p99": 31.295,
|
||||||
|
"max": 146.845
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.00015": 1,
|
||||||
|
"0.01481948": 223296,
|
||||||
|
"0.029488959999999998": 8852,
|
||||||
|
"0.04415843999999999": 2005,
|
||||||
|
"0.05882791999999999": 541,
|
||||||
|
"0.07349739999999999": 156,
|
||||||
|
"0.08816687999999999": 100,
|
||||||
|
"0.10283635999999999": 16,
|
||||||
|
"0.11750583999999999": 12,
|
||||||
|
"0.13217532": 1,
|
||||||
|
"0.1468448": 13
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0005266,
|
||||||
|
"p25": 0.0009285,
|
||||||
|
"p50": 0.0019443,
|
||||||
|
"p75": 0.004467,
|
||||||
|
"p90": 0.0098493,
|
||||||
|
"p95": 0.0147829,
|
||||||
|
"p99": 0.0312955,
|
||||||
|
"p99.9": 0.0617255,
|
||||||
|
"p99.99": 0.1070583
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0001499": 1,
|
||||||
|
"0.014819379999999998": 223296,
|
||||||
|
"0.02948886": 8852,
|
||||||
|
"0.04415834": 2005,
|
||||||
|
"0.058827819999999996": 541,
|
||||||
|
"0.07349729999999999": 156,
|
||||||
|
"0.08816677999999999": 100,
|
||||||
|
"0.10283625999999998": 16,
|
||||||
|
"0.11750573999999998": 12,
|
||||||
|
"0.13217522": 1,
|
||||||
|
"0.1468447": 13
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0005264,
|
||||||
|
"p25": 0.0009283,
|
||||||
|
"p50": 0.001944,
|
||||||
|
"p75": 0.0044668,
|
||||||
|
"p90": 0.009849,
|
||||||
|
"p95": 0.0147826,
|
||||||
|
"p99": 0.0312954,
|
||||||
|
"p99.9": 0.0617254,
|
||||||
|
"p99.99": 0.1070583
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 15870.712525652865,
|
||||||
|
"stddev": 10795.299117141303,
|
||||||
|
"max": 76762.0376831455,
|
||||||
|
"min": 12.236681901335633,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 1616.6841807453031,
|
||||||
|
"p25": 7000.07000069973,
|
||||||
|
"p50": 15302.907552435288,
|
||||||
|
"p75": 22911.704146311884,
|
||||||
|
"p90": 30499.662252063812,
|
||||||
|
"p95": 34871.79487179422,
|
||||||
|
"p99": 44062.454641590186,
|
||||||
|
"p99.9": 64894.77655739068,
|
||||||
|
"p99.99": 76762.0376831455
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.06819543281250003,
|
||||||
|
"fastest": 0.043867,
|
||||||
|
"slowest": 0.0927161
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.000013640625000000001,
|
||||||
|
"fastest": 2.9e-6,
|
||||||
|
"slowest": 0.0000837
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.004074481777389089,
|
||||||
|
"fastest": 0.0001499,
|
||||||
|
"slowest": 0.1468447
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 234993
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 64
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.004018174,
|
||||||
|
"slowest": 0.1733402,
|
||||||
|
"fastest": 0.0009088,
|
||||||
|
"average": 0.0071451484561748865,
|
||||||
|
"requestsPerSec": 2235.8677262956508,
|
||||||
|
"totalData": 100593,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 6704.4040358678385
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 2235.8677262956508,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.909,
|
||||||
|
"mean": 7.145,
|
||||||
|
"p50": 2.415,
|
||||||
|
"p95": 30.459,
|
||||||
|
"p99": 65.017,
|
||||||
|
"max": 173.34
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0009088": 1,
|
||||||
|
"0.018151940000000002": 30515,
|
||||||
|
"0.03539508": 1809,
|
||||||
|
"0.05263822": 583,
|
||||||
|
"0.06988136": 346,
|
||||||
|
"0.08712450000000001": 183,
|
||||||
|
"0.10436764": 61,
|
||||||
|
"0.12161078": 26,
|
||||||
|
"0.13885392": 2,
|
||||||
|
"0.15609705999999998": 1,
|
||||||
|
"0.1733402": 4
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0014034,
|
||||||
|
"p25": 0.0017098,
|
||||||
|
"p50": 0.0024147,
|
||||||
|
"p75": 0.0070902,
|
||||||
|
"p90": 0.0167069,
|
||||||
|
"p95": 0.0304586,
|
||||||
|
"p99": 0.065017399,
|
||||||
|
"p99.9": 0.1041768,
|
||||||
|
"p99.99": 0.1636814
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0009085": 1,
|
||||||
|
"0.018151639999999997": 30515,
|
||||||
|
"0.035394779999999994": 1809,
|
||||||
|
"0.05263791999999999": 583,
|
||||||
|
"0.06988106": 346,
|
||||||
|
"0.08712419999999998": 183,
|
||||||
|
"0.10436733999999999": 61,
|
||||||
|
"0.12161047999999999": 26,
|
||||||
|
"0.13885361999999998": 2,
|
||||||
|
"0.15609675999999997": 1,
|
||||||
|
"0.17333989999999996": 4
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0014031,
|
||||||
|
"p25": 0.0017094,
|
||||||
|
"p50": 0.0024144,
|
||||||
|
"p75": 0.0070898,
|
||||||
|
"p90": 0.0167066,
|
||||||
|
"p95": 0.0304584,
|
||||||
|
"p99": 0.065017099,
|
||||||
|
"p99.9": 0.1041765,
|
||||||
|
"p99.99": 0.1636812
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 2726.7928945700846,
|
||||||
|
"stddev": 2523.963895476176,
|
||||||
|
"max": 30326.004549011384,
|
||||||
|
"min": 11.541386836124897,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 76.16146230007695,
|
||||||
|
"p25": 442.6280301577233,
|
||||||
|
"p50": 2197.4802226779657,
|
||||||
|
"p75": 4400.528063367616,
|
||||||
|
"p90": 6141.490492499327,
|
||||||
|
"p95": 7287.263944700669,
|
||||||
|
"p99": 8893.829905502533,
|
||||||
|
"p99.9": 17117.958294430544,
|
||||||
|
"p99.99": 30326.004549011384
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.003323362418895918,
|
||||||
|
"fastest": 0.0005222,
|
||||||
|
"slowest": 0.1078611
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 9.968837762070787e-6,
|
||||||
|
"fastest": 2.4e-6,
|
||||||
|
"slowest": 0.0086609
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.007144812531209925,
|
||||||
|
"fastest": 0.0009085,
|
||||||
|
"slowest": 0.1733399
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 33531
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.001672101,
|
||||||
|
"slowest": 0.0334476,
|
||||||
|
"fastest": 0.0003876,
|
||||||
|
"average": 0.0007189138965634228,
|
||||||
|
"requestsPerSec": 1375.313355810829,
|
||||||
|
"totalData": 61893,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 4125.740089724682
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 1375.313355810829,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.388,
|
||||||
|
"mean": 0.719,
|
||||||
|
"p50": 0.639,
|
||||||
|
"p95": 0.768,
|
||||||
|
"p99": 1.396,
|
||||||
|
"max": 33.448
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0003876": 1,
|
||||||
|
"0.0036936": 20527,
|
||||||
|
"0.0069996": 30,
|
||||||
|
"0.0103056": 18,
|
||||||
|
"0.0136116": 8,
|
||||||
|
"0.016917599999999998": 11,
|
||||||
|
"0.020223599999999998": 17,
|
||||||
|
"0.023529599999999998": 4,
|
||||||
|
"0.026835599999999998": 1,
|
||||||
|
"0.030141599999999998": 5,
|
||||||
|
"0.0334476": 9
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0005769,
|
||||||
|
"p25": 0.0006077,
|
||||||
|
"p50": 0.0006393,
|
||||||
|
"p75": 0.0006773,
|
||||||
|
"p90": 0.0007196,
|
||||||
|
"p95": 0.000768,
|
||||||
|
"p99": 0.0013964,
|
||||||
|
"p99.9": 0.0197775,
|
||||||
|
"p99.99": 0.0331157
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0003872": 1,
|
||||||
|
"0.0036931500000000005": 20527,
|
||||||
|
"0.006999100000000001": 30,
|
||||||
|
"0.010305050000000003": 18,
|
||||||
|
"0.013611000000000003": 8,
|
||||||
|
"0.016916950000000004": 11,
|
||||||
|
"0.020222900000000005": 17,
|
||||||
|
"0.023528850000000004": 4,
|
||||||
|
"0.026834800000000006": 1,
|
||||||
|
"0.030140750000000008": 5,
|
||||||
|
"0.0334467": 9
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0005765,
|
||||||
|
"p25": 0.0006073,
|
||||||
|
"p50": 0.0006389,
|
||||||
|
"p75": 0.0006768,
|
||||||
|
"p90": 0.000719,
|
||||||
|
"p95": 0.0007672,
|
||||||
|
"p99": 0.0013961,
|
||||||
|
"p99.9": 0.0197764,
|
||||||
|
"p99.99": 0.0331148
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 1442.112017183624,
|
||||||
|
"stddev": 341.72586892201025,
|
||||||
|
"max": 2276.636648790987,
|
||||||
|
"min": 11.322450820113986,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 1316.8157369609844,
|
||||||
|
"p25": 1455.165317174096,
|
||||||
|
"p50": 1519.3527557260143,
|
||||||
|
"p75": 1565.6476040373018,
|
||||||
|
"p90": 1614.6611229969456,
|
||||||
|
"p95": 1665.1229589234974,
|
||||||
|
"p99": 2058.6297760206025,
|
||||||
|
"p99.9": 2184.646305762854,
|
||||||
|
"p99.99": 2276.636648790987
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.085987001,
|
||||||
|
"fastest": 0.085987001,
|
||||||
|
"slowest": 0.085987001
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.0000567,
|
||||||
|
"fastest": 0.0000567,
|
||||||
|
"slowest": 0.0000567
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.0007184533032814724,
|
||||||
|
"fastest": 0.0003872,
|
||||||
|
"slowest": 0.0334467
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 20631
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.016245923,
|
||||||
|
"slowest": 0.1344025,
|
||||||
|
"fastest": 0.0002386,
|
||||||
|
"average": 0.0026058178862726437,
|
||||||
|
"requestsPerSec": 6090.337123469872,
|
||||||
|
"totalData": 274314,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 18267.814832456912
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 6090.337123469872,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.239,
|
||||||
|
"mean": 2.606,
|
||||||
|
"p50": 0.74,
|
||||||
|
"p95": 11.112,
|
||||||
|
"p99": 35.638,
|
||||||
|
"max": 134.403
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0002386": 1,
|
||||||
|
"0.01365499": 87639,
|
||||||
|
"0.02707138": 2257,
|
||||||
|
"0.04048777": 831,
|
||||||
|
"0.05390416": 291,
|
||||||
|
"0.06732055": 224,
|
||||||
|
"0.08073694000000001": 106,
|
||||||
|
"0.09415333000000001": 41,
|
||||||
|
"0.10756972000000001": 36,
|
||||||
|
"0.12098611000000001": 8,
|
||||||
|
"0.1344025": 4
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0004685,
|
||||||
|
"p25": 0.000564799,
|
||||||
|
"p50": 0.0007405,
|
||||||
|
"p75": 0.001199,
|
||||||
|
"p90": 0.0055644,
|
||||||
|
"p95": 0.0111118,
|
||||||
|
"p99": 0.035638,
|
||||||
|
"p99.9": 0.079941899,
|
||||||
|
"p99.99": 0.1125405
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0002382": 1,
|
||||||
|
"0.013654620000000001": 87639,
|
||||||
|
"0.027071040000000005": 2257,
|
||||||
|
"0.04048746000000001": 831,
|
||||||
|
"0.05390388000000001": 291,
|
||||||
|
"0.0673203": 224,
|
||||||
|
"0.08073672000000001": 106,
|
||||||
|
"0.09415314000000001": 41,
|
||||||
|
"0.10756956000000001": 36,
|
||||||
|
"0.12098598": 8,
|
||||||
|
"0.1344024": 4
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0004682,
|
||||||
|
"p25": 0.0005643,
|
||||||
|
"p50": 0.00074,
|
||||||
|
"p75": 0.0011984,
|
||||||
|
"p90": 0.0055637,
|
||||||
|
"p95": 0.0111114,
|
||||||
|
"p99": 0.0356376,
|
||||||
|
"p99.9": 0.079941499,
|
||||||
|
"p99.99": 0.1125401
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 7202.567464768243,
|
||||||
|
"stddev": 7170.45659781321,
|
||||||
|
"max": 95238.0952529792,
|
||||||
|
"min": 10.48230115860863,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 89.10433128134964,
|
||||||
|
"p25": 1628.27690727568,
|
||||||
|
"p50": 5737.593757498369,
|
||||||
|
"p75": 10941.475826973277,
|
||||||
|
"p90": 16276.041666666271,
|
||||||
|
"p95": 19174.22983510327,
|
||||||
|
"p99": 23237.613629521147,
|
||||||
|
"p99.9": 94339.62262990378,
|
||||||
|
"p99.99": 95238.0952529792
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.06899092577442661,
|
||||||
|
"fastest": 0.067862099,
|
||||||
|
"slowest": 0.071486299
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.000049345408910955866,
|
||||||
|
"fastest": 6.8e-6,
|
||||||
|
"slowest": 0.0001534
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.002605233972582489,
|
||||||
|
"fastest": 0.0002382,
|
||||||
|
"slowest": 0.1344024
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 91438
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.091610981,
|
||||||
|
"slowest": 0.4647646,
|
||||||
|
"fastest": 0.0002843,
|
||||||
|
"average": 0.025152170551815487,
|
||||||
|
"requestsPerSec": 10076.790356672924,
|
||||||
|
"totalData": 455598,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 30188.824809597045
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 10076.790356672924,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.284,
|
||||||
|
"mean": 25.152,
|
||||||
|
"p50": 19.212,
|
||||||
|
"p95": 67.038,
|
||||||
|
"p99": 101.9,
|
||||||
|
"max": 464.765
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0002843": 1,
|
||||||
|
"0.04673233": 129811,
|
||||||
|
"0.09318036": 19798,
|
||||||
|
"0.13962839": 1883,
|
||||||
|
"0.18607642": 290,
|
||||||
|
"0.23252445": 68,
|
||||||
|
"0.27897248": 7,
|
||||||
|
"0.32542051000000005": 4,
|
||||||
|
"0.37186854": 2,
|
||||||
|
"0.41831657": 0,
|
||||||
|
"0.4647646": 2
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0034031,
|
||||||
|
"p25": 0.0089379,
|
||||||
|
"p50": 0.0192123,
|
||||||
|
"p75": 0.0348282,
|
||||||
|
"p90": 0.0539113,
|
||||||
|
"p95": 0.0670376,
|
||||||
|
"p99": 0.1019004,
|
||||||
|
"p99.9": 0.1601791,
|
||||||
|
"p99.99": 0.2271948
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0002841": 1,
|
||||||
|
"0.046732130000000004": 129812,
|
||||||
|
"0.09318016": 19797,
|
||||||
|
"0.13962819": 1883,
|
||||||
|
"0.18607622000000001": 290,
|
||||||
|
"0.23252425000000002": 68,
|
||||||
|
"0.27897228": 7,
|
||||||
|
"0.32542031000000005": 4,
|
||||||
|
"0.37186834": 2,
|
||||||
|
"0.41831637": 0,
|
||||||
|
"0.4647644": 2
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0034026,
|
||||||
|
"p25": 0.0089373,
|
||||||
|
"p50": 0.0192114,
|
||||||
|
"p75": 0.0348281,
|
||||||
|
"p90": 0.0539112,
|
||||||
|
"p95": 0.0670375,
|
||||||
|
"p99": 0.1018999,
|
||||||
|
"p99.9": 0.160179,
|
||||||
|
"p99.99": 0.2271945
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 10605.623717862149,
|
||||||
|
"stddev": 9230.80300616933,
|
||||||
|
"max": 111524.16356901842,
|
||||||
|
"min": 13.229543332436503,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 700.1890510437828,
|
||||||
|
"p25": 3572.5222006737363,
|
||||||
|
"p50": 8740.584590863515,
|
||||||
|
"p75": 15748.425157488562,
|
||||||
|
"p90": 22083.06218462441,
|
||||||
|
"p95": 26421.169962431315,
|
||||||
|
"p99": 36228.81099223658,
|
||||||
|
"p99.9": 94490.19983400247,
|
||||||
|
"p99.99": 111524.16356901842
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.10547651010452719,
|
||||||
|
"fastest": 0.072120499,
|
||||||
|
"slowest": 0.216904999
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 6.99253157388741e-6,
|
||||||
|
"fastest": 2.6e-6,
|
||||||
|
"slowest": 0.0000909
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.025151754616056263,
|
||||||
|
"fastest": 0.0002841,
|
||||||
|
"slowest": 0.4647644
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 151866
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 209
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.010748297,
|
||||||
|
"slowest": 0.1569616,
|
||||||
|
"fastest": 0.0002245,
|
||||||
|
"average": 0.007512949975279854,
|
||||||
|
"requestsPerSec": 8471.729555642152,
|
||||||
|
"totalData": 381309,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 25402.39783223913
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 8471.729555642152,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.225,
|
||||||
|
"mean": 7.513,
|
||||||
|
"p50": 2.461,
|
||||||
|
"p95": 30.522,
|
||||||
|
"p99": 59.582,
|
||||||
|
"max": 156.962
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0002245": 1,
|
||||||
|
"0.01589821": 110166,
|
||||||
|
"0.03157192": 10984,
|
||||||
|
"0.047245630000000004": 3570,
|
||||||
|
"0.06291934": 1396,
|
||||||
|
"0.07859305000000001": 648,
|
||||||
|
"0.09426676": 225,
|
||||||
|
"0.10994047": 54,
|
||||||
|
"0.12561418": 19,
|
||||||
|
"0.14128789": 29,
|
||||||
|
"0.1569616": 11
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0006895,
|
||||||
|
"p25": 0.0011646,
|
||||||
|
"p50": 0.0024605,
|
||||||
|
"p75": 0.00967,
|
||||||
|
"p90": 0.0193773,
|
||||||
|
"p95": 0.0305215,
|
||||||
|
"p99": 0.0595816,
|
||||||
|
"p99.9": 0.0907694,
|
||||||
|
"p99.99": 0.1363714
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0002243": 2,
|
||||||
|
"0.015897989999999997": 110165,
|
||||||
|
"0.03157167999999999": 10984,
|
||||||
|
"0.04724536999999999": 3570,
|
||||||
|
"0.06291905999999999": 1396,
|
||||||
|
"0.07859274999999998": 648,
|
||||||
|
"0.09426643999999998": 225,
|
||||||
|
"0.10994012999999998": 54,
|
||||||
|
"0.12561382": 19,
|
||||||
|
"0.14128750999999998": 29,
|
||||||
|
"0.15696119999999997": 11
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0006892,
|
||||||
|
"p25": 0.0011644,
|
||||||
|
"p50": 0.0024601,
|
||||||
|
"p75": 0.0096697,
|
||||||
|
"p90": 0.0193772,
|
||||||
|
"p95": 0.0305214,
|
||||||
|
"p99": 0.059581,
|
||||||
|
"p99.9": 0.090769,
|
||||||
|
"p99.99": 0.1363713
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 9967.99791405974,
|
||||||
|
"stddev": 13712.545585557658,
|
||||||
|
"max": 225806.45161368826,
|
||||||
|
"min": 14.836949345171242,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 99.03931860948775,
|
||||||
|
"p25": 1900.6842463286118,
|
||||||
|
"p50": 6768.69852968809,
|
||||||
|
"p75": 14186.26901124974,
|
||||||
|
"p90": 23539.826569824312,
|
||||||
|
"p95": 30052.75447548217,
|
||||||
|
"p99": 40046.05296090477,
|
||||||
|
"p99.9": 198019.80198021766,
|
||||||
|
"p99.99": 225806.45161368826
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.05095217967317911,
|
||||||
|
"fastest": 0.0345505,
|
||||||
|
"slowest": 0.0871411
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.00001849738794520989,
|
||||||
|
"fastest": 2.8e-6,
|
||||||
|
"slowest": 0.0001439
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.007512631878932849,
|
||||||
|
"fastest": 0.0002243,
|
||||||
|
"slowest": 0.1569612
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 127103
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 64
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 300.003628013,
|
||||||
|
"slowest": 0.204141902,
|
||||||
|
"fastest": 0.0001267,
|
||||||
|
"average": 0.0024508333589749417,
|
||||||
|
"requestsPerSec": 13030.97907812834,
|
||||||
|
"totalData": 11727927,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 39092.61723825485
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 13030.97907812834,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.127,
|
||||||
|
"mean": 2.451,
|
||||||
|
"p50": 0.814,
|
||||||
|
"p95": 9.595,
|
||||||
|
"p99": 35.443,
|
||||||
|
"max": 204.142
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0001267": 1,
|
||||||
|
"0.0205282202": 3832478,
|
||||||
|
"0.0409297404": 44599,
|
||||||
|
"0.0613312606": 17472,
|
||||||
|
"0.08173278079999999": 8451,
|
||||||
|
"0.10213430099999998": 3901,
|
||||||
|
"0.12253582119999999": 1613,
|
||||||
|
"0.1429373414": 628,
|
||||||
|
"0.1633388616": 108,
|
||||||
|
"0.1837403818": 52,
|
||||||
|
"0.204141902": 6
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0003553,
|
||||||
|
"p25": 0.0004996,
|
||||||
|
"p50": 0.000814401,
|
||||||
|
"p75": 0.0014808,
|
||||||
|
"p90": 0.0039954,
|
||||||
|
"p95": 0.009594901,
|
||||||
|
"p99": 0.035443086,
|
||||||
|
"p99.9": 0.092844401,
|
||||||
|
"p99.99": 0.131851711
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0001265": 1,
|
||||||
|
"0.020528030200000002": 3832479,
|
||||||
|
"0.0409295604": 44599,
|
||||||
|
"0.0613310906": 17472,
|
||||||
|
"0.0817326208": 8450,
|
||||||
|
"0.102134151": 3901,
|
||||||
|
"0.1225356812": 1613,
|
||||||
|
"0.1429372114": 628,
|
||||||
|
"0.1633387416": 108,
|
||||||
|
"0.1837402718": 52,
|
||||||
|
"0.204141802": 6
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0003551,
|
||||||
|
"p25": 0.0004994,
|
||||||
|
"p50": 0.0008142,
|
||||||
|
"p75": 0.001480599,
|
||||||
|
"p90": 0.003995,
|
||||||
|
"p95": 0.009594501,
|
||||||
|
"p99": 0.035442386,
|
||||||
|
"p99.9": 0.092844301,
|
||||||
|
"p99.99": 0.131851411
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 14634.436809419303,
|
||||||
|
"stddev": 15168.46742844932,
|
||||||
|
"max": 294117.6473096741,
|
||||||
|
"min": 9.362568264827344,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 98.58917898976765,
|
||||||
|
"p25": 2112.314582785661,
|
||||||
|
"p50": 11046.39485840811,
|
||||||
|
"p75": 23341.580691840434,
|
||||||
|
"p90": 34526.24339761367,
|
||||||
|
"p95": 40115.57930451167,
|
||||||
|
"p99": 47730.69837527305,
|
||||||
|
"p99.9": 143884.89209655894,
|
||||||
|
"p99.99": 254237.2882263559
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.0650016463125,
|
||||||
|
"fastest": 0.048728695,
|
||||||
|
"slowest": 0.068113693
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.000017812499999999993,
|
||||||
|
"fastest": 5e-6,
|
||||||
|
"slowest": 0.0000669
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.0024505522780103343,
|
||||||
|
"fastest": 0.0001265,
|
||||||
|
"slowest": 0.204141802
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 3909309
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 32
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.002150269,
|
||||||
|
"slowest": 0.059823898,
|
||||||
|
"fastest": 0.0000588,
|
||||||
|
"average": 0.003753154335351309,
|
||||||
|
"requestsPerSec": 17026.55922116867,
|
||||||
|
"totalData": 0,
|
||||||
|
"sizePerRequest": 0,
|
||||||
|
"sizePerSec": 0.0
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 17026.55922116867,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.059,
|
||||||
|
"mean": 3.753,
|
||||||
|
"p50": 2.855,
|
||||||
|
"p95": 10.46,
|
||||||
|
"p99": 15.523,
|
||||||
|
"max": 59.824
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0000588": 1,
|
||||||
|
"0.0060353098": 206113,
|
||||||
|
"0.0120118196": 41464,
|
||||||
|
"0.0179883294": 6588,
|
||||||
|
"0.0239648392": 1003,
|
||||||
|
"0.029941349000000003": 160,
|
||||||
|
"0.035917858799999994": 17,
|
||||||
|
"0.041894368599999995": 17,
|
||||||
|
"0.0478708784": 9,
|
||||||
|
"0.0538473882": 1,
|
||||||
|
"0.059823898": 1
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0004776,
|
||||||
|
"p25": 0.0012618,
|
||||||
|
"p50": 0.0028546,
|
||||||
|
"p75": 0.0051908,
|
||||||
|
"p90": 0.0081868,
|
||||||
|
"p95": 0.0104601,
|
||||||
|
"p99": 0.0155229,
|
||||||
|
"p99.9": 0.023271099,
|
||||||
|
"p99.99": 0.0379197
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"NaN": 0
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": null,
|
||||||
|
"p25": null,
|
||||||
|
"p50": null,
|
||||||
|
"p75": null,
|
||||||
|
"p90": null,
|
||||||
|
"p95": null,
|
||||||
|
"p99": null,
|
||||||
|
"p99.9": null,
|
||||||
|
"p99.99": null
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 16989.314383689936,
|
||||||
|
"stddev": 5376.689770903059,
|
||||||
|
"max": 30322.50291176298,
|
||||||
|
"min": 74.45073966809896,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 9528.872483624458,
|
||||||
|
"p25": 13226.556445362341,
|
||||||
|
"p50": 17339.41059512616,
|
||||||
|
"p75": 20818.11384085071,
|
||||||
|
"p90": 23923.92392392406,
|
||||||
|
"p95": 25248.73004899496,
|
||||||
|
"p99": 27751.523317314095,
|
||||||
|
"p99.9": 30022.82034574568,
|
||||||
|
"p99.99": 30322.50291176298
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.0003298953124999999,
|
||||||
|
"fastest": 0.0001012,
|
||||||
|
"slowest": 0.0007817
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.000013368750000000005,
|
||||||
|
"fastest": 2.1e-6,
|
||||||
|
"slowest": 0.0001601
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": null,
|
||||||
|
"fastest": null,
|
||||||
|
"slowest": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"308": 255374
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 61
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.002064744,
|
||||||
|
"slowest": 0.0482662,
|
||||||
|
"fastest": 0.0002228,
|
||||||
|
"average": 0.0004213640438123845,
|
||||||
|
"requestsPerSec": 2350.676430329636,
|
||||||
|
"totalData": 105792,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 7051.829318515038
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 2350.676430329636,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.223,
|
||||||
|
"mean": 0.421,
|
||||||
|
"p50": 0.406,
|
||||||
|
"p95": 0.512,
|
||||||
|
"p99": 0.79,
|
||||||
|
"max": 48.266
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0002228": 1,
|
||||||
|
"0.005027139999999999": 35256,
|
||||||
|
"0.00983148": 4,
|
||||||
|
"0.014635819999999999": 2,
|
||||||
|
"0.019440159999999998": 0,
|
||||||
|
"0.0242445": 0,
|
||||||
|
"0.029048839999999996": 0,
|
||||||
|
"0.033853180000000004": 0,
|
||||||
|
"0.03865752": 0,
|
||||||
|
"0.04346186": 0,
|
||||||
|
"0.0482662": 1
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0003478,
|
||||||
|
"p25": 0.0003683,
|
||||||
|
"p50": 0.0004057,
|
||||||
|
"p75": 0.0004461,
|
||||||
|
"p90": 0.0004799,
|
||||||
|
"p95": 0.0005116,
|
||||||
|
"p99": 0.00079,
|
||||||
|
"p99.9": 0.0017707,
|
||||||
|
"p99.99": 0.0072501
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0002226": 1,
|
||||||
|
"0.005026879999999999": 35256,
|
||||||
|
"0.009831159999999999": 4,
|
||||||
|
"0.014635439999999998": 2,
|
||||||
|
"0.019439719999999997": 0,
|
||||||
|
"0.024243999999999998": 0,
|
||||||
|
"0.029048279999999996": 0,
|
||||||
|
"0.03385256": 0,
|
||||||
|
"0.03865684": 0,
|
||||||
|
"0.04346112": 0,
|
||||||
|
"0.0482654": 1
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0003476,
|
||||||
|
"p25": 0.000368,
|
||||||
|
"p50": 0.000405401,
|
||||||
|
"p75": 0.0004458,
|
||||||
|
"p90": 0.0004796,
|
||||||
|
"p95": 0.0005113,
|
||||||
|
"p99": 0.0007898,
|
||||||
|
"p99.9": 0.0017704,
|
||||||
|
"p99.99": 0.0072498
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 2355.480608037043,
|
||||||
|
"stddev": 305.6269134036098,
|
||||||
|
"max": 2831.543393402497,
|
||||||
|
"min": 20.57096778175026,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 2072.5388601034974,
|
||||||
|
"p25": 2184.2463829920093,
|
||||||
|
"p50": 2404.625244382889,
|
||||||
|
"p75": 2567.3149992811614,
|
||||||
|
"p90": 2671.983228166774,
|
||||||
|
"p95": 2712.7499246459897,
|
||||||
|
"p99": 2765.600032777776,
|
||||||
|
"p99.9": 2813.7875590392805,
|
||||||
|
"p99.99": 2831.543393402497
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.0469521,
|
||||||
|
"fastest": 0.0469521,
|
||||||
|
"slowest": 0.0469521
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.0000333,
|
||||||
|
"fastest": 0.0000333,
|
||||||
|
"slowest": 0.0000333
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.00042111634077245856,
|
||||||
|
"fastest": 0.0002226,
|
||||||
|
"slowest": 0.0482654
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 35264
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.004796639,
|
||||||
|
"slowest": 0.0601028,
|
||||||
|
"fastest": 0.0001558,
|
||||||
|
"average": 0.0020574272899509124,
|
||||||
|
"requestsPerSec": 7758.519012341544,
|
||||||
|
"totalData": 349197,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 23272.358059980503
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 7758.519012341544,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.156,
|
||||||
|
"mean": 2.057,
|
||||||
|
"p50": 1.57,
|
||||||
|
"p95": 4.809,
|
||||||
|
"p99": 11.228,
|
||||||
|
"max": 60.103
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0001558": 1,
|
||||||
|
"0.006150500000000001": 112848,
|
||||||
|
"0.0121452": 2589,
|
||||||
|
"0.018139900000000004": 600,
|
||||||
|
"0.024134600000000003": 198,
|
||||||
|
"0.0301293": 67,
|
||||||
|
"0.036124": 41,
|
||||||
|
"0.0421187": 19,
|
||||||
|
"0.0481134": 4,
|
||||||
|
"0.0541081": 6,
|
||||||
|
"0.0601028": 26
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0007209,
|
||||||
|
"p25": 0.0010639,
|
||||||
|
"p50": 0.0015703,
|
||||||
|
"p75": 0.0022893,
|
||||||
|
"p90": 0.0034932,
|
||||||
|
"p95": 0.0048093,
|
||||||
|
"p99": 0.0112279,
|
||||||
|
"p99.9": 0.0279622,
|
||||||
|
"p99.99": 0.058274
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0001556": 1,
|
||||||
|
"0.0061503": 112848,
|
||||||
|
"0.012145000000000001": 2589,
|
||||||
|
"0.0181397": 600,
|
||||||
|
"0.0241344": 198,
|
||||||
|
"0.0301291": 68,
|
||||||
|
"0.036123800000000005": 40,
|
||||||
|
"0.0421185": 19,
|
||||||
|
"0.0481132": 4,
|
||||||
|
"0.0541079": 6,
|
||||||
|
"0.0601026": 26
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0007205,
|
||||||
|
"p25": 0.0010637,
|
||||||
|
"p50": 0.00157,
|
||||||
|
"p75": 0.0022891,
|
||||||
|
"p90": 0.0034929,
|
||||||
|
"p95": 0.004809,
|
||||||
|
"p99": 0.0112276,
|
||||||
|
"p99.9": 0.0279619,
|
||||||
|
"p99.99": 0.0582734
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 8219.237452143676,
|
||||||
|
"stddev": 15997.850144047194,
|
||||||
|
"max": 624999.999635083,
|
||||||
|
"min": 16.93494441104497,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 3525.5603122639604,
|
||||||
|
"p25": 6021.67804094736,
|
||||||
|
"p50": 8276.48809921183,
|
||||||
|
"p75": 10083.084617246475,
|
||||||
|
"p90": 11154.99412101651,
|
||||||
|
"p95": 11714.174150721796,
|
||||||
|
"p99": 13102.489472998985,
|
||||||
|
"p99.9": 23999.999999885404,
|
||||||
|
"p99.99": 624999.999635083
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.054984587499999994,
|
||||||
|
"fastest": 0.0524595,
|
||||||
|
"slowest": 0.0572887
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.000028637499999999998,
|
||||||
|
"fastest": 5.5e-6,
|
||||||
|
"slowest": 0.0000644
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.0020571085423671497,
|
||||||
|
"fastest": 0.0001556,
|
||||||
|
"slowest": 0.0601026
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 116399
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.0046378,
|
||||||
|
"slowest": 0.2181895,
|
||||||
|
"fastest": 0.0004581,
|
||||||
|
"average": 0.05724174818779055,
|
||||||
|
"requestsPerSec": 4473.48352520712,
|
||||||
|
"totalData": 200601,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 13369.26640108567
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 4473.48352520712,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.458,
|
||||||
|
"mean": 57.242,
|
||||||
|
"p50": 52.612,
|
||||||
|
"p95": 108.747,
|
||||||
|
"p99": 147.025,
|
||||||
|
"max": 218.19
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0004581": 1,
|
||||||
|
"0.022231240000000003": 3857,
|
||||||
|
"0.04400438000000001": 19941,
|
||||||
|
"0.06577752000000002": 22166,
|
||||||
|
"0.08755066000000002": 12520,
|
||||||
|
"0.10932380000000001": 5131,
|
||||||
|
"0.13109694000000002": 1990,
|
||||||
|
"0.15287008000000002": 715,
|
||||||
|
"0.17464322000000002": 325,
|
||||||
|
"0.19641636": 197,
|
||||||
|
"0.2181895": 24
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.026986199,
|
||||||
|
"p25": 0.038062098,
|
||||||
|
"p50": 0.0526119,
|
||||||
|
"p75": 0.0716704,
|
||||||
|
"p90": 0.092374001,
|
||||||
|
"p95": 0.108747,
|
||||||
|
"p99": 0.147025301,
|
||||||
|
"p99.9": 0.192869101,
|
||||||
|
"p99.99": 0.211826801
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0004579": 1,
|
||||||
|
"0.02223103": 3858,
|
||||||
|
"0.044004159999999994": 19942,
|
||||||
|
"0.06577728999999999": 22164,
|
||||||
|
"0.08755041999999999": 12520,
|
||||||
|
"0.10932354999999999": 5131,
|
||||||
|
"0.13109668": 1990,
|
||||||
|
"0.15286981": 715,
|
||||||
|
"0.17464294": 325,
|
||||||
|
"0.19641607": 197,
|
||||||
|
"0.2181892": 24
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.026985899,
|
||||||
|
"p25": 0.038061798,
|
||||||
|
"p50": 0.0526117,
|
||||||
|
"p75": 0.0716702,
|
||||||
|
"p90": 0.092373801,
|
||||||
|
"p95": 0.1087468,
|
||||||
|
"p99": 0.147025101,
|
||||||
|
"p99.9": 0.192868801,
|
||||||
|
"p99.99": 0.211826601
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 4502.987802008221,
|
||||||
|
"stddev": 2838.169442761876,
|
||||||
|
"max": 27472.52747257541,
|
||||||
|
"min": 11.687827478316159,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 1059.415555751777,
|
||||||
|
"p25": 2416.7237281992957,
|
||||||
|
"p50": 4248.945730340718,
|
||||||
|
"p75": 6224.462136195428,
|
||||||
|
"p90": 8056.292066082553,
|
||||||
|
"p95": 9484.02849244303,
|
||||||
|
"p99": 12308.56027073252,
|
||||||
|
"p99.9": 15449.593194153273,
|
||||||
|
"p99.99": 27472.52747257541
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.08048447843750003,
|
||||||
|
"fastest": 0.0477648,
|
||||||
|
"slowest": 0.128978001
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 6.845703125000003e-6,
|
||||||
|
"fastest": 1.9e-6,
|
||||||
|
"slowest": 0.0001189
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.057241450203732384,
|
||||||
|
"fastest": 0.0004579,
|
||||||
|
"slowest": 0.2181892
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 66867
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 256
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.016737208,
|
||||||
|
"slowest": 0.166731802,
|
||||||
|
"fastest": 0.0002387,
|
||||||
|
"average": 0.009739633160423882,
|
||||||
|
"requestsPerSec": 6560.679502835979,
|
||||||
|
"totalData": 295374,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 19669.65232917859
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 6560.679502835979,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.239,
|
||||||
|
"mean": 9.74,
|
||||||
|
"p50": 7.366,
|
||||||
|
"p95": 25.614,
|
||||||
|
"p99": 39.844,
|
||||||
|
"max": 166.732
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0002387": 1,
|
||||||
|
"0.0168880102": 84981,
|
||||||
|
"0.0335373204": 11313,
|
||||||
|
"0.0501866306": 1763,
|
||||||
|
"0.0668359408": 285,
|
||||||
|
"0.083485251": 48,
|
||||||
|
"0.10013456119999999": 11,
|
||||||
|
"0.11678387139999999": 18,
|
||||||
|
"0.1334331816": 0,
|
||||||
|
"0.1500824918": 30,
|
||||||
|
"0.166731802": 8
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.002615,
|
||||||
|
"p25": 0.004519,
|
||||||
|
"p50": 0.0073656,
|
||||||
|
"p75": 0.012175101,
|
||||||
|
"p90": 0.019472301,
|
||||||
|
"p95": 0.025613601,
|
||||||
|
"p99": 0.0398441,
|
||||||
|
"p99.9": 0.0704864,
|
||||||
|
"p99.99": 0.148703101
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0002386": 1,
|
||||||
|
"0.0168879202": 84981,
|
||||||
|
"0.0335372404": 11313,
|
||||||
|
"0.050186560600000006": 1763,
|
||||||
|
"0.06683588080000001": 285,
|
||||||
|
"0.08348520100000001": 48,
|
||||||
|
"0.10013452120000002": 11,
|
||||||
|
"0.11678384140000002": 18,
|
||||||
|
"0.13343316160000002": 0,
|
||||||
|
"0.15008248180000003": 30,
|
||||||
|
"0.166731802": 8
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0026147,
|
||||||
|
"p25": 0.0045188,
|
||||||
|
"p50": 0.0073654,
|
||||||
|
"p75": 0.012174901,
|
||||||
|
"p90": 0.0194718,
|
||||||
|
"p95": 0.025613501,
|
||||||
|
"p99": 0.0398437,
|
||||||
|
"p99.9": 0.0704862,
|
||||||
|
"p99.99": 0.148702901
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 6556.6940634554,
|
||||||
|
"stddev": 3500.6037679130523,
|
||||||
|
"max": 15039.886184643516,
|
||||||
|
"min": 12.601282651797792,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 1600.5601960686654,
|
||||||
|
"p25": 3829.294099863541,
|
||||||
|
"p50": 6613.557793476607,
|
||||||
|
"p75": 9481.541254791226,
|
||||||
|
"p90": 11020.38771727662,
|
||||||
|
"p95": 11861.919218320745,
|
||||||
|
"p99": 13184.246013603382,
|
||||||
|
"p99.9": 14657.947067384583,
|
||||||
|
"p99.99": 15039.886184643516
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.086538041625,
|
||||||
|
"fastest": 0.072438501,
|
||||||
|
"slowest": 0.112627201
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.000011654687500000001,
|
||||||
|
"fastest": 2.3e-6,
|
||||||
|
"slowest": 0.0000813
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.009739357007140051,
|
||||||
|
"fastest": 0.0002386,
|
||||||
|
"slowest": 0.166731802
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 98458
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 62
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.001670186,
|
||||||
|
"slowest": 0.0673689,
|
||||||
|
"fastest": 0.0011287,
|
||||||
|
"average": 0.008770213088567843,
|
||||||
|
"requestsPerSec": 1823.1969947936036,
|
||||||
|
"totalData": 82005,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 5466.3913406474885
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 1823.1969947936036,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 1.129,
|
||||||
|
"mean": 8.77,
|
||||||
|
"p50": 7.934,
|
||||||
|
"p95": 16.433,
|
||||||
|
"p99": 21.387,
|
||||||
|
"max": 67.369
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0011287": 1,
|
||||||
|
"0.007752719999999999": 13146,
|
||||||
|
"0.014376739999999999": 11573,
|
||||||
|
"0.021000759999999997": 2294,
|
||||||
|
"0.027624779999999998": 264,
|
||||||
|
"0.0342488": 36,
|
||||||
|
"0.04087282": 5,
|
||||||
|
"0.04749684": 0,
|
||||||
|
"0.05412086": 0,
|
||||||
|
"0.06074488": 4,
|
||||||
|
"0.0673689": 12
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0043039,
|
||||||
|
"p25": 0.0057605,
|
||||||
|
"p50": 0.007934,
|
||||||
|
"p75": 0.0109823,
|
||||||
|
"p90": 0.0142346,
|
||||||
|
"p95": 0.0164328,
|
||||||
|
"p99": 0.0213872,
|
||||||
|
"p99.9": 0.0316213,
|
||||||
|
"p99.99": 0.0657409
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0011284": 1,
|
||||||
|
"0.0077524099999999995": 13146,
|
||||||
|
"0.014376419999999999": 11573,
|
||||||
|
"0.02100043": 2294,
|
||||||
|
"0.02762444": 264,
|
||||||
|
"0.03424845": 36,
|
||||||
|
"0.04087246": 5,
|
||||||
|
"0.04749647": 0,
|
||||||
|
"0.05412048": 0,
|
||||||
|
"0.06074449": 4,
|
||||||
|
"0.0673685": 12
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0043036,
|
||||||
|
"p25": 0.0057602,
|
||||||
|
"p50": 0.0079337,
|
||||||
|
"p75": 0.010982,
|
||||||
|
"p90": 0.0142343,
|
||||||
|
"p95": 0.0164326,
|
||||||
|
"p99": 0.0213869,
|
||||||
|
"p99.9": 0.031621,
|
||||||
|
"p99.99": 0.0657406
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 1865.6878466656424,
|
||||||
|
"stddev": 806.3740144583545,
|
||||||
|
"max": 11855.364552481875,
|
||||||
|
"min": 16.184712891285667,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 861.5676222887545,
|
||||||
|
"p25": 1401.4294580472636,
|
||||||
|
"p50": 1864.589375984081,
|
||||||
|
"p75": 2333.1541200459365,
|
||||||
|
"p90": 2783.662991200708,
|
||||||
|
"p95": 3027.329477837645,
|
||||||
|
"p99": 3653.885679051755,
|
||||||
|
"p99.9": 10213.702074165707,
|
||||||
|
"p99.99": 11855.364552481875
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.0041902446019754635,
|
||||||
|
"fastest": 0.0004388,
|
||||||
|
"slowest": 0.0623406
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 9.343519297603825e-6,
|
||||||
|
"fastest": 2.9e-6,
|
||||||
|
"slowest": 0.0060626
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.008769826130455488,
|
||||||
|
"fastest": 0.0011284,
|
||||||
|
"slowest": 0.0673685
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 27335
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.00223488,
|
||||||
|
"slowest": 0.027620101,
|
||||||
|
"fastest": 0.0003776,
|
||||||
|
"average": 0.000624054979473615,
|
||||||
|
"requestsPerSec": 1587.96340615619,
|
||||||
|
"totalData": 71469,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 4763.89021846857
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 1587.96340615619,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.378,
|
||||||
|
"mean": 0.624,
|
||||||
|
"p50": 0.588,
|
||||||
|
"p95": 0.749,
|
||||||
|
"p99": 1.414,
|
||||||
|
"max": 27.62
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0003776": 1,
|
||||||
|
"0.0031018501": 23752,
|
||||||
|
"0.0058261002": 39,
|
||||||
|
"0.0085503503": 8,
|
||||||
|
"0.011274600400000001": 6,
|
||||||
|
"0.013998850500000002": 7,
|
||||||
|
"0.0167231006": 3,
|
||||||
|
"0.0194473507": 4,
|
||||||
|
"0.0221716008": 2,
|
||||||
|
"0.0248958509": 0,
|
||||||
|
"0.027620101": 1
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0004916,
|
||||||
|
"p25": 0.000546801,
|
||||||
|
"p50": 0.0005879,
|
||||||
|
"p75": 0.0006248,
|
||||||
|
"p90": 0.0006784,
|
||||||
|
"p95": 0.0007492,
|
||||||
|
"p99": 0.0014144,
|
||||||
|
"p99.9": 0.0080586,
|
||||||
|
"p99.99": 0.020332001
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0003773": 1,
|
||||||
|
"0.0031015101": 23752,
|
||||||
|
"0.0058257202": 39,
|
||||||
|
"0.008549930300000001": 8,
|
||||||
|
"0.0112741404": 6,
|
||||||
|
"0.0139983505": 7,
|
||||||
|
"0.016722560600000002": 3,
|
||||||
|
"0.0194467707": 4,
|
||||||
|
"0.0221709808": 2,
|
||||||
|
"0.0248951909": 0,
|
||||||
|
"0.027619401": 1
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0004912,
|
||||||
|
"p25": 0.0005464,
|
||||||
|
"p50": 0.0005876,
|
||||||
|
"p75": 0.0006244,
|
||||||
|
"p90": 0.0006778,
|
||||||
|
"p95": 0.0007487,
|
||||||
|
"p99": 0.0014141,
|
||||||
|
"p99.9": 0.0080579,
|
||||||
|
"p99.99": 0.020331301
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 1599.664298342526,
|
||||||
|
"stddev": 304.009822680561,
|
||||||
|
"max": 2298.6384130292395,
|
||||||
|
"min": 22.371764542278953,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 1407.332200765958,
|
||||||
|
"p25": 1555.193828990857,
|
||||||
|
"p50": 1635.2728350521156,
|
||||||
|
"p75": 1724.647679116921,
|
||||||
|
"p90": 1864.2417714440055,
|
||||||
|
"p95": 1952.522263121158,
|
||||||
|
"p99": 2060.3893950522333,
|
||||||
|
"p99.9": 2196.7293141324017,
|
||||||
|
"p99.99": 2298.6384130292395
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.042964001,
|
||||||
|
"fastest": 0.042964001,
|
||||||
|
"slowest": 0.042964001
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.0000416,
|
||||||
|
"fastest": 0.0000416,
|
||||||
|
"slowest": 0.0000416
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.0006236448253788323,
|
||||||
|
"fastest": 0.0003773,
|
||||||
|
"slowest": 0.027619401
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 23823
|
||||||
|
},
|
||||||
|
"errorDistribution": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.001381334,
|
||||||
|
"slowest": 0.068229001,
|
||||||
|
"fastest": 0.000343,
|
||||||
|
"average": 0.004648210778032954,
|
||||||
|
"requestsPerSec": 3426.4844587011153,
|
||||||
|
"totalData": 154158,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 10276.253670760798
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 3426.4844587011153,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.343,
|
||||||
|
"mean": 4.648,
|
||||||
|
"p50": 2.706,
|
||||||
|
"p95": 15.93,
|
||||||
|
"p99": 28.589,
|
||||||
|
"max": 68.229
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.000343": 1,
|
||||||
|
"0.0071316001": 43052,
|
||||||
|
"0.0139202002": 5052,
|
||||||
|
"0.0207088003": 1967,
|
||||||
|
"0.0274974004": 727,
|
||||||
|
"0.034286000500000004": 326,
|
||||||
|
"0.041074600600000004": 170,
|
||||||
|
"0.047863200700000004": 39,
|
||||||
|
"0.054651800800000004": 31,
|
||||||
|
"0.061440400900000004": 10,
|
||||||
|
"0.068229001": 11
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0012123,
|
||||||
|
"p25": 0.0018349,
|
||||||
|
"p50": 0.0027058,
|
||||||
|
"p75": 0.0047379,
|
||||||
|
"p90": 0.0109985,
|
||||||
|
"p95": 0.0159298,
|
||||||
|
"p99": 0.0285888,
|
||||||
|
"p99.9": 0.048228701,
|
||||||
|
"p99.99": 0.066864201
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0003426": 1,
|
||||||
|
"0.0071311801": 43054,
|
||||||
|
"0.013919760199999999": 5051,
|
||||||
|
"0.020708340299999996": 1966,
|
||||||
|
"0.027496920399999996": 727,
|
||||||
|
"0.034285500499999996": 326,
|
||||||
|
"0.04107408059999999": 170,
|
||||||
|
"0.0478626607": 39,
|
||||||
|
"0.054651240799999994": 31,
|
||||||
|
"0.06143982089999999": 10,
|
||||||
|
"0.068228401": 11
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0012119,
|
||||||
|
"p25": 0.0018345,
|
||||||
|
"p50": 0.0027053,
|
||||||
|
"p75": 0.0047372,
|
||||||
|
"p90": 0.0109979,
|
||||||
|
"p95": 0.0159293,
|
||||||
|
"p99": 0.0285884,
|
||||||
|
"p99.9": 0.048228201,
|
||||||
|
"p99.99": 0.066863801
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 3546.8989902223993,
|
||||||
|
"stddev": 2152.2391804070685,
|
||||||
|
"max": 10022.550739138387,
|
||||||
|
"min": 17.735496354468726,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 402.51977378388324,
|
||||||
|
"p25": 1761.7675710406404,
|
||||||
|
"p50": 3641.1817657709794,
|
||||||
|
"p75": 5219.1127508323925,
|
||||||
|
"p90": 6473.0697975499825,
|
||||||
|
"p95": 6961.979280318372,
|
||||||
|
"p99": 7505.5541100411665,
|
||||||
|
"p99.9": 8746.143193799813,
|
||||||
|
"p99.99": 10022.550739138387
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.051438553954384715,
|
||||||
|
"fastest": 0.0489099,
|
||||||
|
"slowest": 0.0550978
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.00004745068695753747,
|
||||||
|
"fastest": 5.9e-6,
|
||||||
|
"slowest": 0.0001463
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.004647635703109795,
|
||||||
|
"fastest": 0.0003426,
|
||||||
|
"slowest": 0.068228401
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 51386
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 16
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.012466199,
|
||||||
|
"slowest": 0.193254797,
|
||||||
|
"fastest": 0.0082419,
|
||||||
|
"average": 0.07044534605138456,
|
||||||
|
"requestsPerSec": 3606.5360136235668,
|
||||||
|
"totalData": 161661,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 10768.450556829126
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 3606.5360136235668,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 8.242,
|
||||||
|
"mean": 70.445,
|
||||||
|
"p50": 68.399,
|
||||||
|
"p95": 108.55,
|
||||||
|
"p99": 134.345,
|
||||||
|
"max": 193.255
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0082419": 1,
|
||||||
|
"0.0267431897": 314,
|
||||||
|
"0.045244479399999996": 5069,
|
||||||
|
"0.0637457691": 16265,
|
||||||
|
"0.0822470588": 18675,
|
||||||
|
"0.1007483485": 9007,
|
||||||
|
"0.1192496382": 3235,
|
||||||
|
"0.1377509279": 894,
|
||||||
|
"0.1562522176": 282,
|
||||||
|
"0.1747535073": 134,
|
||||||
|
"0.193254797": 11
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.045255097,
|
||||||
|
"p25": 0.055998799,
|
||||||
|
"p50": 0.068398696,
|
||||||
|
"p75": 0.082402895,
|
||||||
|
"p90": 0.097909198,
|
||||||
|
"p95": 0.108549894,
|
||||||
|
"p99": 0.1343454,
|
||||||
|
"p99.9": 0.16636569,
|
||||||
|
"p99.99": 0.184468389
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0082417": 1,
|
||||||
|
"0.0267429697": 314,
|
||||||
|
"0.0452442394": 5069,
|
||||||
|
"0.0637455091": 16265,
|
||||||
|
"0.0822467788": 18675,
|
||||||
|
"0.1007480485": 9007,
|
||||||
|
"0.1192493182": 3235,
|
||||||
|
"0.1377505879": 894,
|
||||||
|
"0.1562518576": 282,
|
||||||
|
"0.17475312729999998": 134,
|
||||||
|
"0.193254397": 11
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.045254597,
|
||||||
|
"p25": 0.055998399,
|
||||||
|
"p50": 0.068398296,
|
||||||
|
"p75": 0.082402395,
|
||||||
|
"p90": 0.097908798,
|
||||||
|
"p95": 0.108549494,
|
||||||
|
"p99": 0.134345,
|
||||||
|
"p99.9": 0.16636519,
|
||||||
|
"p99.99": 0.184467989
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 3725.090712920856,
|
||||||
|
"stddev": 2222.2177970570033,
|
||||||
|
"max": 16580.998176093126,
|
||||||
|
"min": 6.566850926593501,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 973.9627296928842,
|
||||||
|
"p25": 2110.573975617737,
|
||||||
|
"p50": 3578.244662804117,
|
||||||
|
"p75": 5078.101712142901,
|
||||||
|
"p90": 6638.108968707412,
|
||||||
|
"p95": 7661.599258034662,
|
||||||
|
"p99": 9869.689259000877,
|
||||||
|
"p99.9": 15037.59398495838,
|
||||||
|
"p99.99": 16580.998176093126
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.09872306716434409,
|
||||||
|
"fastest": 0.061666496,
|
||||||
|
"slowest": 0.16976059
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 8.837910609237815e-6,
|
||||||
|
"fastest": 2.2e-6,
|
||||||
|
"slowest": 0.0002139
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.0704447562041305,
|
||||||
|
"fastest": 0.0082417,
|
||||||
|
"slowest": 0.193254397
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 53887
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 256
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.003713894,
|
||||||
|
"slowest": 0.079442,
|
||||||
|
"fastest": 0.0003078,
|
||||||
|
"average": 0.011152737680442688,
|
||||||
|
"requestsPerSec": 5708.453293970816,
|
||||||
|
"totalData": 256752,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 17112.56305031752
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 5708.453293970816,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.308,
|
||||||
|
"mean": 11.153,
|
||||||
|
"p50": 10.255,
|
||||||
|
"p95": 23.188,
|
||||||
|
"p99": 37.342,
|
||||||
|
"max": 79.442
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0003078": 1,
|
||||||
|
"0.008221220000000001": 29665,
|
||||||
|
"0.016134640000000002": 40765,
|
||||||
|
"0.024048060000000003": 11332,
|
||||||
|
"0.03196148": 2270,
|
||||||
|
"0.039874900000000005": 924,
|
||||||
|
"0.04778832": 384,
|
||||||
|
"0.05570174": 149,
|
||||||
|
"0.06361516": 53,
|
||||||
|
"0.07152858000000001": 36,
|
||||||
|
"0.07944200000000001": 5
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0029656,
|
||||||
|
"p25": 0.006794,
|
||||||
|
"p50": 0.010255,
|
||||||
|
"p75": 0.0141449,
|
||||||
|
"p90": 0.0192869,
|
||||||
|
"p95": 0.023187701,
|
||||||
|
"p99": 0.037342,
|
||||||
|
"p99.9": 0.0562323,
|
||||||
|
"p99.99": 0.069859
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0003075": 1,
|
||||||
|
"0.00822094": 29666,
|
||||||
|
"0.016134379999999997": 40765,
|
||||||
|
"0.024047819999999994": 11332,
|
||||||
|
"0.03196126": 2269,
|
||||||
|
"0.0398747": 924,
|
||||||
|
"0.04778813999999999": 384,
|
||||||
|
"0.055701579999999994": 149,
|
||||||
|
"0.06361502": 53,
|
||||||
|
"0.07152845999999999": 36,
|
||||||
|
"0.0794419": 5
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0029654,
|
||||||
|
"p25": 0.0067934,
|
||||||
|
"p50": 0.0102546,
|
||||||
|
"p75": 0.0141444,
|
||||||
|
"p90": 0.0192867,
|
||||||
|
"p95": 0.0231829,
|
||||||
|
"p99": 0.0373416,
|
||||||
|
"p99.9": 0.0562318,
|
||||||
|
"p99.99": 0.0698585
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 5707.375447740455,
|
||||||
|
"stddev": 2140.898003961851,
|
||||||
|
"max": 11484.619921158206,
|
||||||
|
"min": 14.114883663505633,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 2605.1060077752104,
|
||||||
|
"p25": 4484.076433120714,
|
||||||
|
"p50": 6039.862488436646,
|
||||||
|
"p75": 7197.16168271699,
|
||||||
|
"p90": 8168.052443084634,
|
||||||
|
"p95": 8824.33487843727,
|
||||||
|
"p99": 9585.405967167944,
|
||||||
|
"p99.9": 10336.384071932633,
|
||||||
|
"p99.99": 11484.619921158206
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.0747351895878197,
|
||||||
|
"fastest": 0.057600001,
|
||||||
|
"slowest": 0.106284601
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.000016428272808001737,
|
||||||
|
"fastest": 2.1e-6,
|
||||||
|
"slowest": 0.0002039
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.011152140165720274,
|
||||||
|
"fastest": 0.0003075,
|
||||||
|
"slowest": 0.0794419
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 85584
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 64
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.002780824,
|
||||||
|
"slowest": 0.087557499,
|
||||||
|
"fastest": 0.0000344,
|
||||||
|
"average": 0.0047049367742727334,
|
||||||
|
"requestsPerSec": 13582.01538704289,
|
||||||
|
"totalData": 0,
|
||||||
|
"sizePerRequest": 0,
|
||||||
|
"sizePerSec": 0.0
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 13582.01538704289,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.034,
|
||||||
|
"mean": 4.705,
|
||||||
|
"p50": 1.837,
|
||||||
|
"p95": 20.83,
|
||||||
|
"p99": 32.408,
|
||||||
|
"max": 87.557
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0000344": 1,
|
||||||
|
"0.0087867099": 171211,
|
||||||
|
"0.0175390198": 15640,
|
||||||
|
"0.0262913297": 11298,
|
||||||
|
"0.035043639599999996": 4412,
|
||||||
|
"0.043795949499999993": 805,
|
||||||
|
"0.0525482594": 220,
|
||||||
|
"0.061300569299999996": 98,
|
||||||
|
"0.0700528792": 19,
|
||||||
|
"0.0788051891": 0,
|
||||||
|
"0.087557499": 2
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0007834,
|
||||||
|
"p25": 0.0011793,
|
||||||
|
"p50": 0.0018371,
|
||||||
|
"p75": 0.0035278,
|
||||||
|
"p90": 0.0156791,
|
||||||
|
"p95": 0.0208298,
|
||||||
|
"p99": 0.032408,
|
||||||
|
"p99.9": 0.048070499,
|
||||||
|
"p99.99": 0.062111599
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"NaN": 0
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": null,
|
||||||
|
"p25": null,
|
||||||
|
"p50": null,
|
||||||
|
"p75": null,
|
||||||
|
"p90": null,
|
||||||
|
"p95": null,
|
||||||
|
"p99": null,
|
||||||
|
"p99.9": null,
|
||||||
|
"p99.99": null
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 14750.279700369903,
|
||||||
|
"stddev": 14560.69116016888,
|
||||||
|
"max": 68204.77433420006,
|
||||||
|
"min": 40.72341066709136,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 88.6061368610332,
|
||||||
|
"p25": 1208.1854564674761,
|
||||||
|
"p50": 11023.921910545645,
|
||||||
|
"p75": 25486.68727293039,
|
||||||
|
"p90": 37901.03026744765,
|
||||||
|
"p95": 41947.83877439307,
|
||||||
|
"p99": 48502.425121255284,
|
||||||
|
"p99.9": 55047.724862357965,
|
||||||
|
"p99.99": 68204.77433420006
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.0003320484374999999,
|
||||||
|
"fastest": 0.000121,
|
||||||
|
"slowest": 0.0007906
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.000012546875,
|
||||||
|
"fastest": 2.9e-6,
|
||||||
|
"slowest": 0.0001175
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": null,
|
||||||
|
"fastest": null,
|
||||||
|
"slowest": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"308": 203706
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 62
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.002190688,
|
||||||
|
"slowest": 0.082422398,
|
||||||
|
"fastest": 0.0002387,
|
||||||
|
"average": 0.0005324675257484613,
|
||||||
|
"requestsPerSec": 1861.3948176473145,
|
||||||
|
"totalData": 83772,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 5583.984482146851
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 1861.3948176473145,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.239,
|
||||||
|
"mean": 0.532,
|
||||||
|
"p50": 0.3,
|
||||||
|
"p95": 0.412,
|
||||||
|
"p99": 9.03,
|
||||||
|
"max": 82.422
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0002387": 1,
|
||||||
|
"0.0084570698": 27612,
|
||||||
|
"0.0166754396": 250,
|
||||||
|
"0.0248938094": 59,
|
||||||
|
"0.0331121792": 1,
|
||||||
|
"0.041330549": 0,
|
||||||
|
"0.0495489188": 0,
|
||||||
|
"0.0577672886": 0,
|
||||||
|
"0.0659856584": 0,
|
||||||
|
"0.0742040282": 0,
|
||||||
|
"0.082422398": 1
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0002824,
|
||||||
|
"p25": 0.0002911,
|
||||||
|
"p50": 0.0003002,
|
||||||
|
"p75": 0.0003116,
|
||||||
|
"p90": 0.0003388,
|
||||||
|
"p95": 0.000412,
|
||||||
|
"p99": 0.009029999,
|
||||||
|
"p99.9": 0.0171978,
|
||||||
|
"p99.99": 0.023654
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0002385": 1,
|
||||||
|
"0.008456779800000001": 27612,
|
||||||
|
"0.0166750596": 250,
|
||||||
|
"0.024893339400000002": 59,
|
||||||
|
"0.033111619200000005": 1,
|
||||||
|
"0.041329899": 0,
|
||||||
|
"0.04954817880000001": 0,
|
||||||
|
"0.05776645860000001": 0,
|
||||||
|
"0.0659847384": 0,
|
||||||
|
"0.07420301820000001": 0,
|
||||||
|
"0.082421298": 1
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0002821,
|
||||||
|
"p25": 0.0002909,
|
||||||
|
"p50": 0.0003,
|
||||||
|
"p75": 0.0003113,
|
||||||
|
"p90": 0.0003385,
|
||||||
|
"p95": 0.0004117,
|
||||||
|
"p99": 0.009029699,
|
||||||
|
"p99.9": 0.017197,
|
||||||
|
"p99.99": 0.0236532
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 2124.484265564842,
|
||||||
|
"stddev": 1347.8575502140113,
|
||||||
|
"max": 3645.643456057386,
|
||||||
|
"min": 12.074684629160716,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 70.81350555177794,
|
||||||
|
"p25": 608.951588348692,
|
||||||
|
"p50": 3104.999048468054,
|
||||||
|
"p75": 3249.918752029405,
|
||||||
|
"p90": 3328.933019572346,
|
||||||
|
"p95": 3383.0288607359867,
|
||||||
|
"p99": 3489.0965732087448,
|
||||||
|
"p99.9": 3600.884788833553,
|
||||||
|
"p99.99": 3645.643456057386
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.081536798,
|
||||||
|
"fastest": 0.081536798,
|
||||||
|
"slowest": 0.081536798
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.0000458,
|
||||||
|
"fastest": 0.0000458,
|
||||||
|
"slowest": 0.0000458
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.0005321862014396212,
|
||||||
|
"fastest": 0.0002385,
|
||||||
|
"slowest": 0.082421298
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 27924
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.03402794,
|
||||||
|
"slowest": 0.130961199,
|
||||||
|
"fastest": 0.0001862,
|
||||||
|
"average": 0.004149040110114824,
|
||||||
|
"requestsPerSec": 3843.347919173815,
|
||||||
|
"totalData": 173301,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 11527.250095026762
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 3843.347919173815,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.186,
|
||||||
|
"mean": 4.149,
|
||||||
|
"p50": 1.855,
|
||||||
|
"p95": 18.713,
|
||||||
|
"p99": 28.766,
|
||||||
|
"max": 130.961
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0001862": 1,
|
||||||
|
"0.0132636999": 52977,
|
||||||
|
"0.026341199800000003": 3490,
|
||||||
|
"0.039418699700000004": 1217,
|
||||||
|
"0.0524961996": 57,
|
||||||
|
"0.0655736995": 3,
|
||||||
|
"0.07865119940000001": 6,
|
||||||
|
"0.09172869930000001": 4,
|
||||||
|
"0.1048061992": 5,
|
||||||
|
"0.1178836991": 6,
|
||||||
|
"0.130961199": 1
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0009131,
|
||||||
|
"p25": 0.0011822,
|
||||||
|
"p50": 0.0018548,
|
||||||
|
"p75": 0.0026308,
|
||||||
|
"p90": 0.0112775,
|
||||||
|
"p95": 0.018713299,
|
||||||
|
"p99": 0.028765999,
|
||||||
|
"p99.9": 0.0428159,
|
||||||
|
"p99.99": 0.1050984
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0001859": 1,
|
||||||
|
"0.0132634099": 52977,
|
||||||
|
"0.0263409198": 3490,
|
||||||
|
"0.03941842970000001": 1217,
|
||||||
|
"0.052495939600000006": 57,
|
||||||
|
"0.0655734495": 3,
|
||||||
|
"0.07865095940000001": 6,
|
||||||
|
"0.0917284693": 4,
|
||||||
|
"0.10480597920000001": 5,
|
||||||
|
"0.11788348910000002": 6,
|
||||||
|
"0.130960999": 1
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0009128,
|
||||||
|
"p25": 0.0011819,
|
||||||
|
"p50": 0.0018545,
|
||||||
|
"p75": 0.0026305,
|
||||||
|
"p90": 0.0112772,
|
||||||
|
"p95": 0.018712999,
|
||||||
|
"p99": 0.028765699,
|
||||||
|
"p99.9": 0.0428156,
|
||||||
|
"p99.99": 0.1050981
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 4687.215272300966,
|
||||||
|
"stddev": 4249.667886126964,
|
||||||
|
"max": 18300.837615252258,
|
||||||
|
"min": 9.473159696631534,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 76.57612815780362,
|
||||||
|
"p25": 607.0723933828876,
|
||||||
|
"p50": 4152.361275686176,
|
||||||
|
"p75": 7117.139747132983,
|
||||||
|
"p90": 11249.415614773832,
|
||||||
|
"p95": 13226.58543672865,
|
||||||
|
"p99": 14836.795252224973,
|
||||||
|
"p99.9": 17690.76542045258,
|
||||||
|
"p99.99": 18300.837615252258
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.0998782625,
|
||||||
|
"fastest": 0.086856,
|
||||||
|
"slowest": 0.1134017
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 0.000027018750000000006,
|
||||||
|
"fastest": 5.8e-6,
|
||||||
|
"slowest": 0.0000528
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.004148775954108705,
|
||||||
|
"fastest": 0.0001859,
|
||||||
|
"slowest": 0.130960999
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 57767
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 14
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
{
|
||||||
|
"summary": {
|
||||||
|
"successRate": 1.0,
|
||||||
|
"total": 15.02036436,
|
||||||
|
"slowest": 0.307769899,
|
||||||
|
"fastest": 0.0007085,
|
||||||
|
"average": 0.057897151761926315,
|
||||||
|
"requestsPerSec": 4421.463981050856,
|
||||||
|
"totalData": 198468,
|
||||||
|
"sizePerRequest": 3,
|
||||||
|
"sizePerSec": 13213.261359260396
|
||||||
|
},
|
||||||
|
"metrics": {
|
||||||
|
"success_rate": 1.0,
|
||||||
|
"requests_per_sec": 4421.463981050856,
|
||||||
|
"latency_ms": {
|
||||||
|
"min": 0.709,
|
||||||
|
"mean": 57.897,
|
||||||
|
"p50": 52.26,
|
||||||
|
"p95": 114.007,
|
||||||
|
"p99": 155.594,
|
||||||
|
"max": 307.77
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"responseTimeHistogram": {
|
||||||
|
"0.0007085": 1,
|
||||||
|
"0.0314146399": 13286,
|
||||||
|
"0.062120779800000005": 27831,
|
||||||
|
"0.09282691970000001": 16633,
|
||||||
|
"0.12353305960000001": 6055,
|
||||||
|
"0.1542391995": 1668,
|
||||||
|
"0.18494533940000002": 359,
|
||||||
|
"0.2156514793": 87,
|
||||||
|
"0.24635761920000002": 47,
|
||||||
|
"0.27706375910000003": 44,
|
||||||
|
"0.307769899": 145
|
||||||
|
},
|
||||||
|
"latencyPercentiles": {
|
||||||
|
"p10": 0.0227912,
|
||||||
|
"p25": 0.0346661,
|
||||||
|
"p50": 0.0522601,
|
||||||
|
"p75": 0.074456899,
|
||||||
|
"p90": 0.098357199,
|
||||||
|
"p95": 0.1140067,
|
||||||
|
"p99": 0.1555942,
|
||||||
|
"p99.9": 0.288823099,
|
||||||
|
"p99.99": 0.305920899
|
||||||
|
},
|
||||||
|
"firstByteHistogram": {
|
||||||
|
"0.0007083": 1,
|
||||||
|
"0.0314144299": 13286,
|
||||||
|
"0.0621205598": 27831,
|
||||||
|
"0.09282668969999999": 16633,
|
||||||
|
"0.1235328196": 6055,
|
||||||
|
"0.1542389495": 1668,
|
||||||
|
"0.1849450794": 359,
|
||||||
|
"0.2156512093": 87,
|
||||||
|
"0.2463573392": 47,
|
||||||
|
"0.2770634691": 44,
|
||||||
|
"0.307769599": 145
|
||||||
|
},
|
||||||
|
"firstBytePercentiles": {
|
||||||
|
"p10": 0.0227909,
|
||||||
|
"p25": 0.034666,
|
||||||
|
"p50": 0.05226,
|
||||||
|
"p75": 0.074456599,
|
||||||
|
"p90": 0.098356899,
|
||||||
|
"p95": 0.1140066,
|
||||||
|
"p99": 0.155594,
|
||||||
|
"p99.9": 0.288822999,
|
||||||
|
"p99.99": 0.305920699
|
||||||
|
},
|
||||||
|
"rps": {
|
||||||
|
"mean": 5496.792005988151,
|
||||||
|
"stddev": 9329.201442555335,
|
||||||
|
"max": 281250.00000069453,
|
||||||
|
"min": 6.819621688306462,
|
||||||
|
"percentiles": {
|
||||||
|
"p10": 83.23483877412131,
|
||||||
|
"p25": 802.8662324498608,
|
||||||
|
"p50": 4426.336703384787,
|
||||||
|
"p75": 8480.209025692833,
|
||||||
|
"p90": 11862.787095923737,
|
||||||
|
"p95": 14050.864128143876,
|
||||||
|
"p99": 18224.633971543284,
|
||||||
|
"p99.9": 172413.7930951901,
|
||||||
|
"p99.99": 281250.00000069453
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"details": {
|
||||||
|
"DNSDialup": {
|
||||||
|
"average": 0.15998890273046876,
|
||||||
|
"fastest": 0.1231775,
|
||||||
|
"slowest": 0.241296799
|
||||||
|
},
|
||||||
|
"DNSLookup": {
|
||||||
|
"average": 6.783203125000001e-6,
|
||||||
|
"fastest": 2.2e-6,
|
||||||
|
"slowest": 0.0000495
|
||||||
|
},
|
||||||
|
"firstByte": {
|
||||||
|
"average": 0.057896894489721726,
|
||||||
|
"fastest": 0.0007083,
|
||||||
|
"slowest": 0.307769599
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"statusCodeDistribution": {
|
||||||
|
"200": 66156
|
||||||
|
},
|
||||||
|
"errorDistribution": {
|
||||||
|
"aborted due to deadline": 256
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user