Skip to content

Commit f37ce95

Browse files
Release v0.4.1: SRV/AAAA records, Pi-hole/dnsmasq providers, native labels, cache fixes
2 parents 7898b82 + 03f6093 commit f37ce95

45 files changed

Lines changed: 11502 additions & 4263 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitlab-ci.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ workflow:
2424
- if: $CI_COMMIT_TAG
2525
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop"
2626
changes: &code-files ["{**/*.go,go.mod,go.sum}"]
27+
- if: $CI_COMMIT_BRANCH =~ /^(feature|bugfix|hotfix)\//
28+
changes: *code-files
2729
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
2830
changes: *code-files
2931

32+
# Feature branches: run validate/test/security/build but NOT docker (no image push)
3033
.rules-docker: &rules-docker
3134
- if: $CI_COMMIT_TAG
3235
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop"
@@ -75,7 +78,7 @@ lint:
7578
stage: test
7679
script:
7780
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
78-
- golangci-lint run --timeout 5m
81+
- golangci-lint run --config .golangci.yml --timeout 5m
7982
rules: *rules-code-changes
8083
allow_failure: true
8184

@@ -110,6 +113,16 @@ security:govulncheck:
110113
rules: *rules-code-changes
111114
allow_failure: true
112115

116+
security:gitleaks:
117+
stage: security
118+
image:
119+
name: zricethezav/gitleaks:latest
120+
entrypoint: [""]
121+
script:
122+
- gitleaks detect --source . --verbose --no-git
123+
rules: *rules-code-changes
124+
allow_failure: false # Block on secrets detection
125+
113126
# ─────────────────────────────────────────────────────────────────────────────
114127
# Build
115128
# ─────────────────────────────────────────────────────────────────────────────

.golangci.yml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
# ===================================
2+
# golangci-lint configuration
3+
# ===================================
4+
# This file ensures reproducible linting across local development and CI.
5+
# Docs: https://golangci-lint.run/usage/configuration/
6+
7+
run:
8+
timeout: 5m
9+
issues-exit-code: 1
10+
tests: true
11+
modules-download-mode: readonly
12+
13+
output:
14+
formats:
15+
- format: colored-line-number
16+
print-issued-lines: true
17+
print-linter-name: true
18+
19+
linters:
20+
enable:
21+
# Default linters
22+
- errcheck # Check for unchecked errors
23+
- gosimple # Simplify code
24+
- govet # Suspicious constructs
25+
- ineffassign # Detect ineffectual assignments
26+
- staticcheck # Static analysis
27+
- unused # Unused code
28+
29+
# Additional recommended
30+
- bodyclose # HTTP response body close
31+
- dogsled # Too many blank identifiers
32+
- dupl # Code duplication (threshold below)
33+
- errorlint # Error wrapping issues
34+
- exhaustive # Enum switch completeness
35+
- gochecknoinits # No init functions
36+
- goconst # Repeated strings → const
37+
- gocritic # Opinionated linter
38+
- gofmt # Formatting check
39+
- goimports # Import formatting
40+
- gosec # Security issues
41+
- misspell # Spelling mistakes
42+
- nakedret # Naked returns in long functions
43+
- nilerr # Return nil after error check
44+
- noctx # HTTP requests without context
45+
- prealloc # Slice preallocation
46+
- predeclared # Shadowing predeclared identifiers
47+
- revive # Replacement for golint
48+
- unconvert # Unnecessary conversions
49+
- unparam # Unused function parameters
50+
- whitespace # Unnecessary whitespace
51+
52+
disable:
53+
- depguard # Requires configuration for allowed packages
54+
- funlen # Often too restrictive for table-driven tests
55+
- gocognit # Cognitive complexity - use judiciously
56+
- gocyclo # Cyclomatic complexity - use judiciously
57+
- lll # Line length - gofmt handles wrapping
58+
59+
linters-settings:
60+
dupl:
61+
threshold: 150 # Tokens before flagging duplication
62+
63+
errcheck:
64+
check-type-assertions: true
65+
check-blank: true
66+
exclude-functions:
67+
- io.Copy
68+
- io.ReadAll
69+
- (io.ReadCloser).Close
70+
71+
errorlint:
72+
errorf: true
73+
asserts: true
74+
comparison: true
75+
76+
exhaustive:
77+
default-signifies-exhaustive: true
78+
79+
goconst:
80+
min-len: 3
81+
min-occurrences: 3
82+
83+
gocritic:
84+
enabled-tags:
85+
- diagnostic
86+
- style
87+
- performance
88+
disabled-checks:
89+
- whyNoLint # Sometimes we need nolint without explanation
90+
91+
goimports:
92+
local-prefixes: gitlab.bluewillows.net
93+
94+
gosec:
95+
excludes:
96+
- G104 # Errors unhandled - errcheck covers this
97+
- G304 # File path from variable - often intentional
98+
99+
govet:
100+
enable-all: true
101+
disable:
102+
- fieldalignment # Too noisy, minor optimization
103+
104+
misspell:
105+
locale: US
106+
107+
nakedret:
108+
max-func-lines: 30
109+
110+
prealloc:
111+
simple: true
112+
for-loops: true
113+
114+
revive:
115+
rules:
116+
- name: blank-imports
117+
- name: context-as-argument
118+
- name: context-keys-type
119+
- name: dot-imports
120+
- name: error-return
121+
- name: error-strings
122+
- name: error-naming
123+
- name: exported
124+
- name: increment-decrement
125+
- name: indent-error-flow
126+
- name: package-comments
127+
- name: range
128+
- name: receiver-naming
129+
- name: time-naming
130+
- name: unexported-return
131+
- name: var-declaration
132+
- name: var-naming
133+
134+
unparam:
135+
check-exported: false # Can cause issues with interfaces
136+
137+
issues:
138+
exclude-use-default: false
139+
max-issues-per-linter: 0
140+
max-same-issues: 0
141+
142+
exclude-rules:
143+
# Test files can have longer functions and more complexity
144+
- path: _test\.go
145+
linters:
146+
- dupl
147+
- gosec
148+
- goconst
149+
150+
# Allow fmt.Print in main for CLI output
151+
- path: cmd/
152+
linters:
153+
- forbidigo
154+
155+
# Generated code should be excluded
156+
- path: ".*\\.gen\\.go$"
157+
linters:
158+
- dupl
159+
- goconst
160+
- gocritic
161+
162+
# Mock files often have unused parameters by design
163+
- path: mock
164+
linters:
165+
- unparam
166+
167+
# Provider implementations may have similar patterns
168+
- path: providers/
169+
linters:
170+
- dupl
171+
text: "duplicate of"
172+
173+
severity:
174+
default-severity: warning
175+
rules:
176+
- linters: [gosec, errcheck]
177+
severity: error

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,60 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.4.1] - 2026-01-11
11+
12+
### Added
13+
- **CLEANUP_ON_STOP Option**: New `DNSWEAVER_CLEANUP_ON_STOP` configuration option (default: `true`)
14+
- When `true` (default): DNS records are deleted when containers stop or are removed
15+
- When `false`: DNS records are only deleted when containers are removed, not when stopped
16+
- Useful for containers that frequently stop/start and don't need DNS cleanup on stop
17+
- **Native dnsweaver Labels** (#27): Use dnsweaver without Traefik dependency
18+
- New label format: `dnsweaver.hostname`, `dnsweaver.type`, `dnsweaver.target`
19+
- Works alongside existing Traefik label parsing
20+
- Enables DNS management for services that don't use Traefik
21+
- **Pi-hole Provider** (#15): Native Pi-hole DNS integration with two operation modes
22+
- **API mode**: Uses Pi-hole's Admin API (recommended for Pi-hole v5)
23+
- Manages Local DNS Records (A/AAAA) and Local CNAME Records
24+
- Authentication via admin password (supports `_FILE` suffix for secrets)
25+
- **File mode**: Direct file manipulation for containerized Pi-hole setups
26+
- Uses dnsmasq config format internally
27+
- Configurable config directory, filename, and reload command
28+
- Supports A, AAAA, and CNAME record types
29+
- Zone filtering for multi-zone environments
30+
- **Note**: Pi-hole v6+ uses a different API; see #74 for v6 support
31+
- **dnsmasq Provider** (#28): File-based DNS provider for dnsmasq DNS server
32+
- Manages records by writing to dnsmasq configuration files
33+
- Supports `address=` directive for A/AAAA records
34+
- Supports `cname=` directive for CNAME records
35+
- Automatic dnsmasq reload after changes (configurable)
36+
- Serves as foundation for Pi-hole integration
37+
- Configurable config directory, filename, and reload command
38+
- **Note**: Orphan cleanup limited due to lack of TXT ownership support; see #73
39+
- **SRV Record Support** (#62): Service discovery DNS records
40+
- Added `SRV` record type for service discovery (Minecraft, SIP, LDAP, XMPP)
41+
- SRV records include priority, weight, port, and target fields
42+
- SRV naming convention: `_service._proto.name` (e.g., `_minecraft._tcp.example.com`)
43+
- Full support across all providers: Technitium, Cloudflare, Webhook
44+
- Updated README with SRV record type in reference table
45+
- **AAAA Record Support** (#63): IPv6 DNS record support
46+
- Added `AAAA` record type for IPv6 addresses alongside existing `A` (IPv4) and `CNAME` types
47+
- Strict validation: A records require IPv4, AAAA records require IPv6, CNAME requires hostname
48+
- Full support across all providers: Technitium, Cloudflare, Webhook
49+
- Updated README with IPv6 configuration examples
50+
51+
### Fixed
52+
- **Cache includes all record types** (#63, #62): Record cache now properly includes AAAA and SRV records
53+
- Previously, `getExistingRecords()` only cached A and CNAME records
54+
- SRV and AAAA records were being missed during orphan cleanup
55+
- **Orphan cleanup uses correct record type** (#63, #62): Delete operations now use the actual record type
56+
- Previously, orphan cleanup always used `A` record type for deletion regardless of actual type
57+
- Now correctly deletes AAAA records as AAAA and SRV records as SRV
58+
- **SRV record data updates**: Fixed multiple issues with SRV record lifecycle
59+
- Proper detection of SRV record data changes (priority, weight, port, target)
60+
- Correct API parameter names for Technitium SRV records
61+
- SRV data properly passed through reconciler to providers
62+
- RFC 2782 validation for SRV record hostnames
63+
1064
## [0.3.3] - 2026-01-09
1165

1266
### Added

0 commit comments

Comments
 (0)