mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-07 08:22:57 +03:00
cherry-pick: 4079 fix hosts container aliases
Merge in DNS/adguard-home from 4079-hosts-again to master
Updates #4079.
Squashed commit of the following:
commit 6aa8cbf32e8e47ba46bf5fba7681a10b68b4bc01
Merge: 19dba371 34c95f99
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Wed Jan 12 14:05:30 2022 +0500
Merge branch 'master' into 4079-hosts-again
commit 19dba371cc30ab8b75b0116833f4ecf0ef0f182f
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Wed Jan 12 14:05:20 2022 +0500
aghnet: imp docs
commit 9f341eb8ee4ba8468240bc3eeeb4951a3f7f5e6d
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Mon Jan 10 18:44:17 2022 +0500
aghnet: fix races
commit fd66191c7637c8584711e5bb8186494327ce0f87
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date: Thu Jan 6 17:21:14 2022 +0500
aghnet: fix hosts container aliases
This commit is contained in:
parent
69dcb4effd
commit
b9682c4f10
5 changed files with 314 additions and 177 deletions
internal/home
|
@ -783,12 +783,17 @@ func (clients *clientsContainer) addFromHostsFile(hosts *netutil.IPMap) {
|
|||
|
||||
n := 0
|
||||
hosts.Range(func(ip net.IP, v interface{}) (cont bool) {
|
||||
names, ok := v.(*stringutil.Set)
|
||||
hosts, ok := v.(*aghnet.Hosts)
|
||||
if !ok {
|
||||
log.Error("dns: bad type %T in ipToRC for %s", v, ip)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
names.Range(func(name string) (cont bool) {
|
||||
if clients.addHostLocked(ip, hosts.Main, ClientSourceHostsFile) {
|
||||
n++
|
||||
}
|
||||
hosts.Aliases.Range(func(name string) (cont bool) {
|
||||
if clients.addHostLocked(ip, name, ClientSourceHostsFile) {
|
||||
n++
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue