Skip to content

Commit

Permalink
[cherry-pick] fix: support IPv6 external address (#461)
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Yang <[email protected]>
  • Loading branch information
reaver-flomesh authored Nov 21, 2024
1 parent fbc2465 commit 66ea1f5
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions pkg/controllers/flb/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package flb

import (
"fmt"
"net"
"strings"

"github.com/flomesh-io/fsm/pkg/constants"
Expand Down Expand Up @@ -36,20 +35,20 @@ func lbIPs(addresses []string) []string {
return nil
}

ips := make([]string, 0)
for _, addr := range addresses {
if strings.Contains(addr, ":") {
host, _, err := net.SplitHostPort(addr)
if err != nil {
return nil
}
ips = append(ips, host)
} else {
ips = append(ips, addr)
}
}
//ips := make([]string, 0)
//for _, addr := range addresses {
// if strings.Contains(addr, ":") {
// host, _, err := net.SplitHostPort(addr)
// if err != nil {
// return nil
// }
// ips = append(ips, host)
// } else {
// ips = append(ips, addr)
// }
//}

return ips
return addresses
}

func getValidAlgo(value string) string {
Expand Down

0 comments on commit 66ea1f5

Please sign in to comment.