aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dns-server.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/dns-server.go b/dns-server.go
index 197a17b..97e616b 100644
--- a/dns-server.go
+++ b/dns-server.go
@@ -10,6 +10,7 @@ import (
"os"
"regexp"
"strings"
+ "sync"
"time"
"github.com/miekg/dns"
@@ -75,6 +76,7 @@ const regTCPUDP string = "^(tcp|udp)$"
const ipONLY string = "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
var dataCH = make(map[string]string)
+var datamx = &sync.Mutex{}
var fakeAdd *string
func timeCh() {
@@ -155,7 +157,9 @@ func haveIT(domain string) (string, bool) {
}
if addr, ok := askUpstr(domain); ok {
+ datamx.Lock()
dataCH[domain] = addr
+ datamx.Unlock()
return addr, true
}
return "err", false

Snix LLC Git Repository Holder Copyright(C) 2022 All Rights Reserved Email To Snix.IR