76 lines
2.1 KiB
Markdown
76 lines
2.1 KiB
Markdown
# 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 `@import` and `url()` references
|
|
- Concurrent requests for faster scanning
|
|
- Multiple output formats (pretty terminal output, JSON, CSV)
|
|
- Configurable scan depth, concurrency, and timeout
|
|
|
|
## Installation
|
|
|
|
### From releases
|
|
|
|
Download the latest release from the [releases page](https://git.nakama.town/fmartingr/dharma/releases) for your platform, there are binaries for Linux, macOS and Windows along with Alpine, Fedora and Debian packages.
|
|
|
|
### From Source
|
|
|
|
```bash
|
|
git clone git.nakama.town/fmartingr/dharma
|
|
cd dharma
|
|
go install ./cmd/dharma
|
|
```
|
|
|
|
## Usage
|
|
|
|
```bash
|
|
# 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:
|
|
|
|
```bash
|
|
# 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.
|
|
|
|
## License
|
|
|
|
[LICENSE](LICENSE)
|