fix: connection address resolution
release / release (push) Successful in 39s

This commit is contained in:
Artёm Mishin committed 2024-02-03 08:11:18 +03:00
1 parent e372ef336d
commit 1c8dd338f8
2 files changed
+8 -1

No files matched your search

+7 -1
View File
@@ -409,7 +409,13 @@ func listen(addr string) {
}
// check is ip
ip := net.ParseIP(remoteAddr.String())
remoteAddrStr := remoteAddr.String()
// remove port with IPv6 support
if strings.Contains(remoteAddrStr, ":") {
remoteAddrStr = remoteAddrStr[:strings.LastIndex(remoteAddrStr, ":")]
}
ip := net.ParseIP(remoteAddrStr)
if ip == nil {
log.Warnf("Got request from non-IP %s, ignoring request", remoteAddr)
_ = conn.Close()