Implement basic auth

This commit is contained in:
Dominic Ferrando
2025-04-23 14:13:43 -04:00
parent 4018632080
commit a559aaebf4
11 changed files with 242 additions and 6 deletions
+3 -4
View File
@@ -15,7 +15,7 @@ var (
ThreadCooldowns = make(map[string]time.Time)
)
var CooldownMutex sync.Mutex
var CooldownMutex sync.RWMutex
const POST_COOLDOWN = 15 * time.Second
@@ -26,10 +26,9 @@ const THREAD_COOLDOWN = 2 * time.Minute
// const THREAD_COOLDOWN = 0 * time.Minute
func GetRemainingCooldown(ip string, m map[string]time.Time, duration time.Duration) time.Duration {
CooldownMutex.Lock()
defer CooldownMutex.Unlock()
CooldownMutex.RLock()
last, exists := m[ip]
CooldownMutex.RUnlock()
if !exists {
return 0
}