Skip to content

Commit

Permalink
fix(collector): fix dns collector limited to 63 chars (#1690)
Browse files Browse the repository at this point in the history
  • Loading branch information
DexterYan authored Nov 19, 2024
1 parent 91bf024 commit 6167fd8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/collect/host_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ func isValidLoadBalancerAddress(address string) bool {

}

errs := validation.IsQualifiedName(hostAddress)

// Checking for DNS name for RFC1123, DNS1123SubdomainMaxLength int = 253
errs := validation.IsDNS1123Subdomain(hostAddress)
return len(errs) == 0
}

Expand Down
7 changes: 6 additions & 1 deletion pkg/collect/host_network_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ func Test_isValidLoadBalancerAddress(t *testing.T) {
want: false,
},
{
name: "Too many characters",
name: "Valid long DNS domain but less than 255 characters, RFC1123 compliant",
args: args{address: "howlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64.com:80"},
want: true,
},
{
name: "Non-valid long DNS domain but more than 255 characters, RFC1123 not compliant",
args: args{address: "howlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64howlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64dssdfasdffs.com:80"},
want: false,
},
{
Expand Down

0 comments on commit 6167fd8

Please sign in to comment.