* clients: move container object to "config"

Now the functions use parameter, not a global object.
This commit is contained in:
Simon Zolin
2019-07-09 18:19:50 +03:00
parent 1973901802
commit d51f43e27a
5 changed files with 81 additions and 78 deletions

View File

@@ -68,7 +68,7 @@ func isRunning() bool {
}
func beginAsyncRDNS(ip string) {
if clientExists(ip) {
if config.clients.Exists(ip) {
return
}
@@ -149,7 +149,7 @@ func asyncRDNSLoop() {
delete(dnsctx.rdnsIP, ip)
dnsctx.rdnsLock.Unlock()
_, _ = clientAddHost(ip, host, ClientSourceRDNS)
_, _ = config.clients.AddHost(ip, host, ClientSourceRDNS)
}
}
@@ -221,7 +221,7 @@ func generateServerConfig() (dnsforward.ServerConfig, error) {
// If a client has his own settings, apply them
func applyClientSettings(clientAddr string, setts *dnsfilter.RequestFilteringSettings) {
c, ok := clientFind(clientAddr)
c, ok := config.clients.Find(clientAddr)
if !ok || !c.UseOwnSettings {
return
}