Reinforced domain regex match
This commit is contained in:
parent
5c651bacf3
commit
61f68d2b27
2
hosts.go
2
hosts.go
|
@ -145,7 +145,7 @@ func (f *FileHosts) isDomain(domain string) bool {
|
||||||
if f.isIP(domain) {
|
if f.isIP(domain) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
match, _ := regexp.MatchString("^[a-zA-Z0-9][a-zA-Z0-9-]", domain)
|
match, _ := regexp.MatchString(`^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$`, domain)
|
||||||
return match
|
return match
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue