1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

CLI support! You can use curl (only curl at the moment) to

PUT files into the database.
This commit is contained in:
Zack Scholl
2016-03-28 20:19:13 -04:00
parent f6c287ba24
commit bd59a69f28
4 changed files with 58 additions and 5 deletions

29
ratelimiter.go Executable file
View File

@@ -0,0 +1,29 @@
package main
import (
"fmt"
"time"
)
var bannedIPs []string
func init() {
go clearBannedIPs()
}
func clearBannedIPs() {
for {
fmt.Println("CLEARING IPS!!")
bannedIPs = []string{}
time.Sleep(3 * time.Minute)
}
}
func isIPBanned(ip string) bool {
if stringInSlice(ip, bannedIPs) {
return true
} else {
bannedIPs = append(bannedIPs, ip)
return false
}
}