use svchost.IsValid for FriendlyHost.Valid
This commit is contained in:
parent
54c5aab7ef
commit
0a673fa5ef
|
@ -95,16 +95,7 @@ func ParseFriendlyHost(source string) (host *FriendlyHost, rest string) {
|
||||||
// name specifications. Not that IDN prefixes containing punycode are not valid
|
// name specifications. Not that IDN prefixes containing punycode are not valid
|
||||||
// input which we expect to always be in user-input or normalised display form.
|
// input which we expect to always be in user-input or normalised display form.
|
||||||
func (h *FriendlyHost) Valid() bool {
|
func (h *FriendlyHost) Valid() bool {
|
||||||
if h.Display() == InvalidHostString {
|
return svchost.IsValid(h.Raw)
|
||||||
return false
|
|
||||||
}
|
|
||||||
if h.Normalized() == InvalidHostString {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if containsPuny(h.Raw) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display returns the host formatted for display to the user in CLI or web
|
// Display returns the host formatted for display to the user in CLI or web
|
||||||
|
|
Loading…
Reference in New Issue