Pull request 2153: 6610-hostsfile-enabled
Updates #6610.
Squashed commit of the following:
commit 13522f0768fe0a4f6abe3fc82ffb7ddf3f4df9bf
Merge: befa3bd1d 6fd0a624c
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Wed Feb 21 12:53:08 2024 +0300
Merge branch 'master' into 6610-hostsfile-enabled
commit befa3bd1dedcd2853ef299c06d5c14c9ed7f2c84
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Mon Feb 19 15:56:20 2024 +0300
all: upd chlog
commit c1954306fe7c4d7af164f599b298374ab983216f
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Thu Feb 15 20:52:52 2024 +0300
home: hostsfile enabled
This commit is contained in:
parent
6fd0a624ca
commit
4605e7c90e
|
@ -30,6 +30,8 @@ NOTE: Add new changes BELOW THIS COMMENT.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- Ability to disable the use of system hosts file information for query
|
||||||
|
resolution ([#6610]).
|
||||||
- Ability to define custom directories for storage of query log files and
|
- Ability to define custom directories for storage of query log files and
|
||||||
statistics ([#5992]).
|
statistics ([#5992]).
|
||||||
- Context menu item in the Query Log to add a Client to the Persistent client
|
- Context menu item in the Query Log to add a Client to the Persistent client
|
||||||
|
@ -66,6 +68,7 @@ NOTE: Add new changes BELOW THIS COMMENT.
|
||||||
- Go 1.20 support, as it has reached end of life.
|
- Go 1.20 support, as it has reached end of life.
|
||||||
|
|
||||||
[#5992]: https://github.com/AdguardTeam/AdGuardHome/issues/5992
|
[#5992]: https://github.com/AdguardTeam/AdGuardHome/issues/5992
|
||||||
|
[#6610]: https://github.com/AdguardTeam/AdGuardHome/issues/6610
|
||||||
[#6679]: https://github.com/AdguardTeam/AdGuardHome/issues/6679
|
[#6679]: https://github.com/AdguardTeam/AdGuardHome/issues/6679
|
||||||
[#6711]: https://github.com/AdguardTeam/AdGuardHome/issues/6711
|
[#6711]: https://github.com/AdguardTeam/AdGuardHome/issues/6711
|
||||||
|
|
||||||
|
|
|
@ -232,6 +232,10 @@ type dnsConfig struct {
|
||||||
|
|
||||||
// ServePlainDNS defines if plain DNS is allowed for incoming requests.
|
// ServePlainDNS defines if plain DNS is allowed for incoming requests.
|
||||||
ServePlainDNS bool `yaml:"serve_plain_dns"`
|
ServePlainDNS bool `yaml:"serve_plain_dns"`
|
||||||
|
|
||||||
|
// HostsFileEnabled defines whether to use information from the system hosts
|
||||||
|
// file to resolve queries.
|
||||||
|
HostsFileEnabled bool `yaml:"hostsfile_enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type tlsConfigSettings struct {
|
type tlsConfigSettings struct {
|
||||||
|
@ -349,9 +353,10 @@ var config = &configuration{
|
||||||
// was later increased to 300 due to https://github.com/AdguardTeam/AdGuardHome/issues/2257
|
// was later increased to 300 due to https://github.com/AdguardTeam/AdGuardHome/issues/2257
|
||||||
MaxGoroutines: 300,
|
MaxGoroutines: 300,
|
||||||
},
|
},
|
||||||
UpstreamTimeout: timeutil.Duration{Duration: dnsforward.DefaultTimeout},
|
UpstreamTimeout: timeutil.Duration{Duration: dnsforward.DefaultTimeout},
|
||||||
UsePrivateRDNS: true,
|
UsePrivateRDNS: true,
|
||||||
ServePlainDNS: true,
|
ServePlainDNS: true,
|
||||||
|
HostsFileEnabled: true,
|
||||||
},
|
},
|
||||||
TLS: tlsConfigSettings{
|
TLS: tlsConfigSettings{
|
||||||
PortHTTPS: defaultPortHTTPS,
|
PortHTTPS: defaultPortHTTPS,
|
||||||
|
|
|
@ -361,7 +361,7 @@ func setupDNSFilteringConf(conf *filtering.Config) (err error) {
|
||||||
|
|
||||||
conf.EtcHosts = Context.etcHosts
|
conf.EtcHosts = Context.etcHosts
|
||||||
// TODO(s.chzhen): Use empty interface.
|
// TODO(s.chzhen): Use empty interface.
|
||||||
if Context.etcHosts == nil {
|
if Context.etcHosts == nil || !config.DNS.HostsFileEnabled {
|
||||||
conf.EtcHosts = nil
|
conf.EtcHosts = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,15 +270,17 @@ var cmdLineOpts = []cmdLineOpt{{
|
||||||
log.Info(
|
log.Info(
|
||||||
"warning: --no-etc-hosts flag is deprecated " +
|
"warning: --no-etc-hosts flag is deprecated " +
|
||||||
"and will be removed in the future versions; " +
|
"and will be removed in the future versions; " +
|
||||||
"set clients.runtime_sources.hosts in the configuration file to false instead",
|
"set clients.runtime_sources.hosts and dns.hostsfile_enabled " +
|
||||||
|
"in the configuration file to false instead",
|
||||||
)
|
)
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
},
|
},
|
||||||
serialize: func(o options) (val string, ok bool) { return "", o.noEtcHosts },
|
serialize: func(o options) (val string, ok bool) { return "", o.noEtcHosts },
|
||||||
description: "Deprecated: use clients.runtime_sources.hosts instead. Do not use the OS-provided hosts.",
|
description: "Deprecated: use clients.runtime_sources.hosts and dns.hostsfile_enabled " +
|
||||||
longName: "no-etc-hosts",
|
"instead. Do not use the OS-provided hosts.",
|
||||||
shortName: "",
|
longName: "no-etc-hosts",
|
||||||
|
shortName: "",
|
||||||
}, {
|
}, {
|
||||||
updateWithValue: nil,
|
updateWithValue: nil,
|
||||||
updateNoValue: func(o options) (options, error) { o.localFrontend = true; return o, nil },
|
updateNoValue: func(o options) (options, error) { o.localFrontend = true; return o, nil },
|
||||||
|
|
Loading…
Reference in New Issue