实现基本的域名、记录管理

This commit is contained in:
GoEdgeLab
2021-05-27 17:08:57 +08:00
parent e9162bddd8
commit 25ffc98eec
15 changed files with 3423 additions and 177 deletions

View File

@@ -0,0 +1,18 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_ns_cluster.proto";
import "models/model_user.proto";
// DNS域名
message NSDomain {
int64 id = 1;
string name = 2;
bool isOn = 3;
int64 createdAt = 4;
NSCluster nsCluster = 30;
User user = 31;
}

View File

@@ -0,0 +1,22 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_ns_domain.proto";
import "models/model_ns_route.proto";
// 域名记录
message NSRecord {
int64 id = 1;
string description = 2;
string name = 3;
string type = 4;
string value = 5;
int32 ttl = 6;
int32 weight = 7;
int64 createdAt = 8;
NSDomain nsDomain = 30;
repeated NSRoute nsRoutes = 31;
}

View File

@@ -0,0 +1,11 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
// 线路
message NSRoute {
int64 id = 1;
bool isOn = 2;
string name = 3;
}

View File

@@ -0,0 +1,82 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_ns_domain.proto";
import "models/rpc_messages.proto";
// 域名相关服务
service NSDomainService {
// 创建域名
rpc createNSDomain (CreateNSDomainRequest) returns (CreateNSDomainResponse);
// 修改域名
rpc updateNSDomain (UpdateNSDomainRequest) returns (RPCSuccess);
// 删除域名
rpc deleteNSDomain (DeleteNSDomainRequest) returns (RPCSuccess);
// 查找单个域名
rpc findEnabledNSDomain (FindEnabledNSDomainRequest) returns (FindEnabledNSDomainResponse);
// 计算域名数量
rpc countAllEnabledNSDomains (CountAllEnabledNSDomainsRequest) returns (RPCCountResponse);
// 列出单页域名
rpc listEnabledNSDomains (ListEnabledNSDomainsRequest) returns (ListEnabledNSDomainsResponse);
}
// 创建域名
message CreateNSDomainRequest {
int64 nsClusterId = 1;
int64 userId = 2;
string name = 3;
}
message CreateNSDomainResponse {
int64 nsDomainId = 1;
}
// 修改域名
message UpdateNSDomainRequest {
int64 nsDomainId = 1;
int64 nsClusterId = 2;
int64 userId = 3;
string name = 4;
bool isOn = 5;
}
// 删除域名
message DeleteNSDomainRequest {
int64 nsDomainId = 1;
}
// 查找单个域名
message FindEnabledNSDomainRequest {
int64 nsDomainId = 1;
}
message FindEnabledNSDomainResponse {
NSDomain nsDomain = 1;
}
// 计算域名数量
message CountAllEnabledNSDomainsRequest {
int64 userId = 1;
int64 nsClusterId = 2;
string keyword = 3;
}
// 列出单页域名
message ListEnabledNSDomainsRequest {
int64 userId = 1;
int64 nsClusterId = 2;
string keyword = 3;
int64 offset = 4;
int64 size = 5;
}
message ListEnabledNSDomainsResponse {
repeated NSDomain nsDomains = 1;
}

View File

@@ -0,0 +1,90 @@
syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/model_ns_record.proto";
import "models/rpc_messages.proto";
// 域名记录相关服务
service NSRecordService {
// 创建记录
rpc createNSRecord (CreateNSRecordRequest) returns (CreateNSRecordResponse);
// 修改记录
rpc updateNSRecord (UpdateNSRecordRequest) returns (RPCSuccess);
// 删除记录
rpc deleteNSRecord (DeleteNSRecordRequest) returns (RPCSuccess);
// 计算记录数量
rpc countAllEnabledNSRecords (CountAllEnabledNSRecordsRequest) returns (RPCCountResponse);
// 读取单页记录
rpc listEnabledNSRecords (ListEnabledNSRecordsRequest) returns (ListEnabledNSRecordsResponse);
// 查询单个记录信息
rpc findEnabledNSRecord (FindEnabledNSRecordRequest) returns (FindEnabledNSRecordResponse);
}
// 创建记录
message CreateNSRecordRequest {
int64 nsDomainId = 1;
string description = 2;
string name = 3;
string type = 4;
string value = 5;
int32 ttl = 6;
repeated int64 nsRouteIds = 7;
}
message CreateNSRecordResponse {
int64 nsRecordId = 1;
}
// 修改记录
message UpdateNSRecordRequest {
int64 nsRecordId = 1;
string description = 2;
string name = 3;
string type = 4;
string value = 5;
int32 ttl = 6;
repeated int64 nsRouteIds = 7;
}
// 删除记录
message DeleteNSRecordRequest {
int64 nsRecordId = 1;
}
// 计算记录数量
message CountAllEnabledNSRecordsRequest {
int64 nsDomainId = 1;
string type = 2;
int64 nsRouteId = 3;
string keyword = 4;
}
// 读取单页记录
message ListEnabledNSRecordsRequest {
int64 nsDomainId = 1;
string type = 2;
int64 nsRouteId = 3;
string keyword = 4;
int64 offset = 5;
int64 size = 6;
}
message ListEnabledNSRecordsResponse {
repeated NSRecord nsRecords = 1;
}
// 查询单个记录信息
message FindEnabledNSRecordRequest {
int64 nsRecordId = 1;
}
message FindEnabledNSRecordResponse {
NSRecord nsRecord = 1;
}

View File

@@ -99,6 +99,8 @@ message CountAllEnabledUsersRequest {
// 列出单页用户
message ListEnabledUsersRequest {
string keyword = 1;
int64 offset = 2;
int64 size = 3;
}
message ListEnabledUsersResponse {