updated how to handle latest geoip tags
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2023-01-14 20:50:06 +01:00
parent 3f8a7d5d6e
commit f0612534a3

View File

@ -7,6 +7,7 @@ import (
"log" "log"
"net/http" "net/http"
"os" "os"
"sort"
"strings" "strings"
geoip2 "github.com/oschwald/geoip2-golang" geoip2 "github.com/oschwald/geoip2-golang"
@ -31,7 +32,14 @@ func GetLastVersion() string {
if err != nil { if err != nil {
log.Println(err) log.Println(err)
} }
return apiresults[0].Tag
var tags []string
for _, t := range apiresults {
tags = append(tags, t.Tag)
}
sort.Sort(sort.Reverse(sort.StringSlice(tags)))
return tags[0]
} }
func InitGeoIP() (citydb *geoip2.Reader, asndb *geoip2.Reader, err error) { func InitGeoIP() (citydb *geoip2.Reader, asndb *geoip2.Reader, err error) {