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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user