Skip to content

Commit

Permalink
fix: if string addr has not colon (#4045)
Browse files Browse the repository at this point in the history
Signed-off-by: fengxsong <fengxsong@outlook.com>
  • Loading branch information
fengxsong authored 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.