updated how to handle latest geoip tags
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3f8a7d5d6e
commit
f0612534a3
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user