proxy/util: remove unused function

Signed-off-by: xin.li <xin.li@daocloud.io>
This commit is contained in:
xin.li 2024-11-18 19:40:52 +08:00
parent cf480a3a1a
commit 36f9ee958e
2 changed files with 0 additions and 20 deletions

View File

@ -41,11 +41,6 @@ const (
IPv6ZeroCIDR = "::/0"
)
// isValidEndpoint checks that the given host / port pair are valid endpoint
func isValidEndpoint(host string, port int) bool {
return host != "" && port > 0
}
// IsZeroCIDR checks whether the input CIDR string is either
// the IPv4 or IPv6 zero CIDR
func IsZeroCIDR(cidr string) bool {

View File

@ -27,21 +27,6 @@ import (
netutils "k8s.io/utils/net"
)
func TestValidateWorks(t *testing.T) {
if isValidEndpoint("", 0) {
t.Errorf("Didn't fail for empty set")
}
if isValidEndpoint("foobar", 0) {
t.Errorf("Didn't fail with invalid port")
}
if isValidEndpoint("foobar", -1) {
t.Errorf("Didn't fail with a negative port")
}
if !isValidEndpoint("foobar", 8080) {
t.Errorf("Failed a valid config.")
}
}
func TestShouldSkipService(t *testing.T) {
testCases := []struct {
service *v1.Service