Some domains not recognized
orcaman opened this issue · comments
Or Hiltch commented
Hi,
It seems some domains are deemed invalid by the validator, although they are in fact valid. Consider lactu.buzz
.
package main
import (
"github.com/alexanderritola/validate"
"github.com/alexanderritola/validate/web"
"log"
)
func main() {
domain := "lactu.buzz"
log.Printf("d: %v", DomainIsValid(domain))
}
func DomainIsValid(s string) bool {
v := validate.NewValidator()
domain :=
web.NewDomain(s).
SetMessage("Invalid domain specified!")
err := v.Validate(domain)
if err != nil {
log.Println(err.Error())
return false
} else {
return true
}
}
Prints:
2016/03/20 19:19:04 Error level 2: Unknown error
2016/03/20 19:19:04 d: false
Any idea?
Thanks
James Hartig commented
You have to do web.UpdateTLDs(tld.IANA)
in order to update the list of valid TLDs in the github.com/inhies/go-tld package