Skip to content

Commit

Permalink
Handle IPv6 in isMovedError
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddzxy committed Apr 25, 2024
1 parent 90c7a41 commit cbb06f2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,18 @@ func isMovedError(err error) (moved bool, ask bool, addr string) {
if ind == -1 {
return false, false, ""
}

addr = s[ind+1:]
ind = strings.LastIndex(addr, ":")
if ind == -1 {
return false, false, ""
}

if string(addr[ind-1]) == "]" {
return
}

addr = net.JoinHostPort(addr[:ind], addr[ind+1:])
return
}

Expand Down

0 comments on commit cbb06f2

Please sign in to comment.