1
0
mirror of https://github.com/redis/go-redis.git synced 2025-06-15 12:41:41 +03:00

Handle IPv6 in isMovedError (#2981)

* Handle IPv6 in isMovedError

* Simplify GetAddr

---------

Co-authored-by: Monkey <golang@88.com>
This commit is contained in:
Dávid Baláž
2024-04-28 06:37:44 +02:00
committed by GitHub
parent fa9edecebc
commit b64d9deef3
3 changed files with 41 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import (
"net"
"strings"
"github.com/redis/go-redis/v9/internal"
"github.com/redis/go-redis/v9/internal/pool"
"github.com/redis/go-redis/v9/internal/proto"
)
@ -129,7 +130,9 @@ func isMovedError(err error) (moved bool, ask bool, addr string) {
if ind == -1 {
return false, false, ""
}
addr = s[ind+1:]
addr = internal.GetAddr(addr)
return
}