mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-08 00:33:00 +03:00
Pull request: all: add string set
Merge in DNS/adguard-home from add-strset to master Squashed commit of the following: commit 2500df1805dee425eafd0503983ec631de02af0b Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Apr 20 15:09:59 2021 +0300 all: add string set
This commit is contained in:
parent
71030bafd8
commit
93638a1936
9 changed files with 100 additions and 125 deletions
internal/home
|
@ -83,7 +83,7 @@ type clientsContainer struct {
|
|||
ipToRC map[string]*RuntimeClient // IP -> runtime client
|
||||
lock sync.Mutex
|
||||
|
||||
allTags map[string]bool
|
||||
allTags *aghstrings.Set
|
||||
|
||||
// dhcpServer is used for looking up clients IP addresses by MAC addresses
|
||||
dhcpServer *dhcpd.Server
|
||||
|
@ -111,10 +111,7 @@ func (clients *clientsContainer) Init(
|
|||
clients.idIndex = make(map[string]*Client)
|
||||
clients.ipToRC = make(map[string]*RuntimeClient)
|
||||
|
||||
clients.allTags = make(map[string]bool)
|
||||
for _, t := range clientTags {
|
||||
clients.allTags[t] = false
|
||||
}
|
||||
clients.allTags = aghstrings.NewSet(clientTags...)
|
||||
|
||||
clients.dhcpServer = dhcpServer
|
||||
clients.etcHosts = etcHosts
|
||||
|
@ -163,9 +160,8 @@ type clientObject struct {
|
|||
Upstreams []string `yaml:"upstreams"`
|
||||
}
|
||||
|
||||
func (clients *clientsContainer) tagKnown(tag string) bool {
|
||||
_, ok := clients.allTags[tag]
|
||||
return ok
|
||||
func (clients *clientsContainer) tagKnown(tag string) (ok bool) {
|
||||
return clients.allTags.Has(tag)
|
||||
}
|
||||
|
||||
func (clients *clientsContainer) addFromConfig(objects []clientObject) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue