mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-04 12:09:19 +02:00
Convert domain names to lowercase before matching (#195)
Co-authored-by: RPRX <63339210+rprx@users.noreply.github.com>
This commit is contained in:
parent
0b4858d016
commit
5aa053a65f
|
@ -364,6 +364,7 @@ func (s *Server) lookupIPInternal(domain string, option IPOption) ([]net.IP, err
|
|||
if domain == "" {
|
||||
return nil, newError("empty domain name")
|
||||
}
|
||||
domain = strings.ToLower(domain)
|
||||
|
||||
// normalize the FQDN form query
|
||||
if domain[len(domain)-1] == '.' {
|
||||
|
|
|
@ -91,7 +91,7 @@ func (m *DomainMatcher) Apply(ctx routing.Context) bool {
|
|||
if len(domain) == 0 {
|
||||
return false
|
||||
}
|
||||
return m.ApplyDomain(domain)
|
||||
return m.ApplyDomain(strings.ToLower(domain))
|
||||
}
|
||||
|
||||
type MultiGeoIPMatcher struct {
|
||||
|
|
|
@ -102,7 +102,7 @@ func ReadClientHello(data []byte, h *SniffHeader) error {
|
|||
return errNotClientHello
|
||||
}
|
||||
if nameType == 0 {
|
||||
serverName := string(d[:nameLen])
|
||||
serverName := strings.ToLower(string(d[:nameLen]))
|
||||
// An SNI value may not include a
|
||||
// trailing dot. See
|
||||
// https://tools.ietf.org/html/rfc6066#section-3.
|
||||
|
|
|
@ -412,6 +412,8 @@ func (s *Server) fallback(ctx context.Context, sid errors.ExportOption, err erro
|
|||
newError("realName = " + name).AtInfo().WriteToLog(sid)
|
||||
newError("realAlpn = " + alpn).AtInfo().WriteToLog(sid)
|
||||
}
|
||||
name = strings.ToLower(name)
|
||||
alpn = strings.ToLower(alpn)
|
||||
|
||||
if len(napfb) > 1 || napfb[""] == nil {
|
||||
if name != "" && napfb[name] == nil {
|
||||
|
|
|
@ -232,6 +232,8 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection i
|
|||
newError("realName = " + name).AtInfo().WriteToLog(sid)
|
||||
newError("realAlpn = " + alpn).AtInfo().WriteToLog(sid)
|
||||
}
|
||||
name = strings.ToLower(name)
|
||||
alpn = strings.ToLower(alpn)
|
||||
|
||||
if len(napfb) > 1 || napfb[""] == nil {
|
||||
if name != "" && napfb[name] == nil {
|
||||
|
|
Loading…
Reference in New Issue