实现IP名单管理
This commit is contained in:
13
pkg/rpc/protos/model_ip_item.proto
Normal file
13
pkg/rpc/protos/model_ip_item.proto
Normal file
@@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message IPItem {
|
||||
int64 id = 1;
|
||||
string ipFrom = 2;
|
||||
string ipTo = 3;
|
||||
int64 version = 4;
|
||||
int64 expiredAt = 5;
|
||||
string reason = 6;
|
||||
}
|
||||
13
pkg/rpc/protos/model_ip_list.proto
Normal file
13
pkg/rpc/protos/model_ip_list.proto
Normal file
@@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message IPList {
|
||||
int64 id = 1;
|
||||
bool isOn = 2;
|
||||
string type = 3;
|
||||
string name = 4;
|
||||
string code = 5;
|
||||
bytes timeoutJSON = 6;
|
||||
}
|
||||
84
pkg/rpc/protos/service_ip_item.proto
Normal file
84
pkg/rpc/protos/service_ip_item.proto
Normal file
@@ -0,0 +1,84 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "rpc_messages.proto";
|
||||
import "model_ip_item.proto";
|
||||
|
||||
// IP条目管理
|
||||
service IPItemService {
|
||||
// 创建IP
|
||||
rpc createIPItem (CreateIPItemRequest) returns (CreateIPItemResponse);
|
||||
|
||||
// 修改IP
|
||||
rpc updateIPItem (UpdateIPItemRequest) returns (RPCUpdateSuccess);
|
||||
|
||||
// 删除IP
|
||||
rpc deleteIPItem (DeleteIPItemRequest) returns (RPCDeleteSuccess);
|
||||
|
||||
// 计算IP数量
|
||||
rpc countIPItemsWithListId (CountIPItemsWithListIdRequest) returns (CountIPItemsWithListIdResponse);
|
||||
|
||||
// 列出单页的IP
|
||||
rpc listIPItemsWithListId (ListIPItemsWithListIdRequest) returns (ListIPItemsWithListIdResponse);
|
||||
|
||||
// 查找单个IP
|
||||
rpc findEnabledIPItem (FindEnabledIPItemRequest) returns (FindEnabledIPItemResponse);
|
||||
}
|
||||
|
||||
// 创建IP
|
||||
message CreateIPItemRequest {
|
||||
int64 ipListId = 1;
|
||||
string ipFrom = 2;
|
||||
string ipTo = 3;
|
||||
int64 expiredAt = 4;
|
||||
string reason = 5;
|
||||
}
|
||||
|
||||
message CreateIPItemResponse {
|
||||
int64 ipItemId = 1;
|
||||
}
|
||||
|
||||
// 修改IP
|
||||
message UpdateIPItemRequest {
|
||||
int64 ipItemId = 1;
|
||||
string ipFrom = 2;
|
||||
string ipTo = 3;
|
||||
int64 expiredAt = 4;
|
||||
string reason = 5;
|
||||
}
|
||||
|
||||
// 删除IP
|
||||
message DeleteIPItemRequest {
|
||||
int64 ipItemId = 1;
|
||||
}
|
||||
|
||||
// 计算IP数量
|
||||
message CountIPItemsWithListIdRequest {
|
||||
int64 ipListId = 1;
|
||||
}
|
||||
|
||||
message CountIPItemsWithListIdResponse {
|
||||
int64 count = 1;
|
||||
}
|
||||
|
||||
// 列出单页的IP
|
||||
message ListIPItemsWithListIdRequest {
|
||||
int64 ipListId = 1;
|
||||
int64 offset = 2;
|
||||
int64 size = 3;
|
||||
}
|
||||
|
||||
message ListIPItemsWithListIdResponse {
|
||||
repeated IPItem ipItems = 1;
|
||||
}
|
||||
|
||||
// 查找单个IP
|
||||
message FindEnabledIPItemRequest {
|
||||
int64 ipItemId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledIPItemResponse {
|
||||
IPItem ipItem = 1;
|
||||
}
|
||||
48
pkg/rpc/protos/service_ip_list.proto
Normal file
48
pkg/rpc/protos/service_ip_list.proto
Normal file
@@ -0,0 +1,48 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "rpc_messages.proto";
|
||||
import "model_ip_list.proto";
|
||||
|
||||
// IP列表
|
||||
service IPListService {
|
||||
// 创建IP列表
|
||||
rpc createIPList (CreateIPListRequest) returns (CreateIPListResponse);
|
||||
|
||||
// 修改IP列表
|
||||
rpc updateIPList (UpdateIPListRequest) returns (RPCUpdateSuccess);
|
||||
|
||||
// 查找IP列表
|
||||
rpc findEnabledIPList (FindEnabledIPListRequest) returns (FindEnabledIPListResponse);
|
||||
}
|
||||
|
||||
// 创建IP列表
|
||||
message CreateIPListRequest {
|
||||
string type = 1;
|
||||
string name = 2;
|
||||
string code = 3;
|
||||
bytes timeoutJSON = 4;
|
||||
}
|
||||
|
||||
message CreateIPListResponse {
|
||||
int64 ipListId = 1;
|
||||
}
|
||||
|
||||
// 修改IP列表
|
||||
message UpdateIPListRequest {
|
||||
int64 ipListId = 1;
|
||||
string name = 2;
|
||||
string code = 3;
|
||||
bytes timeoutJSON = 4;
|
||||
}
|
||||
|
||||
// 查找IP列表
|
||||
message FindEnabledIPListRequest {
|
||||
int64 ipListId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledIPListResponse {
|
||||
IPList ipList = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user