Skip to content

Commit

Permalink
fix: if string addr has not colon (labring#4045)
Browse files Browse the repository at this point in the history
Signed-off-by: fengxsong <[email protected]>
  • Loading branch information
fengxsong committed Oct 9, 2023
1 parent de95395 commit 25e08fd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/labring/sealos/pkg/ssh"
"github.com/labring/sealos/pkg/unshare"
fileutil "github.com/labring/sealos/pkg/utils/file"
"github.com/labring/sealos/pkg/utils/iputils"
"github.com/labring/sealos/pkg/utils/logger"
netutil "github.com/labring/sealos/pkg/utils/net"
)
Expand Down Expand Up @@ -138,10 +139,7 @@ func (w *wrap) isLocal(addr string) bool {
if unshare.IsRootless() {
return false
}
host, _, err := net.SplitHostPort(addr)
if err != nil {
return false
}
host := iputils.GetHostIP(addr)
if host == "localhost" || host == "127.0.0.1" || w.localAddresses.Has(host) {
return true
}
Expand Down

0 comments on commit 25e08fd

Please sign in to comment.