Files
ddns-updater/internal/ignore_list.go

27 lines
402 B
Go
Raw Normal View History

2023-12-09 16:12:58 +01:00
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
}