DNS节点增加在线状态通知

This commit is contained in:
GoEdgeLab
2021-08-08 10:29:48 +08:00
parent 11f7e5010e
commit 07aa0990f8
14 changed files with 623 additions and 86 deletions

View File

@@ -119,6 +119,7 @@ func (this *NSNodeService) ListEnabledNSNodesMatch(ctx context.Context, req *pb.
IsOn: node.IsOn == 1,
UniqueId: node.UniqueId,
Secret: node.Secret,
IsActive: node.IsActive == 1,
IsInstalled: node.IsInstalled == 1,
InstallDir: node.InstallDir,
IsUp: node.IsUp == 1,
@@ -420,3 +421,21 @@ func (this *NSNodeService) DownloadNSNodeInstallationFile(ctx context.Context, r
Filename: filepath.Base(file.Path),
}, nil
}
// UpdateNSNodeConnectedAPINodes 更改节点连接的API节点信息
func (this *NSNodeService) UpdateNSNodeConnectedAPINodes(ctx context.Context, req *pb.UpdateNSNodeConnectedAPINodesRequest) (*pb.RPCSuccess, error) {
// 校验节点
_, _, nodeId, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeDNS)
if err != nil {
return nil, err
}
tx := this.NullTx()
err = nameservers.SharedNSNodeDAO.UpdateNodeConnectedAPINodes(tx, nodeId, req.ApiNodeIds)
if err != nil {
return nil, errors.Wrap(err)
}
return this.Success()
}