增加若干API/增加多个网站功能项

This commit is contained in:
GoEdgeLab
2023-12-20 15:09:09 +08:00
parent 09031c6868
commit fdec24a889
18 changed files with 1286 additions and 540 deletions
+2 -1
View File
@@ -9,7 +9,8 @@ message Plan {
string name = 3;
int64 clusterId = 4;
bytes trafficLimitJSON = 5;
bytes featuresJSON = 6;
bool hasFullFeatures = 20; // 是否有所有权限
bytes featuresJSON = 6; // 权限列表,[code1, code2, ...]
string priceType = 7;
bytes trafficPriceJSON = 8;
bytes bandwidthPriceJSON = 12;
@@ -3,8 +3,10 @@ option go_package = "./pb";
package pb;
// 用户功能定义
message UserFeature {
string code = 1;
string name = 2;
string description = 3;
string code = 1; // 代号
string name = 2; // 名称
string description = 3; // 描述
bool supportPlan = 4; // 是否支持套餐
}
@@ -50,6 +50,9 @@ service HTTPFirewallPolicyService {
// 检查IP状态
rpc checkHTTPFirewallPolicyIPStatus (CheckHTTPFirewallPolicyIPStatusRequest) returns (CheckHTTPFirewallPolicyIPStatusResponse);
// 获取防火墙对应的网站ID
rpc findServerIdWithHTTPFirewallPolicyId(FindServerIdWithHTTPFirewallPolicyIdRequest) returns (FindServerIdWithHTTPFirewallPolicyIdResponse);
}
// 获取所有可用策略
@@ -174,11 +177,20 @@ message CheckHTTPFirewallPolicyIPStatusRequest {
message CheckHTTPFirewallPolicyIPStatusResponse {
bool isOk = 1; // 是否查询成功
string error = 2;
string error = 2; // 错误信息
bool isFound = 3; // 是否找到
bool isAllowed = 4; // 是否允许
IPList ipList = 5; // 匹配的IPList
IPItem ipItem = 6; // 匹配的IPItem
RegionCountry regionCountry = 7; // 匹配到封禁的地区
RegionProvince regionProvince = 8; // 匹配到封禁的省份
}
// 获取防火墙对应的网站ID
message FindServerIdWithHTTPFirewallPolicyIdRequest {
int64 httpFirewallPolicyId = 1; // 防火墙策略ID
}
message FindServerIdWithHTTPFirewallPolicyIdResponse {
int64 serverId = 1; // 防火墙策略对应的网站ID,公共的防火墙策略的网站ID为0
}
+12
View File
@@ -52,6 +52,9 @@ service IPItemService {
// 设置所有为已读
rpc updateIPItemsRead(UpdateIPItemsReadRequest) returns (RPCSuccess);
// 查找IP对应的名单所属网站ID
rpc findServerIdWithIPItemId(FindServerIdWithIPItemIdRequest) returns (FindServerIdWithIPItemIdResponse);
}
// 创建IP
@@ -236,4 +239,13 @@ message ListAllEnabledIPItemsResponse {
// 设置所有为已读
message UpdateIPItemsReadRequest {
}
// 查找IP对应的名单所属网站ID
message FindServerIdWithIPItemIdRequest {
int64 ipItemId = 1; // IP ID
}
message FindServerIdWithIPItemIdResponse {
int64 serverId = 1; // 网站ID
}
+12
View File
@@ -31,6 +31,9 @@ service IPListService {
// 根据IP来搜索IP名单
rpc findEnabledIPListContainsIP(FindEnabledIPListContainsIPRequest) returns (FindEnabledIPListContainsIPResponse);
// 查找IP名单对应的网站ID
rpc findServerIdWithIPListId(FindServerIdWithIPListIdRequest) returns (FindServerIdWithIPListIdResponse);
}
// 创建IP列表
@@ -108,4 +111,13 @@ message FindEnabledIPListContainsIPRequest {
message FindEnabledIPListContainsIPResponse {
repeated IPList ipLists = 1;
}
// 查找IP名单对应的网站ID
message FindServerIdWithIPListIdRequest {
int64 ipListId = 1; // IP名单ID
}
message FindServerIdWithIPListIdResponse {
int64 serverId = 1; // 网站ID(如果是公共IP名单,则对应的网站ID为0)
}
+4 -2
View File
@@ -35,7 +35,8 @@ message CreatePlanRequest {
string name = 1;
int64 clusterId = 2;
bytes trafficLimitJSON = 3;
bytes featuresJSON = 4;
bool hasFullFeatures = 18; // 是否有所有权限
bytes featuresJSON = 4; // 权限列表,[code1, code2, ...]
string priceType = 5;
bytes trafficPriceJSON = 6;
bytes bandwidthPriceJSON = 10;
@@ -62,7 +63,8 @@ message UpdatePlanRequest {
bool isOn = 3;
int64 clusterId = 4;
bytes trafficLimitJSON = 5;
bytes featuresJSON = 6;
bool hasFullFeatures = 20; // 是否有所有权限
bytes featuresJSON = 6; // 权限列表,[code1, code2, ...]
string priceType = 7;
bytes trafficPriceJSON = 8;
bytes bandwidthPriceJSON = 12;