- Better settings tree structure logged using `qdm12/gotree` - Read settings from environment variables, then files, then secret files - Settings methods to default them, merge them and override them - `DNS_PLAINTEXT_ADDRESS` default changed to `127.0.0.1` to use DoT. Warning added if set to something else. - `HTTPPROXY_LISTENING_ADDRESS` instead of `HTTPPROXY_PORT` (with retro-compatibility)
36 lines
955 B
Go
36 lines
955 B
Go
package dns
|
|
|
|
import "context"
|
|
|
|
func (l *Loop) updateFiles(ctx context.Context) (err error) {
|
|
l.logger.Info("downloading DNS over TLS cryptographic files")
|
|
if err := l.conf.SetupFiles(ctx); err != nil {
|
|
return err
|
|
}
|
|
settings := l.GetSettings()
|
|
|
|
unboundSettings, err := settings.DoT.Unbound.ToUnboundFormat()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
l.logger.Info("downloading hostnames and IP block lists")
|
|
blacklistSettings, err := settings.DoT.Blacklist.ToBlacklistFormat()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
blockedHostnames, blockedIPs, blockedIPPrefixes, errs :=
|
|
l.blockBuilder.All(ctx, blacklistSettings)
|
|
for _, err := range errs {
|
|
l.logger.Warn(err.Error())
|
|
}
|
|
|
|
// TODO change to BlockHostnames() when migrating to qdm12/dns v2
|
|
unboundSettings.Blacklist.FqdnHostnames = blockedHostnames
|
|
unboundSettings.Blacklist.IPs = blockedIPs
|
|
unboundSettings.Blacklist.IPPrefixes = blockedIPPrefixes
|
|
|
|
return l.conf.MakeUnboundConf(unboundSettings)
|
|
}
|