File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -169,18 +169,14 @@ func mmdbSaveRestart(table string, ipVersion int) {
169169 if err != nil {
170170 panic (err )
171171 }
172+ defer fileHandle .Close ()
172173
173174 fmt .Println ("Writing MMDB file: " + filePath )
174175 _ , err = mmDbWriter .WriteTo (fileHandle )
175176 if err != nil {
176177 panic (err )
177178 }
178179
179- err = fileHandle .Close ()
180- if err != nil {
181- panic (err )
182- }
183-
184180 mmDbWriter = nil
185181 mmdbOpenFile (key )
186182 }
Original file line number Diff line number Diff line change @@ -76,7 +76,8 @@ func postgresIp(ip net.IP) *Ip {
7676
7777 FROM "%s"."ip_city"
7878
79- WHERE "ip_range_start" <= $1
79+ WHERE "ip_range_start" <= $1
80+ AND "ip_range_end" >= $1
8081
8182 ORDER BY "ip_range_start" DESC
8283
@@ -105,7 +106,8 @@ func postgresIp(ip net.IP) *Ip {
105106
106107 FROM "%s"."ip_country"
107108
108- WHERE "ip_range_start" <= $1
109+ WHERE "ip_range_start" <= $1
110+ AND "ip_range_end" >= $1
109111
110112 ORDER BY "ip_range_start" DESC
111113
@@ -133,7 +135,8 @@ func postgresIp(ip net.IP) *Ip {
133135
134136 FROM "%s"."ip_asn"
135137
136- WHERE "ip_range_start" <= $1
138+ WHERE "ip_range_start" <= $1
139+ AND "ip_range_end" >= $1
137140
138141 ORDER BY "ip_range_start" DESC
139142
You can’t perform that action at this time.
0 commit comments