Reinforced domain regex match
This commit is contained in:
		
							
								
								
									
										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
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user