Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: configuration for FQDN only resolver #1025

Merged
merged 2 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ type Config struct {
KeyFile string `yaml:"keyFile"`
BootstrapDNS BootstrapDNSConfig `yaml:"bootstrapDns"`
HostsFile HostsFileConfig `yaml:"hostsFile"`
FqdnOnly FqdnOnlyConfig `yaml:",inline"`
FqdnOnly FqdnOnlyConfig `yaml:"fqdnOnly"`
Filtering FilteringConfig `yaml:"filtering"`
Ede EdeConfig `yaml:"ede"`
// Deprecated
Expand Down
6 changes: 6 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ func defaultTestFileConfig() {
Expect(config.Blocking.BlockTTL).Should(Equal(Duration(time.Minute)))
Expect(config.Blocking.RefreshPeriod).Should(Equal(Duration(2 * time.Hour)))
Expect(config.Filtering.QueryTypes).Should(HaveLen(2))
Expect(config.FqdnOnly.Enable).Should(BeTrue())

Expect(config.Caching.MaxCachingTime.IsZero()).Should(BeTrue())
Expect(config.Caching.MinCachingTime.IsZero()).Should(BeTrue())
Expand Down Expand Up @@ -580,6 +581,8 @@ func writeConfigYml(tmpDir *helpertest.TmpFolder) *helpertest.TmpFile {
" queryTypes:",
" - AAAA",
" - A",
"fqdnOnly:",
" enable: true",
"blocking:",
" blackLists:",
" ads:",
Expand Down Expand Up @@ -617,6 +620,7 @@ func writeConfigYml(tmpDir *helpertest.TmpFolder) *helpertest.TmpFile {
"startVerifyUpstream: false")
}

//nolint:funlen
func writeConfigDir(tmpDir *helpertest.TmpFolder) error {
f1 := tmpDir.CreateStringFile("config1.yaml",
"upstream:",
Expand Down Expand Up @@ -668,6 +672,8 @@ func writeConfigDir(tmpDir *helpertest.TmpFolder) error {
" singleNameOrder:",
" - 2",
" - 1",
"fqdnOnly:",
" enable: true",
"queryLog:",
" type: csv-client",
" target: /opt/log",
Expand Down
6 changes: 6 additions & 0 deletions docs/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ minTlsServeVersion: 1.3
# if https port > 0: path to cert and key file for SSL encryption. if not set, self-signed certificate will be generated
#certFile: server.crt
#keyFile: server.key

# optional: use these DNS servers to resolve blacklist urls and upstream DNS servers. It is useful if no system DNS resolver is configured, and/or to encrypt the bootstrap queries.
bootstrapDns:
- tcp+udp:1.1.1.1
Expand All @@ -230,6 +231,11 @@ filtering:
queryTypes:
- AAAA

# optional: return NXDOMAIN for queries that are not FQDNs.
fqdnOnly:
# default: false
enable: true

# optional: if path defined, use this file for query resolution (A, AAAA and rDNS). Default: empty
hostsFile:
# optional: Path to hosts file (e.g. /etc/hosts on Linux)
Expand Down
3 changes: 2 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ Please be aware that by enabling it your hostname resolution will break unless e
!!! example

```yaml
fqdnOnly: true
fqdnOnly:
enable: true
```

## Custom DNS
Expand Down