don't forget to rate-limit the new ping feature, once per 24 hours
This commit is contained in:
2
Makefile
2
Makefile
@ -1,5 +1,5 @@
|
||||
|
||||
VERSION=0.2.32
|
||||
VERSION=0.2.33
|
||||
APP=reseed-tools
|
||||
USER_GH=eyedeekay
|
||||
CGO_ENABLED=0
|
||||
|
2
main.go
2
main.go
@ -19,7 +19,7 @@ func main() {
|
||||
|
||||
app := cli.NewApp()
|
||||
app.Name = "reseed-tools"
|
||||
app.Version = "0.2.32"
|
||||
app.Version = "0.2.33"
|
||||
app.Usage = "I2P tools and reseed server"
|
||||
auth := &cli.Author{
|
||||
Name: "eyedeekay",
|
||||
|
@ -97,7 +97,20 @@ var AllReseeds = []string{
|
||||
"https://www2.mk16.de/",
|
||||
}
|
||||
|
||||
func yday() time.Time {
|
||||
today := time.Now()
|
||||
yesterday := today.Add(-24 * time.Hour)
|
||||
return yesterday
|
||||
}
|
||||
|
||||
var lastPing = yday()
|
||||
|
||||
func PingEverybody() []string {
|
||||
if lastPing.After(yday()) {
|
||||
log.Println("Your ping was rate-limited")
|
||||
return nil
|
||||
}
|
||||
lastPing = time.Now()
|
||||
var nonerrs []string
|
||||
for _, urlInput := range AllReseeds {
|
||||
err := PingWriteContent(urlInput)
|
||||
|
Reference in New Issue
Block a user