refactor - pasdns can now look sane
This commit is contained in:
parent
cc8322f221
commit
0be492aa87
7 changed files with 97 additions and 31 deletions
|
|
@ -1,11 +1,31 @@
|
|||
package parser
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"exhq.dev/pas/src/Constants"
|
||||
)
|
||||
|
||||
func CheckIpSyntax(ip string) bool {
|
||||
res, _ := regexp.MatchString(`^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$`, ip)
|
||||
return res
|
||||
}
|
||||
|
||||
func CheckDomainSyntax(domain string) bool {
|
||||
res, _ := regexp.MatchString(`[a-z0-9]{2,}\.(gaming|sex2|dev|meow|horse)`, domain)
|
||||
return res
|
||||
}
|
||||
|
||||
func CheckKeysExistDomain(m map[string]string) bool {
|
||||
for _, key := range []string{"domain", "ip"} {
|
||||
if _, ok := m[key]; !ok {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func ParseIntent(intent string) Constants.Intent {
|
||||
if intent == "" {
|
||||
return Constants.Intent{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue