mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	pkg/proxy: use net.SplitHostPort instead of strings.Split
This commit is contained in:
		@@ -23,7 +23,6 @@ import (
 | 
				
			|||||||
	"net"
 | 
						"net"
 | 
				
			||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
	"strconv"
 | 
						"strconv"
 | 
				
			||||||
	"strings"
 | 
					 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
 | 
				
			||||||
@@ -57,11 +56,11 @@ func (impl LoadBalancerRR) LoadBalance(service string, srcAddr net.Addr) (string
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (impl LoadBalancerRR) IsValid(spec string) bool {
 | 
					func (impl LoadBalancerRR) IsValid(spec string) bool {
 | 
				
			||||||
	index := strings.Index(spec, ":")
 | 
						_, port, err := net.SplitHostPort(spec)
 | 
				
			||||||
	if index == -1 {
 | 
						if err != nil {
 | 
				
			||||||
		return false
 | 
							return false
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	value, err := strconv.Atoi(spec[index+1:])
 | 
						value, err := strconv.Atoi(port)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return false
 | 
							return false
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user