mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-23 23:30:25 +08:00
修复IPv6访问可能导致进程异常退出的Bug
This commit is contained in:
@@ -1,12 +1,13 @@
|
|||||||
package iplibrary
|
package iplibrary
|
||||||
|
|
||||||
type LibraryInterface interface {
|
type LibraryInterface interface {
|
||||||
// 加载数据库文件
|
// Load 加载数据库文件
|
||||||
Load(dbPath string) error
|
Load(dbPath string) error
|
||||||
|
|
||||||
// 查询IP
|
// Lookup 查询IP
|
||||||
|
// 返回结果有可能为空
|
||||||
Lookup(ip string) (*Result, error)
|
Lookup(ip string) (*Result, error)
|
||||||
|
|
||||||
// 关闭数据库文件
|
// Close 关闭数据库文件
|
||||||
Close()
|
Close()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ Loop:
|
|||||||
ip := ipString[atIndex+1:]
|
ip := ipString[atIndex+1:]
|
||||||
if iplibrary.SharedLibrary != nil {
|
if iplibrary.SharedLibrary != nil {
|
||||||
result, err := iplibrary.SharedLibrary.Lookup(ip)
|
result, err := iplibrary.SharedLibrary.Lookup(ip)
|
||||||
if err == nil {
|
if err == nil && result != nil {
|
||||||
this.cityMap[serverId+"@"+result.Country+"@"+result.Province+"@"+result.City] ++
|
this.cityMap[serverId+"@"+result.Country+"@"+result.Province+"@"+result.City] ++
|
||||||
|
|
||||||
if len(result.ISP) > 0 {
|
if len(result.ISP) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user