Thank you for your interest in contributing to caddy-analyzer! We welcome contributions from everyone.
- Prerequisites: Go (v1.25+).
- Clone the repository:
git clone https://github.com/lenny-ts/caddy-analyzer.git cd caddy-analyzer - Run tests:
go test -race ./... - Build binary:
go build -o caddy-analyze ./cmd/caddy-analyze
Before submitting a PR, ensure all checks pass:
# Format
gofmt -w .
# Vet
go vet ./...
# Lint (golangci-lint must be installed)
golangci-lint run
# Tests with race detector
go test -race -coverprofile=coverage.out ./...
go tool cover -func=coverage.out | tail -1
# Vulnerability scan
go run golang.org/x/vuln/cmd/govulncheck@latest ./...CI enforces a 60% total coverage threshold.
- Ensure all existing tests pass (
go test -race ./...). - Add unit test cases for any new features or security signatures.
- Keep commits clean and descriptive.
- New detection patterns must include a confidence score (1-10) and pass
TestPatternUniqueness(no duplicates). - New blocklist sources must be added to
DefaultSourcesinpkg/blocklist/blocklist.gowith a test entry inpkg/blocklist/blocklist_test.go. - New GeoIP or enrichment sources must implement the
Enricherinterface inpkg/enrich/enrich.go. - Guard rule changes must include a test in
pkg/guard/guard_test.goorpkg/guard/blocklist_test.go.
Blocklist config files support two JSON shapes:
Source array (simple):
[{"name": "my-feed", "url": "https://example.com/list.txt"}]Full object (with defaults control):
{
"no_defaults": false,
"custom_sources": [{"name": "my-feed", "url": "https://example.com/list.txt"}],
"remove_sources": ["tor-exit-nodes"]
}Use caddy-analyze blocklist init to write current CLI settings to the config file.