diff options
| author | blackdobb <64015779+blackdobb@users.noreply.github.com> | 2021-08-20 16:19:38 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-20 16:19:38 +0800 |
| commit | d2cbad777ae00a444e193a18a3cbbc00a7317d33 (patch) | |
| tree | a121076db1e8fb518e4c80ffd3b5b90374358284 /cloud/cmd | |
| parent | sync the response message unconditionally (#3014) (diff) | |
| download | kubeedge-d2cbad777ae00a444e193a18a3cbbc00a7317d33.tar.gz | |
add the validation of hostname due to the problem caused by long name (#3044)
Signed-off-by: blackdobb <xinxin.wan@daocloud.io>
Diffstat (limited to 'cloud/cmd')
| -rw-r--r-- | cloud/cmd/cloudcore/app/server.go | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/cloud/cmd/cloudcore/app/server.go b/cloud/cmd/cloudcore/app/server.go index ae41ba604..7d1890eca 100644 --- a/cloud/cmd/cloudcore/app/server.go +++ b/cloud/cmd/cloudcore/app/server.go @@ -6,7 +6,6 @@ import ( "errors" "fmt" "math/rand" - "os" "time" "github.com/spf13/cobra" @@ -145,7 +144,8 @@ func NegotiateTunnelPort() (*int, error) { return nil, err } - localIP := getLocalIP() + hostnameOverride := util.GetHostname() + localIP, _ := util.GetLocalIP(hostnameOverride) var record iptables.TunnelPortRecord if err == nil { @@ -227,12 +227,3 @@ func negotiatePort(portRecord map[int]bool) int { } } } - -func getLocalIP() string { - hostnameOverride, err := os.Hostname() - if err != nil { - hostnameOverride = constants.DefaultHostnameOverride - } - localIP, _ := util.GetLocalIP(hostnameOverride) - return localIP -} |
