mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-07 02:20:24 +08:00
允许用户调用修改TCP/TLS接口;新增server.tcp.port功能;增加检查端口是否使用接口
This commit is contained in:
@@ -839,7 +839,7 @@ func (this *NodeClusterService) FindFreePortInNodeCluster(ctx context.Context, r
|
||||
continue
|
||||
}
|
||||
|
||||
isUsing, err := models.SharedServerDAO.CheckPortIsUsing(tx, req.NodeClusterId, port)
|
||||
isUsing, err := models.SharedServerDAO.CheckPortIsUsing(tx, req.NodeClusterId, port, 0, "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -850,3 +850,18 @@ func (this *NodeClusterService) FindFreePortInNodeCluster(ctx context.Context, r
|
||||
|
||||
return nil, errors.New("can not find random port")
|
||||
}
|
||||
|
||||
// 检查端口是否已经被使用
|
||||
func (this *NodeClusterService) CheckPortIsUsingInNodeCluster(ctx context.Context, req *pb.CheckPortIsUsingInNodeClusterRequest) (*pb.CheckPortIsUsingInNodeClusterResponse, error) {
|
||||
_, _, err := this.ValidateAdminAndUser(ctx, 0, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var tx = this.NullTx()
|
||||
isUsing, err := models.SharedServerDAO.CheckPortIsUsing(tx, req.NodeClusterId, int(req.Port), req.ExcludeServerId, req.ExcludeProtocol)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pb.CheckPortIsUsingInNodeClusterResponse{IsUsing: isUsing}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user