mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-24 22:16:36 +08:00
DNS访问日志显示匹配的线路
This commit is contained in:
@@ -3,9 +3,11 @@ package nameservers
|
||||
import (
|
||||
"context"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models/nameservers"
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/rpc/services"
|
||||
rpcutils "github.com/TeaOSLab/EdgeAPI/internal/rpc/utils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
)
|
||||
|
||||
// NSAccessLogService 访问日志相关服务
|
||||
@@ -61,6 +63,27 @@ func (this *NSAccessLogService) ListNSAccessLogs(ctx context.Context, req *pb.Li
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 线路
|
||||
if len(a.NsRouteCodes) > 0 {
|
||||
for _, routeCode := range a.NsRouteCodes {
|
||||
route, err := nameservers.SharedNSRouteDAO.FindEnabledRouteWithCode(nil, routeCode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if route != nil {
|
||||
a.NsRoutes = append(a.NsRoutes, &pb.NSRoute{
|
||||
Id: types.Int64(route.Id),
|
||||
IsOn: route.IsOn == 1,
|
||||
Name: route.Name,
|
||||
Code: routeCode,
|
||||
NsCluster: nil,
|
||||
NsDomain: nil,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result = append(result, a)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user