Add first version of gemini-grc.

This commit is contained in:
2024-12-27 12:09:55 +02:00
parent 93822b239e
commit b52df073e9
30 changed files with 2754 additions and 0 deletions

28
gemini/connectionPool.go Normal file
View File

@@ -0,0 +1,28 @@
package gemini
import (
"gemini-grc/logging"
)
var IPPool = IpAddressPool{IPs: make(map[string]int)}
func AddIPsToPool(ips []string) {
IPPool.Lock.Lock()
for _, ip := range ips {
logging.LogDebug("Adding %s to pool", ip)
IPPool.IPs[ip] = 1
}
IPPool.Lock.Unlock()
}
func RemoveIPsFromPool(IPs []string) {
IPPool.Lock.Lock()
for _, ip := range IPs {
_, ok := IPPool.IPs[ip]
if ok {
logging.LogDebug("Removing %s from pool", ip)
delete(IPPool.IPs, ip)
}
}
IPPool.Lock.Unlock()
}