diff --git a/pkg/collect/host_network.go b/pkg/collect/host_network.go index 519849d47..5cdc2a589 100644 --- a/pkg/collect/host_network.go +++ b/pkg/collect/host_network.go @@ -66,16 +66,12 @@ func isValidLoadBalancerAddress(address string) bool { } - errs := validation.IsQualifiedName(hostAddress) - if len(errs) > 0 { - if len(hostAddress) < 255 { - err := validator.New().Var(hostAddress, "hostname_rfc1123") - return err == nil - } else { - return false - } + if len(hostAddress) > 255 { + return false } - return len(errs) == 0 + + err = validator.New().Var(hostAddress, "hostname") + return err == nil } func checkTCPConnection(progressChan chan<- interface{}, listenAddress string, dialAddress string, timeout time.Duration) (NetworkStatus, error) { diff --git a/pkg/collect/host_network_test.go b/pkg/collect/host_network_test.go index 385b849a4..65c416934 100644 --- a/pkg/collect/host_network_test.go +++ b/pkg/collect/host_network_test.go @@ -44,18 +44,13 @@ func Test_isValidLoadBalancerAddress(t *testing.T) { want: false, }, { - name: "Too many characters less than 64, rfc1123 not compliant", - args: args{address: "howlongcanwemakethiswithoutrunningoutofwordsbecasueweneedto.com:80"}, - want: false, - }, - { - name: "Too many characters less than 64, rfc1123 compliant", - args: args{address: "howlongcanwemakethiswithoutrunningoutofwordsbecasueweneedto.aws.com:80"}, + name: "Too many characters less than 255", + args: args{address: "howlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64.com:80"}, want: true, }, { name: "Too many characters bigger than 255", - args: args{address: "howlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64howlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64.com:80"}, + args: args{address: "howlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64howlongcanwemakethiswithouthowlongcanwemakethiswithouthowlongcanwemakethiswithoutrunningoutofwordsbecasueweneedtohitatleast64dssdfasdffs.com:80"}, want: false, }, {