From 1508a826f24155dffae0638fec1e915b02faaf11 Mon Sep 17 00:00:00 2001 From: ivan katliarchuk Date: Fri, 24 Jan 2025 21:16:32 +0000 Subject: [PATCH] chore: improve canonicalHostedZone alog improvement. add comment Signed-off-by: ivan katliarchuk --- provider/aws/aws.go | 1 + 1 file changed, 1 insertion(+) diff --git a/provider/aws/aws.go b/provider/aws/aws.go index dd9611dc8..94f9b0d7d 100644 --- a/provider/aws/aws.go +++ b/provider/aws/aws.go @@ -1164,6 +1164,7 @@ func canonicalHostedZone(hostname string) string { // strings.HasSuffix is optimized for this specific task and avoids the overhead associated with compiling and executing a regular expression. if strings.HasSuffix(hostname, "aws.com") || strings.HasSuffix(hostname, "aws.com.cn") || strings.HasSuffix(hostname, "tor.com") || strings.HasSuffix(hostname, "ont.com") || strings.HasSuffix(hostname, "ont.net") { parts := strings.Split(hostname, ".") + // iterate from the second-last part (zone) towards the beginning for i := len(parts) - 2; i >= 0; i-- { suffix := strings.Join(parts[i:], ".") if zone, exists := canonicalHostedZones[suffix]; exists {