Archived
135 lines
3.0 KiB
Protocol Buffer
135 lines
3.0 KiB
Protocol Buffer
syntax = "proto3";
|
|
option go_package = "./pb";
|
|
|
|
package pb;
|
|
|
|
import "models/rpc_messages.proto";
|
|
import "models/model_ip_list.proto";
|
|
|
|
// IP列表
|
|
service IPListService {
|
|
// 创建IP列表
|
|
rpc createIPList (CreateIPListRequest) returns (CreateIPListResponse);
|
|
|
|
// 修改IP列表
|
|
rpc updateIPList (UpdateIPListRequest) returns (RPCSuccess);
|
|
|
|
// 查找IP列表信息
|
|
rpc findEnabledIPList (FindEnabledIPListRequest) returns (FindEnabledIPListResponse);
|
|
|
|
// 计算名单数量
|
|
rpc countAllEnabledIPLists (CountAllEnabledIPListsRequest) returns (RPCCountResponse);
|
|
|
|
// 列出单页名单
|
|
rpc listEnabledIPLists (ListEnabledIPListsRequest) returns (ListEnabledIPListsResponse);
|
|
|
|
// 删除IP名单
|
|
rpc deleteIPList (DeleteIPListRequest) returns (RPCSuccess);
|
|
|
|
// 检查IPList是否存在
|
|
rpc existsEnabledIPList (ExistsEnabledIPListRequest) returns (ExistsEnabledIPListResponse);
|
|
|
|
// 根据IP来搜索IP名单
|
|
rpc findEnabledIPListContainsIP(FindEnabledIPListContainsIPRequest) returns (FindEnabledIPListContainsIPResponse);
|
|
|
|
// 查找IP名单对应的网站ID
|
|
rpc findServerIdWithIPListId(FindServerIdWithIPListIdRequest) returns (FindServerIdWithIPListIdResponse);
|
|
|
|
// 根据IP名单代号获取IP名单ID
|
|
rpc findIPListIdWithCode(FindIPListIdWithCodeRequest) returns (FindIPListIdWithCodeResponse);
|
|
}
|
|
|
|
// 创建IP列表
|
|
message CreateIPListRequest {
|
|
string type = 1;
|
|
string name = 2;
|
|
string code = 3;
|
|
bytes timeoutJSON = 4;
|
|
bool isPublic = 5;
|
|
string description = 6;
|
|
bool isGlobal = 7;
|
|
int64 serverId = 8;
|
|
}
|
|
|
|
message CreateIPListResponse {
|
|
int64 ipListId = 1;
|
|
}
|
|
|
|
// 修改IP列表
|
|
message UpdateIPListRequest {
|
|
int64 ipListId = 1;
|
|
string name = 2;
|
|
string code = 3;
|
|
bytes timeoutJSON = 4;
|
|
string description = 5;
|
|
}
|
|
|
|
// 查找IP列表信息
|
|
message FindEnabledIPListRequest {
|
|
int64 ipListId = 1;
|
|
}
|
|
|
|
message FindEnabledIPListResponse {
|
|
IPList ipList = 1;
|
|
}
|
|
|
|
// 计算名单数量
|
|
message CountAllEnabledIPListsRequest {
|
|
string type = 1;
|
|
bool isPublic = 2;
|
|
string keyword = 3;
|
|
}
|
|
|
|
// 列出单页名单
|
|
message ListEnabledIPListsRequest {
|
|
string type = 1;
|
|
bool isPublic = 2;
|
|
string keyword = 3;
|
|
int64 offset = 4;
|
|
int64 size = 5;
|
|
}
|
|
|
|
message ListEnabledIPListsResponse {
|
|
repeated IPList ipLists = 1;
|
|
}
|
|
|
|
// 删除IP名单
|
|
message DeleteIPListRequest {
|
|
int64 ipListId = 1;
|
|
}
|
|
|
|
// 检查IPList是否存在
|
|
message ExistsEnabledIPListRequest {
|
|
int64 ipListId = 1;
|
|
}
|
|
|
|
message ExistsEnabledIPListResponse {
|
|
bool exists = 1;
|
|
}
|
|
|
|
// 根据IP来搜索IP名单
|
|
message FindEnabledIPListContainsIPRequest {
|
|
string ip = 1;
|
|
}
|
|
|
|
message FindEnabledIPListContainsIPResponse {
|
|
repeated IPList ipLists = 1;
|
|
}
|
|
|
|
// 查找IP名单对应的网站ID
|
|
message FindServerIdWithIPListIdRequest {
|
|
int64 ipListId = 1; // IP名单ID
|
|
}
|
|
|
|
message FindServerIdWithIPListIdResponse {
|
|
int64 serverId = 1; // 网站ID(如果是公共IP名单,则对应的网站ID为0)
|
|
}
|
|
|
|
// 根据IP名单代号获取IP名单ID
|
|
message FindIPListIdWithCodeRequest {
|
|
string code = 1; // IP名单代号
|
|
}
|
|
|
|
message FindIPListIdWithCodeResponse {
|
|
int64 ipListId = 1; // IP名单ID
|
|
} |