Initial implementation of lightmux-contrib, a sibling module to lightmux that hosts opinionated middlewares with one sub-package per middleware: - realip: resolves the originating client IP from CF-Connecting-IP, True-Client-IP, X-Real-IP, or X-Forwarded-For. Optional peer-CIDR allowlist via netip.Prefix. - requestlog: emits a structured http.request record (method, path, status, duration, client) per request via splinter. - recoverer: catches panics, wraps with errx under op "recoverer", logs with stack, and writes a 500 response. Each package exposes a single New(...) constructor returning func(http.Handler) http.Handler. The contrib module intentionally does not import lightmux — middlewares interoperate via the standard stdlib middleware shape. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
43 lines
791 B
YAML
43 lines
791 B
YAML
version: '3'
|
|
|
|
tasks:
|
|
default:
|
|
desc: Run vet and tests
|
|
cmds:
|
|
- task: check
|
|
|
|
install:tools:
|
|
desc: Install development tools (tparse for prettier test output)
|
|
cmds:
|
|
- go install github.com/mfridman/tparse@latest
|
|
|
|
test:
|
|
desc: Run tests with prettier output via tparse
|
|
cmds:
|
|
- set -o pipefail && go test ./... -json -cover | tparse -all
|
|
|
|
test:race:
|
|
desc: Run tests under the race detector
|
|
cmds:
|
|
- set -o pipefail && go test ./... -race -json | tparse -all
|
|
|
|
vet:
|
|
desc: Run go vet
|
|
cmds:
|
|
- go vet ./...
|
|
|
|
fmt:
|
|
desc: Format Go source files
|
|
cmds:
|
|
- gofmt -w .
|
|
|
|
tidy:
|
|
desc: Tidy go.mod
|
|
cmds:
|
|
- go mod tidy
|
|
|
|
check:
|
|
desc: Run vet and tests
|
|
cmds:
|
|
- task: vet
|
|
- task: test
|