Move what rproxy and waf send each other into wafprotocol (closes #425) #461

Open
clawbot wants to merge 1 commits from issue-425-wafprotocol-package into next
pull from: issue-425-wafprotocol-package
Collaborator

closes #425

Moves the question, the answer and the report out of internal/waf and internal/rproxy into one new package. Every value both daemons must agree on is now declared once. No non-test file of internal/rproxy imports internal/waf. Messages on the wire are unchanged.

New names:

  • internal/wafprotocol: the three messages rproxy and waf send each other.
    • wafprotocol.go: the header names, the three dispositions, OwnEndpointPrefix, HealthPath, ReportPath, QuestionBodyMaxBytes and ReportStatusMax.
    • question.go:
      • QuestionParams: what NewQuestion needs;
      • NewQuestion: writes the question about a visitor's request;
      • Question: a question as waf reads it;
      • ReadQuestion: reads a question and the body it carries;
      • ErrBodyStoppedArriving: the error ReadQuestion wraps when the body stops arriving.
    • answer.go:
      • Answer: the disposition, AS number and country an answer's headers give;
      • SetAnswerHeaders: writes them;
      • ReadAnswer: reads them, and reports whether the disposition is valid.
    • report.go:
      • Report: moved from waf;
      • NewReportRequest: the POST that carries a report;
      • ReadReport: reads and range-checks one.
    • wafprotocol_test.go: passes each message through its writer and then its reader.

Things the diff does not show:

  • newQuestion moved whole, Go client quirks included, since SPEC's "The question" requires them. rproxy passes in the path as sent and the scheme, so the package needs neither internal/rules nor the trusted-proxy settings.
  • The process warning for a question whose body stops arriving now prefixes its error field with "the body stopped arriving: ".

Model: opus-5-5

closes https://git.eeqj.de/sneak/smallwebwaf/issues/425 Moves the question, the answer and the report out of `internal/waf` and `internal/rproxy` into one new package. Every value both daemons must agree on is now declared once. No non-test file of `internal/rproxy` imports `internal/waf`. Messages on the wire are unchanged. New names: - `internal/wafprotocol`: the three messages `rproxy` and `waf` send each other. - `wafprotocol.go`: the header names, the three dispositions, `OwnEndpointPrefix`, `HealthPath`, `ReportPath`, `QuestionBodyMaxBytes` and `ReportStatusMax`. - `question.go`: - `QuestionParams`: what `NewQuestion` needs; - `NewQuestion`: writes the question about a visitor's request; - `Question`: a question as `waf` reads it; - `ReadQuestion`: reads a question and the body it carries; - `ErrBodyStoppedArriving`: the error `ReadQuestion` wraps when the body stops arriving. - `answer.go`: - `Answer`: the disposition, AS number and country an answer's headers give; - `SetAnswerHeaders`: writes them; - `ReadAnswer`: reads them, and reports whether the disposition is valid. - `report.go`: - `Report`: moved from `waf`; - `NewReportRequest`: the POST that carries a report; - `ReadReport`: reads and range-checks one. - `wafprotocol_test.go`: passes each message through its writer and then its reader. Things the diff does not show: - `newQuestion` moved whole, Go client quirks included, since SPEC's "The question" requires them. `rproxy` passes in the path as sent and the scheme, so the package needs neither `internal/rules` nor the trusted-proxy settings. - The process warning for a question whose body stops arriving now prefixes its `error` field with "the body stopped arriving: ". Model: opus-5-5
clawbot added 1 commit 2026-11-19 17:46:52 +01:00
internal/wafprotocol writes and reads the question, the answer and the
report, and declares once each header, path and limit both daemons use.
rproxy no longer imports internal/waf. Nothing on the wire changes.

Model: opus-5-5
clawbot self-assigned this 2026-11-19 17:46:55 +01:00
clawbot added the needs-review label 2026-11-19 17:46:55 +01:00
Author
Collaborator

Verdict: PASS
Head: 298e850e9e

internal/wafprotocol now owns the question, the answer and the report, each shared value is declared once, internal/rproxy no longer imports internal/waf, and SPEC's package list is updated as #425 requires.

Model: opus-5-5

Verdict: PASS Head: 298e850e9edb78931d99cd35020e046175f91102 `internal/wafprotocol` now owns the question, the answer and the report, each shared value is declared once, `internal/rproxy` no longer imports `internal/waf`, and SPEC's package list is updated as https://git.eeqj.de/sneak/smallwebwaf/issues/425 requires. Model: opus-5-5
Some checks are pending
check / check (push) Waiting to run
You are not authorized to merge this pull request.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-425-wafprotocol-package:issue-425-wafprotocol-package
git checkout issue-425-wafprotocol-package
Sign in to join this conversation.