Compare commits
4 Commits
c7e5c03239
...
fix/issue-
| Author | SHA1 | Date | |
|---|---|---|---|
| 4dede6af9d | |||
| b84c2f3b34 | |||
| a65a14b8ec | |||
| b7b9629bc3 |
@@ -1,6 +1,6 @@
|
|||||||
.git/
|
.git
|
||||||
bin/
|
bin
|
||||||
*.md
|
data
|
||||||
LICENSE
|
.env
|
||||||
.editorconfig
|
.DS_Store
|
||||||
.gitignore
|
*.exe
|
||||||
|
|||||||
@@ -8,5 +8,8 @@ charset = utf-8
|
|||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.go]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
[Makefile]
|
[Makefile]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
|||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 sneak
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
25
Makefile
25
Makefile
@@ -1,4 +1,4 @@
|
|||||||
.PHONY: all build lint fmt fmt-check test check clean hooks docker
|
.PHONY: all build lint fmt fmt-check test check clean docker hooks
|
||||||
|
|
||||||
BINARY := dnswatcher
|
BINARY := dnswatcher
|
||||||
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
||||||
@@ -18,32 +18,25 @@ fmt:
|
|||||||
goimports -w .
|
goimports -w .
|
||||||
|
|
||||||
fmt-check:
|
fmt-check:
|
||||||
@test -z "$$(gofmt -l .)" || (echo "gofmt: files not formatted:" && gofmt -l . && exit 1)
|
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1)
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test -v -race -timeout 30s -cover ./...
|
go test -v -race -cover -timeout 30s ./...
|
||||||
|
|
||||||
# Check runs all validation without making changes
|
# Check runs all validation without making changes
|
||||||
# Used by CI and Docker build - fails if anything is wrong
|
# Used by CI and Docker build - fails if anything is wrong
|
||||||
check:
|
check: fmt-check lint test
|
||||||
@echo "==> Checking formatting..."
|
|
||||||
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1)
|
|
||||||
@echo "==> Running linter..."
|
|
||||||
golangci-lint run --config .golangci.yml ./...
|
|
||||||
@echo "==> Running tests..."
|
|
||||||
go test -v -race -timeout 30s ./...
|
|
||||||
@echo "==> Building..."
|
@echo "==> Building..."
|
||||||
go build -ldflags "$(LDFLAGS)" -o /dev/null ./cmd/dnswatcher
|
go build -ldflags "$(LDFLAGS)" -o /dev/null ./cmd/dnswatcher
|
||||||
@echo "==> All checks passed!"
|
@echo "==> All checks passed!"
|
||||||
|
|
||||||
clean:
|
docker:
|
||||||
rm -rf bin/
|
docker build .
|
||||||
|
|
||||||
hooks:
|
hooks:
|
||||||
@echo '#!/bin/sh' > .git/hooks/pre-commit
|
@printf '#!/bin/sh\nset -e\nmake check\n' > .git/hooks/pre-commit
|
||||||
@echo 'make check' >> .git/hooks/pre-commit
|
|
||||||
@chmod +x .git/hooks/pre-commit
|
@chmod +x .git/hooks/pre-commit
|
||||||
@echo "Pre-commit hook installed."
|
@echo "Pre-commit hook installed."
|
||||||
|
|
||||||
docker:
|
clean:
|
||||||
docker build .
|
rm -rf bin/
|
||||||
|
|||||||
17
README.md
17
README.md
@@ -1,10 +1,9 @@
|
|||||||
# dnswatcher
|
# dnswatcher
|
||||||
|
|
||||||
dnswatcher is a pre-1.0 Go daemon by [@sneak](https://sneak.berlin) that monitors DNS records, TCP port availability, and TLS certificates, delivering real-time change notifications via Slack, Mattermost, and ntfy webhooks.
|
|
||||||
|
|
||||||
> ⚠️ Pre-1.0 software. APIs, configuration, and behavior may change without notice.
|
> ⚠️ Pre-1.0 software. APIs, configuration, and behavior may change without notice.
|
||||||
|
|
||||||
dnswatcher watches configured DNS domains and hostnames for changes, monitors TCP
|
dnswatcher is a production DNS and infrastructure monitoring daemon written in
|
||||||
|
Go. It watches configured DNS domains and hostnames for changes, monitors TCP
|
||||||
port availability, tracks TLS certificate expiry, and delivers real-time
|
port availability, tracks TLS certificate expiry, and delivers real-time
|
||||||
notifications via Slack, Mattermost, and/or ntfy webhooks.
|
notifications via Slack, Mattermost, and/or ntfy webhooks.
|
||||||
|
|
||||||
@@ -328,10 +327,13 @@ tracks reachability:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
make build # Build binary to bin/dnswatcher
|
make build # Build binary to bin/dnswatcher
|
||||||
make test # Run tests with race detector
|
make test # Run tests with race detector and 30s timeout
|
||||||
make lint # Run golangci-lint
|
make lint # Run golangci-lint
|
||||||
make fmt # Format code
|
make fmt # Format code (writes)
|
||||||
make check # Run all checks (format, lint, test, build)
|
make fmt-check # Read-only format check
|
||||||
|
make check # Run all checks (fmt-check, lint, test, build)
|
||||||
|
make docker # Build Docker image
|
||||||
|
make hooks # Install pre-commit hook
|
||||||
make clean # Remove build artifacts
|
make clean # Remove build artifacts
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -395,8 +397,7 @@ Viper for configuration.
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
License has not yet been chosen for this project. Pending decision by the
|
MIT — see [LICENSE](LICENSE).
|
||||||
author (MIT, GPL, or WTFPL).
|
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user