From 36f9ee958e2dce2cfae8dd580baaecb9a566babe Mon Sep 17 00:00:00 2001 From: "xin.li" Date: Mon, 18 Nov 2024 19:40:52 +0800 Subject: [PATCH] proxy/util: remove unused function Signed-off-by: xin.li --- pkg/proxy/util/utils.go | 5 ----- pkg/proxy/util/utils_test.go | 15 --------------- 2 files changed, 20 deletions(-) diff --git a/pkg/proxy/util/utils.go b/pkg/proxy/util/utils.go index 01d63eef132..320d19bc49b 100644 --- a/pkg/proxy/util/utils.go +++ b/pkg/proxy/util/utils.go @@ -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 { diff --git a/pkg/proxy/util/utils_test.go b/pkg/proxy/util/utils_test.go index 1f82de0fce9..1354844c5c3 100644 --- a/pkg/proxy/util/utils_test.go +++ b/pkg/proxy/util/utils_test.go @@ -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