Skip to content

Commit

Permalink
fix some of the geolocation bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
mosajjal committed May 27, 2023
1 parent 5f8bed8 commit 7a58a32
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions acl/geoip.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package acl
import (
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"os"
"strings"
"time"

Expand Down Expand Up @@ -75,19 +75,13 @@ func (g *geoIP) initializeGeoIP() error {
}

} else {
file, err := os.Open(g.Path)
if err != nil {
return err
}
g.logger.Info().Msgf("(re)loading File: %s", g.Path)
defer file.Close()
n, err := file.Read(scanner)
if err != nil {
var err error
if scanner, err = ioutil.ReadFile(g.Path); err != nil {
return err
}
g.logger.Info().Msgf("geolocation database with %d bytes loaded", n)

}
g.logger.Info().Msgf("geolocation database with %d bytes loaded", len(scanner))
var err error
if g.mmdb, err = maxminddb.FromBytes(scanner); err != nil {
//g.logger.Warn("%d bytes read, %s", len(scanner), err)
Expand Down

0 comments on commit 7a58a32

Please sign in to comment.