1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00
cowyo/ratelimiter.go
Zack Scholl 041d674ddc CLI support! You can use curl (only curl at the moment) to
PUT files into the database.


Former-commit-id: 9c6d499403675cb28eb76676a73304e3acd2cc48 [formerly b30cad27b172756fdfcbf55d1e4c7542d90ca710] [formerly f2d936c586cb11525e36421c235bd1eb8909af3a [formerly efc27e723e7ffae0a898e8a59344fba9be0b4fd8 [formerly bd59a69f28]]]
Former-commit-id: c8f9d721fe83366a7545df693bbec7cdf376bf1b [formerly c97362f33772b2fc391d4705cc3d6eaf0f78f26b]
Former-commit-id: 31366a03506e761af053625496c662f675dfeb8d
Former-commit-id: 920ba22309
2016-03-28 20:19:13 -04:00

30 lines
377 B
Go
Executable File

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
}
}