Skip to content

Commit

Permalink
Fix: nil pointer when use GeoIP2 to find IPv6 #43
Browse files Browse the repository at this point in the history
  • Loading branch information
zu1k committed Apr 10, 2021
1 parent 10b36ef commit 27600d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/app/parse.go
Expand Up @@ -19,7 +19,7 @@ var (
geoip geoip2.GeoIP
)

// init ip db content
// InitIPDB init ip db content
func InitIPDB(ipdbtype ipdb.IPDBType) {
db = make([]ipdb.IPDB, 1)
switch ipdbtype {
Expand All @@ -41,7 +41,7 @@ func ParseIPs(ips []string) {
if len(db) > 1 {
db1 = db[1]
} else {
db1 = nil
db1 = db[0]
}
for _, ip := range ips {
v := tools.ValidIP(ip)
Expand Down Expand Up @@ -83,7 +83,7 @@ func ReplaceIPInString(str string) (result string) {
if len(db) > 1 {
db1 = db[1]
} else {
db1 = nil
db1 = db[0]
}

result = str
Expand Down

0 comments on commit 27600d4

Please sign in to comment.