Skip to content

Commit 6167fd8

Browse files
authored
fix(collector): fix dns collector limited to 63 chars (#1690)
1 parent 91bf024 commit 6167fd8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

pkg/collect/host_network.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ func isValidLoadBalancerAddress(address string) bool {
6565

6666
}
6767

68-
errs := validation.IsQualifiedName(hostAddress)
69-
68+
// Checking for DNS name for RFC1123, DNS1123SubdomainMaxLength int = 253
69+
errs := validation.IsDNS1123Subdomain(hostAddress)
7070
return len(errs) == 0
7171
}
7272

pkg/collect/host_network_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,13 @@ func Test_isValidLoadBalancerAddress(t *testing.T) {
4444
want: false,
4545
},
4646
{
47-
name: "Too many characters",
47+
name: "Valid long DNS domain but less than 255 characters, RFC1123 compliant",
4848
args: args{address: "howlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64.com:80"},
49+
want: true,
50+
},
51+
{
52+
name: "Non-valid long DNS domain but more than 255 characters, RFC1123 not compliant",
53+
args: args{address: "howlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64howlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64dssdfasdffs.com:80"},
4954
want: false,
5055
},
5156
{

0 commit comments

Comments
 (0)