mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
bd59a69f28
PUT files into the database.
30 lines
377 B
Go
Executable File
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
|
|
}
|
|
}
|