1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/ratelimiter.go
Zack Scholl 0f34d342d8 Removed extraneous fmt.
Former-commit-id: e14a3f63333e04d7dd36445af59971bf4483e38c [formerly 0d230b0ee7017a88627c3829cb3e25723ce16909] [formerly 448638670a680e4e7d69b43ee8024a9cb09dc743 [formerly 83cc0422e5bbc0f4ee0e5c5d7ca7697a31382549 [formerly 3f3cc1f41a]]]
Former-commit-id: e8c31b3325d1b75a4b18bb9bcf842a00f5cf6ee8 [formerly 52fba3f6529f7271ed2f3ab3f9c7174acb8276c7]
Former-commit-id: 1db89f1ce6fe1d62f73c71baabb01500b9ec0117
Former-commit-id: e9f97aa384
2016-03-28 20:21:06 -04:00

26 lines
332 B
Go
Executable File

package main
import "time"
var bannedIPs []string
func init() {
go clearBannedIPs()
}
func clearBannedIPs() {
for {
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
}
}