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 24, 2024
1 parent 90c7a41 commit 5b564d4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,14 @@ 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, ""
}

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

Expand Down

0 comments on commit 5b564d4

Please sign in to comment.