No description
|
|
||
|---|---|---|
| .woodpecker | ||
| cmd/dharma | ||
| pkg | ||
| scripts | ||
| testsite | ||
| .gitignore | ||
| .goreleaser.yml | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| testsite_test.go | ||
Dharma
A website link checker that crawls websites to find broken links, images, CSS references, and more.
Features
- Crawls websites and checks for broken links, images, stylesheets, and other references
- Checks both internal and external links
- Supports CSS file scanning for
@importandurl()references - Concurrent requests for faster scanning
- Multiple output formats (pretty terminal output, JSON, CSV)
- Configurable scan depth, concurrency, and timeout
Installation
From Source
git clone git.nakama.town/fmartingr/dharma
cd dharma
go install ./cmd/dharma
Usage
# Basic usage (defaults to 'pretty' output format)
dharma https://example.com
# Use JSON output format
dharma --format json https://example.com
# Increase concurrency and depth
dharma --concurrency 20 --depth 5 https://example.com
# Increase timeout for slow sites
dharma --timeout 30 https://example.com
# Enable verbose output
dharma --verbose https://example.com
Command Line Options
--format, -f: Output format (pretty, json, csv) (default: "pretty")--concurrency, -c: Number of concurrent requests (default: 10)--depth, -d: Maximum depth to crawl (default: 3)--timeout, -t: Timeout in seconds for each request (default: 10)--verbose, -v: Enable verbose output
Development
Testing
The project includes a comprehensive test suite:
# Run all tests
go test -v ./...
# Run tests excluding integration tests
go test -v -short ./...
# Run testsite tests specifically
make test-testsite
A test site is included in the testsite/ directory to test the tool against a controlled environment with known broken and working links. The test suite will start a local HTTP server for this test site and run the tool against it to verify its functionality.