mirror of
https://github.com/miekg/dns.git
synced 2025-10-11 01:41:00 +02:00
Remove radix from core go dns
This commit is contained in:
parent
45775dff76
commit
07d0e08366
12
server.go
12
server.go
@ -169,14 +169,14 @@ func (mux *ServeMux) match(q string, t uint16) Handler {
|
|||||||
defer mux.m.RUnlock()
|
defer mux.m.RUnlock()
|
||||||
var (
|
var (
|
||||||
handler Handler
|
handler Handler
|
||||||
lastdot int
|
lastdot int = -1
|
||||||
lastbyte byte
|
lastbyte byte
|
||||||
seendot bool = true
|
seendot bool = true
|
||||||
)
|
)
|
||||||
// TODO(mg): check for .
|
// TODO(mg): check for .
|
||||||
for i := 0; i < len(q); i++ {
|
for i := 0; i < len(q); i++ {
|
||||||
if seendot {
|
if seendot {
|
||||||
if h, ok := mux.z[q[lastdot:]]; ok {
|
if h, ok := mux.z[q[lastdot+1:]]; ok {
|
||||||
if t != TypeDS {
|
if t != TypeDS {
|
||||||
return h
|
return h
|
||||||
} else {
|
} else {
|
||||||
@ -194,10 +194,12 @@ func (mux *ServeMux) match(q string, t uint16) Handler {
|
|||||||
}
|
}
|
||||||
lastbyte = q[i]
|
lastbyte = q[i]
|
||||||
}
|
}
|
||||||
if handler != nil {
|
// Check for the root zone too, this only delays NXDOMAIN, because if we serve . it
|
||||||
return handler
|
// will be catched above.
|
||||||
|
if h, ok := mux.z["."]; ok {
|
||||||
|
return h
|
||||||
}
|
}
|
||||||
return nil
|
return handler
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle adds a handler to the ServeMux for pattern.
|
// Handle adds a handler to the ServeMux for pattern.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user