From 2cfe5471e4250035f29efe8e7c2d85d7a89676cb Mon Sep 17 00:00:00 2001 From: dsy3502 Date: Wed, 22 Dec 2021 23:35:14 +0800 Subject: [PATCH] Separator = replaced by cons (#692) Separator = replaced by cons Separator = replaced by cons Co-authored-by: dsy3502 --- pkg/yurttunnel/util/util.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/yurttunnel/util/util.go b/pkg/yurttunnel/util/util.go index 9cf7fc87c40..e0586ba5a63 100644 --- a/pkg/yurttunnel/util/util.go +++ b/pkg/yurttunnel/util/util.go @@ -44,6 +44,7 @@ const ( yurttunnelServerHTTPProxyPorts = "http-proxy-ports" yurttunnelServerHTTPSProxyPorts = "https-proxy-ports" PortsSeparator = "," + PortPairSeparator = "=" KubeletHTTPSPort = "10250" KubeletHTTPPort = "10255" @@ -146,12 +147,12 @@ func resolvePorts(portsStr, insecurePort string) []string { return ports } - isPortPair := strings.Contains(portsStr, "=") + isPortPair := strings.Contains(portsStr, PortPairSeparator) parts := strings.Split(portsStr, PortsSeparator) for _, port := range parts { var proxyPort string if isPortPair { - subParts := strings.Split(port, "=") + subParts := strings.Split(port, PortPairSeparator) if len(subParts) == 2 && strings.TrimSpace(subParts[1]) == insecurePort { proxyPort = strings.TrimSpace(subParts[0]) }