mirror of
https://git.ptzo.gdn/feditools/relay.git
synced 2024-09-21 23:07:12 +00:00
31 lines
494 B
Go
31 lines
494 B
Go
package util
|
|
|
|
func ValidateDomainObfuscation(domain, obfuscationDomain string) bool {
|
|
if len([]rune(domain)) != len([]rune(obfuscationDomain)) {
|
|
return false
|
|
}
|
|
|
|
for i := 0; i < len([]rune(domain)); i++ {
|
|
dRune := []rune(domain)[i]
|
|
odRune := []rune(obfuscationDomain)[i]
|
|
|
|
switch dRune {
|
|
case '.':
|
|
if odRune != '.' {
|
|
return false
|
|
}
|
|
default:
|
|
switch odRune {
|
|
case dRune:
|
|
continue
|
|
case '*':
|
|
continue
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
|
|
return true
|
|
}
|