mirror of
https://github.com/safing/portmaster
synced 2025-04-21 03:19:10 +00:00
28 lines
472 B
Go
28 lines
472 B
Go
package captain
|
|
|
|
import (
|
|
"net"
|
|
"sync"
|
|
)
|
|
|
|
var (
|
|
exceptionLock sync.Mutex
|
|
exceptIPv4 net.IP
|
|
exceptIPv6 net.IP
|
|
)
|
|
|
|
func setExceptions(ipv4, ipv6 net.IP) {
|
|
exceptionLock.Lock()
|
|
defer exceptionLock.Unlock()
|
|
|
|
exceptIPv4 = ipv4
|
|
exceptIPv6 = ipv6
|
|
}
|
|
|
|
// IsExcepted checks if the given IP is currently excepted from the SPN.
|
|
func IsExcepted(ip net.IP) bool {
|
|
exceptionLock.Lock()
|
|
defer exceptionLock.Unlock()
|
|
|
|
return ip.Equal(exceptIPv4) || ip.Equal(exceptIPv6)
|
|
}
|