mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-19 23:46:36 +08:00
访问日志增加区域和ISP信息
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||||
"github.com/iwind/TeaGo/maps"
|
"github.com/iwind/TeaGo/maps"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ViewPopupAction struct {
|
type ViewPopupAction struct {
|
||||||
@@ -82,5 +83,34 @@ func (this *ViewPopupAction) RunGet(params struct {
|
|||||||
}
|
}
|
||||||
this.Data["wafInfo"] = wafMap
|
this.Data["wafInfo"] = wafMap
|
||||||
|
|
||||||
|
// 地域相关
|
||||||
|
var regionMap maps.Map = nil
|
||||||
|
regionResp, err := this.RPC().IPLibraryRPC().LookupIPRegion(this.AdminContext(), &pb.LookupIPRegionRequest{Ip: accessLog.RemoteAddr})
|
||||||
|
if err != nil {
|
||||||
|
this.ErrorPage(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
region := regionResp.Region
|
||||||
|
if region != nil {
|
||||||
|
pieces := []string{}
|
||||||
|
if len(region.Country) > 0 {
|
||||||
|
pieces = append(pieces, region.Country)
|
||||||
|
}
|
||||||
|
if len(region.Region) > 0 {
|
||||||
|
pieces = append(pieces, region.Region)
|
||||||
|
}
|
||||||
|
if len(region.Province) > 0 {
|
||||||
|
pieces = append(pieces, region.Province)
|
||||||
|
}
|
||||||
|
if len(region.City) > 0 {
|
||||||
|
pieces = append(pieces, region.City)
|
||||||
|
}
|
||||||
|
regionMap = maps.Map{
|
||||||
|
"full": strings.Join(pieces, " "),
|
||||||
|
"isp": region.Isp,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.Data["region"] = regionMap
|
||||||
|
|
||||||
this.Show()
|
this.Show()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,5 +112,13 @@
|
|||||||
<td>IP</td>
|
<td>IP</td>
|
||||||
<td>{{accessLog.remoteAddr}}</td>
|
<td>{{accessLog.remoteAddr}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr v-if="region != null">
|
||||||
|
<td>区域</td>
|
||||||
|
<td>{{region.full}}</td>
|
||||||
|
</tr>
|
||||||
|
<tr v-if="region.isp.length > 0">
|
||||||
|
<td>ISP</td>
|
||||||
|
<td>{{region.isp}}</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
Reference in New Issue
Block a user