Xray-core/transport/internet/internet.go

19 lines
340 B
Go
Raw Normal View History

2020-11-25 11:01:53 +00:00
package internet
import (
"net"
"strings"
)
2020-12-04 01:36:16 +00:00
//go:generate go run github.com/xtls/xray-core/common/errors/errorgen
func IsValidHTTPHost(request string, config string) bool {
r := strings.ToLower(request)
c := strings.ToLower(config)
if strings.Contains(r, ":") {
h, _, _ := net.SplitHostPort(r)
return h == c
}
return r == c
}