diff --git a/pkg/provider/loadbalancer/iputil/internal/prefix.go b/pkg/provider/loadbalancer/iputil/internal/prefix.go index 91b6413d5f..96fee0abf9 100644 --- a/pkg/provider/loadbalancer/iputil/internal/prefix.go +++ b/pkg/provider/loadbalancer/iputil/internal/prefix.go @@ -1,9 +1,29 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package internal import ( "net/netip" ) +// ListAddresses returns all IP addresses contained within the given prefixes. +// Note: This function is not optimized for large address ranges. +// It may consume significant memory and perform poorly when listing +// a large number of addresses. Use with caution on large prefixes. func ListAddresses(prefixes ...netip.Prefix) []netip.Addr { var rv []netip.Addr for _, p := range prefixes { diff --git a/pkg/provider/loadbalancer/iputil/internal/prefix_test.go b/pkg/provider/loadbalancer/iputil/internal/prefix_test.go index c5795e677c..f422c2cad0 100644 --- a/pkg/provider/loadbalancer/iputil/internal/prefix_test.go +++ b/pkg/provider/loadbalancer/iputil/internal/prefix_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package internal import ( diff --git a/pkg/provider/loadbalancer/iputil/internal/prefixtree_test.go b/pkg/provider/loadbalancer/iputil/internal/prefixtree_test.go index 0b0c797932..e2ae5308f4 100644 --- a/pkg/provider/loadbalancer/iputil/internal/prefixtree_test.go +++ b/pkg/provider/loadbalancer/iputil/internal/prefixtree_test.go @@ -20,11 +20,12 @@ import ( "fmt" "math" "net/netip" - "sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer/fnutil" "sort" "testing" "github.com/stretchr/testify/assert" + + "sigs.k8s.io/cloud-provider-azure/pkg/provider/loadbalancer/fnutil" ) func Test_bitAt(t *testing.T) {