This commit is contained in:
mkelcik
2023-12-09 16:12:58 +01:00
parent 51958d719e
commit ecd2776a50
5 changed files with 113 additions and 1 deletions

26
internal/ignore_list.go Normal file
View File

@@ -0,0 +1,26 @@
package internal
import (
"net"
"regexp"
)
func checkAddress(address, pattern string) bool {
pattern = "^" + pattern + "$"
re := regexp.MustCompile(pattern)
return re.MatchString(address)
}
func IgnoredIpChange(ip net.IP, ignored []string) bool {
if len(ignored) == 0 {
return false
}
for _, i := range ignored {
if checkAddress(ip.String(), i) {
return true
}
}
return false
}