Fix: satisfy RFC4343 - DNS case insensitivity (#2260)

This commit is contained in:
bobo liu
2022-08-12 13:47:51 +08:00
committed by GitHub
parent 50105f0559
commit 71cad51e8f
2 changed files with 25 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package fakeip
import (
"errors"
"net"
"strings"
"sync"
"github.com/Dreamacro/clash/common/cache"
@ -36,6 +37,9 @@ type Pool struct {
func (p *Pool) Lookup(host string) net.IP {
p.mux.Lock()
defer p.mux.Unlock()
// RFC4343: DNS Case Insensitive, we SHOULD return result with all cases.
host = strings.ToLower(host)
if ip, exist := p.store.GetByHost(host); exist {
return ip
}