wip: migrate to mono-repo. SPN has already been moved to spn/

This commit is contained in:
Patrick Pacher
2024-03-15 11:55:13 +01:00
parent b30fd00ccf
commit 8579430db9
577 changed files with 35981 additions and 818 deletions

28
spn/captain/exceptions.go Normal file
View File

@@ -0,0 +1,28 @@
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)
}