mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
IP名单增加区域和ISP显示
This commit is contained in:
@@ -148,6 +148,22 @@ func (this *IndexAction) RunGet(params struct {
|
||||
}
|
||||
}
|
||||
|
||||
// 区域 & ISP
|
||||
var region = ""
|
||||
var isp = ""
|
||||
if len(item.IpFrom) > 0 && len(item.IpTo) == 0 {
|
||||
regionResp, err := this.RPC().IPLibraryRPC().LookupIPRegion(this.AdminContext(), &pb.LookupIPRegionRequest{Ip: item.IpFrom})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
var ipRegion = regionResp.IpRegion
|
||||
if ipRegion != nil {
|
||||
region = ipRegion.Summary
|
||||
isp = ipRegion.Isp
|
||||
}
|
||||
}
|
||||
|
||||
itemMaps = append(itemMaps, maps.Map{
|
||||
"id": item.Id,
|
||||
"ipFrom": item.IpFrom,
|
||||
@@ -167,6 +183,8 @@ func (this *IndexAction) RunGet(params struct {
|
||||
"sourceNode": sourceNodeMap,
|
||||
"list": listMap,
|
||||
"policy": policyMap,
|
||||
"region": region,
|
||||
"isp": isp,
|
||||
})
|
||||
}
|
||||
this.Data["items"] = itemMaps
|
||||
|
||||
@@ -104,6 +104,22 @@ func (this *ItemsAction) RunGet(params struct {
|
||||
}
|
||||
}
|
||||
|
||||
// 区域 & ISP
|
||||
var region = ""
|
||||
var isp = ""
|
||||
if len(item.IpFrom) > 0 && len(item.IpTo) == 0 {
|
||||
regionResp, err := this.RPC().IPLibraryRPC().LookupIPRegion(this.AdminContext(), &pb.LookupIPRegionRequest{Ip: item.IpFrom})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
var ipRegion = regionResp.IpRegion
|
||||
if ipRegion != nil {
|
||||
region = ipRegion.Summary
|
||||
isp = ipRegion.Isp
|
||||
}
|
||||
}
|
||||
|
||||
itemMaps = append(itemMaps, maps.Map{
|
||||
"id": item.Id,
|
||||
"ipFrom": item.IpFrom,
|
||||
@@ -118,6 +134,8 @@ func (this *ItemsAction) RunGet(params struct {
|
||||
"sourceSet": sourceSetMap,
|
||||
"sourceServer": sourceServerMap,
|
||||
"lifeSeconds": item.ExpiredAt - time.Now().Unix(),
|
||||
"region": region,
|
||||
"isp": isp,
|
||||
})
|
||||
}
|
||||
this.Data["items"] = itemMaps
|
||||
|
||||
Reference in New Issue
Block a user