fix: configuration for FQDN only resolver (#1025)

This commit is contained in:
ThinkChaos 2023-05-15 10:24:07 -04:00 committed by GitHub
parent 1b478d047a
commit 795f3ddf93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 2 deletions

View File

@ -178,7 +178,7 @@ type Config struct {
KeyFile string `yaml:"keyFile"` KeyFile string `yaml:"keyFile"`
BootstrapDNS BootstrapDNSConfig `yaml:"bootstrapDns"` BootstrapDNS BootstrapDNSConfig `yaml:"bootstrapDns"`
HostsFile HostsFileConfig `yaml:"hostsFile"` HostsFile HostsFileConfig `yaml:"hostsFile"`
FqdnOnly FqdnOnlyConfig `yaml:",inline"` FqdnOnly FqdnOnlyConfig `yaml:"fqdnOnly"`
Filtering FilteringConfig `yaml:"filtering"` Filtering FilteringConfig `yaml:"filtering"`
Ede EdeConfig `yaml:"ede"` Ede EdeConfig `yaml:"ede"`
// Deprecated // Deprecated

View File

@ -550,6 +550,7 @@ func defaultTestFileConfig() {
Expect(config.Blocking.BlockTTL).Should(Equal(Duration(time.Minute))) Expect(config.Blocking.BlockTTL).Should(Equal(Duration(time.Minute)))
Expect(config.Blocking.RefreshPeriod).Should(Equal(Duration(2 * time.Hour))) Expect(config.Blocking.RefreshPeriod).Should(Equal(Duration(2 * time.Hour)))
Expect(config.Filtering.QueryTypes).Should(HaveLen(2)) Expect(config.Filtering.QueryTypes).Should(HaveLen(2))
Expect(config.FqdnOnly.Enable).Should(BeTrue())
Expect(config.Caching.MaxCachingTime.IsZero()).Should(BeTrue()) Expect(config.Caching.MaxCachingTime.IsZero()).Should(BeTrue())
Expect(config.Caching.MinCachingTime.IsZero()).Should(BeTrue()) Expect(config.Caching.MinCachingTime.IsZero()).Should(BeTrue())
@ -580,6 +581,8 @@ func writeConfigYml(tmpDir *helpertest.TmpFolder) *helpertest.TmpFile {
" queryTypes:", " queryTypes:",
" - AAAA", " - AAAA",
" - A", " - A",
"fqdnOnly:",
" enable: true",
"blocking:", "blocking:",
" blackLists:", " blackLists:",
" ads:", " ads:",
@ -617,6 +620,7 @@ func writeConfigYml(tmpDir *helpertest.TmpFolder) *helpertest.TmpFile {
"startVerifyUpstream: false") "startVerifyUpstream: false")
} }
//nolint:funlen
func writeConfigDir(tmpDir *helpertest.TmpFolder) error { func writeConfigDir(tmpDir *helpertest.TmpFolder) error {
f1 := tmpDir.CreateStringFile("config1.yaml", f1 := tmpDir.CreateStringFile("config1.yaml",
"upstream:", "upstream:",
@ -668,6 +672,8 @@ func writeConfigDir(tmpDir *helpertest.TmpFolder) error {
" singleNameOrder:", " singleNameOrder:",
" - 2", " - 2",
" - 1", " - 1",
"fqdnOnly:",
" enable: true",
"queryLog:", "queryLog:",
" type: csv-client", " type: csv-client",
" target: /opt/log", " target: /opt/log",

View File

@ -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 # 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 #certFile: server.crt
#keyFile: server.key #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. # 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: bootstrapDns:
- tcp+udp:1.1.1.1 - tcp+udp:1.1.1.1
@ -230,6 +231,11 @@ filtering:
queryTypes: queryTypes:
- AAAA - 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 # optional: if path defined, use this file for query resolution (A, AAAA and rDNS). Default: empty
hostsFile: hostsFile:
# optional: Path to hosts file (e.g. /etc/hosts on Linux) # optional: Path to hosts file (e.g. /etc/hosts on Linux)

View File

@ -195,7 +195,8 @@ Please be aware that by enabling it your hostname resolution will break unless e
!!! example !!! example
```yaml ```yaml
fqdnOnly: true fqdnOnly:
enable: true
``` ```
## Custom DNS ## Custom DNS