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
|
APP=reseed-tools
|
||||||
USER_GH=eyedeekay
|
USER_GH=eyedeekay
|
||||||
CGO_ENABLED=0
|
CGO_ENABLED=0
|
||||||
|
2
main.go
2
main.go
@ -19,7 +19,7 @@ func main() {
|
|||||||
|
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "reseed-tools"
|
app.Name = "reseed-tools"
|
||||||
app.Version = "0.2.32"
|
app.Version = "0.2.33"
|
||||||
app.Usage = "I2P tools and reseed server"
|
app.Usage = "I2P tools and reseed server"
|
||||||
auth := &cli.Author{
|
auth := &cli.Author{
|
||||||
Name: "eyedeekay",
|
Name: "eyedeekay",
|
||||||
|
@ -97,7 +97,20 @@ var AllReseeds = []string{
|
|||||||
"https://www2.mk16.de/",
|
"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 {
|
func PingEverybody() []string {
|
||||||
|
if lastPing.After(yday()) {
|
||||||
|
log.Println("Your ping was rate-limited")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
lastPing = time.Now()
|
||||||
var nonerrs []string
|
var nonerrs []string
|
||||||
for _, urlInput := range AllReseeds {
|
for _, urlInput := range AllReseeds {
|
||||||
err := PingWriteContent(urlInput)
|
err := PingWriteContent(urlInput)
|
||||||
|
Reference in New Issue
Block a user