Make DNS queries case insensitive (#793)

This commit is contained in:
John Maguire 2022-12-20 16:59:11 -05:00 committed by GitHub
parent b7e73da943
commit c44da3abee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"net"
"strconv"
"strings"
"sync"
"github.com/miekg/dns"
@ -33,11 +34,10 @@ func newDnsRecords(hostMap *HostMap) *dnsRecords {
func (d *dnsRecords) Query(data string) string {
d.RLock()
if r, ok := d.dnsMap[data]; ok {
d.RUnlock()
defer d.RUnlock()
if r, ok := d.dnsMap[strings.ToLower(data)]; ok {
return r
}
d.RUnlock()
return ""
}
@ -62,8 +62,8 @@ func (d *dnsRecords) QueryCert(data string) string {
func (d *dnsRecords) Add(host, data string) {
d.Lock()
d.dnsMap[host] = data
d.Unlock()
defer d.Unlock()
d.dnsMap[strings.ToLower(host)] = data
}
func parseQuery(l *logrus.Logger, m *dns.Msg, w dns.ResponseWriter) {