Merge branch 'dev' of https://github.com/Dreamacro/clash into Alpha

This commit is contained in:
wwqgtxx
2022-11-12 20:43:48 +08:00
51 changed files with 641 additions and 742 deletions

View File

@ -3,6 +3,7 @@ package fakeip
import (
"errors"
"net/netip"
"strings"
"sync"
"github.com/Dreamacro/clash/common/nnip"
@ -26,7 +27,7 @@ type store interface {
FlushFakeIP() error
}
// Pool is a implementation about fake ip generator without storage
// Pool is an implementation about fake ip generator without storage
type Pool struct {
gateway netip.Addr
first netip.Addr
@ -43,6 +44,9 @@ type Pool struct {
func (p *Pool) Lookup(host string) netip.Addr {
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
}