mirror of
https://github.com/schollz/cowyo.git
synced 2023-08-10 21:13:00 +03:00
041d674ddc
PUT files into the database. Former-commit-id: 9c6d499403675cb28eb76676a73304e3acd2cc48 [formerly b30cad27b172756fdfcbf55d1e4c7542d90ca710] [formerly f2d936c586cb11525e36421c235bd1eb8909af3a [formerly efc27e723e7ffae0a898e8a59344fba9be0b4fd8 [formerlybd59a69f28
]]] Former-commit-id: c8f9d721fe83366a7545df693bbec7cdf376bf1b [formerly c97362f33772b2fc391d4705cc3d6eaf0f78f26b] Former-commit-id: 31366a03506e761af053625496c662f675dfeb8d Former-commit-id:920ba22309
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
|
|
}
|
|
}
|