229 lines
5.0 KiB
Protocol Buffer
229 lines
5.0 KiB
Protocol Buffer
syntax = "proto3";
|
|
import "base.proto";
|
|
package hiddifyrpc;
|
|
|
|
option go_package = "./hiddifyrpc";
|
|
|
|
|
|
enum CoreState {
|
|
STOPPED = 0;
|
|
STARTING = 1;
|
|
STARTED = 2;
|
|
STOPPING = 3;
|
|
}
|
|
|
|
enum MessageType {
|
|
EMPTY=0;
|
|
EMPTY_CONFIGURATION = 1;
|
|
START_COMMAND_SERVER = 2;
|
|
CREATE_SERVICE = 3;
|
|
START_SERVICE = 4;
|
|
UNEXPECTED_ERROR = 5;
|
|
ALREADY_STARTED = 6;
|
|
ALREADY_STOPPED = 7;
|
|
INSTANCE_NOT_FOUND = 8;
|
|
INSTANCE_NOT_STOPPED = 9;
|
|
INSTANCE_NOT_STARTED = 10;
|
|
ERROR_BUILDING_CONFIG = 11;
|
|
ERROR_PARSING_CONFIG = 12;
|
|
ERROR_READING_CONFIG = 13;
|
|
}
|
|
|
|
message CoreInfoResponse {
|
|
CoreState core_state = 1;
|
|
MessageType message_type = 2;
|
|
string message = 3;
|
|
}
|
|
|
|
message StartRequest {
|
|
string config_path = 1;
|
|
string config_content = 2; // Optional if configPath is not provided.
|
|
bool disable_memory_limit = 3;
|
|
bool delay_start = 4;
|
|
bool enable_old_command_server = 5;
|
|
bool enable_raw_config = 6;
|
|
}
|
|
|
|
message SetupRequest {
|
|
string base_path = 1;
|
|
string working_path = 2;
|
|
string temp_path = 3;
|
|
}
|
|
|
|
message Response {
|
|
ResponseCode response_code = 1;
|
|
string message = 2;
|
|
}
|
|
|
|
|
|
message SystemInfo {
|
|
int64 memory = 1;
|
|
int32 goroutines = 2;
|
|
int32 connections_in = 3;
|
|
int32 connections_out = 4;
|
|
bool traffic_available = 5;
|
|
int64 uplink = 6;
|
|
int64 downlink = 7;
|
|
int64 uplink_total = 8;
|
|
int64 downlink_total = 9;
|
|
}
|
|
|
|
message OutboundGroupItem {
|
|
string tag = 1;
|
|
string type = 2;
|
|
int64 url_test_time = 3;
|
|
int32 url_test_delay = 4;
|
|
}
|
|
|
|
message OutboundGroup {
|
|
string tag = 1;
|
|
string type = 2;
|
|
string selected=3;
|
|
repeated OutboundGroupItem items = 4;
|
|
|
|
}
|
|
message OutboundGroupList{
|
|
repeated OutboundGroup items = 1;
|
|
}
|
|
|
|
message WarpAccount {
|
|
string account_id = 1;
|
|
string access_token = 2;
|
|
}
|
|
|
|
message WarpWireguardConfig {
|
|
string private_key = 1;
|
|
string local_address_ipv4 = 2;
|
|
string local_address_ipv6 = 3;
|
|
string peer_public_key = 4;
|
|
string client_id=5;
|
|
}
|
|
|
|
message WarpGenerationResponse {
|
|
WarpAccount account = 1;
|
|
string log = 2;
|
|
WarpWireguardConfig config = 3;
|
|
}
|
|
|
|
message SystemProxyStatus {
|
|
bool available = 1;
|
|
bool enabled = 2;
|
|
}
|
|
|
|
message ParseRequest {
|
|
string content = 1;
|
|
string config_path = 2;
|
|
string temp_path = 3;
|
|
bool debug = 4;
|
|
}
|
|
|
|
message ParseResponse {
|
|
ResponseCode response_code = 1;
|
|
string content = 2;
|
|
string message = 3;
|
|
}
|
|
|
|
message ChangeHiddifySettingsRequest {
|
|
string hiddify_settings_json = 1;
|
|
}
|
|
|
|
message GenerateConfigRequest {
|
|
string path = 1;
|
|
string temp_path = 2;
|
|
bool debug = 3;
|
|
}
|
|
|
|
message GenerateConfigResponse {
|
|
string config_content = 1;
|
|
}
|
|
|
|
|
|
|
|
message SelectOutboundRequest {
|
|
string group_tag = 1;
|
|
string outbound_tag = 2;
|
|
}
|
|
|
|
message UrlTestRequest {
|
|
string group_tag = 1;
|
|
}
|
|
|
|
message GenerateWarpConfigRequest {
|
|
string license_key = 1;
|
|
string account_id = 2;
|
|
string access_token = 3;
|
|
}
|
|
|
|
message SetSystemProxyEnabledRequest {
|
|
bool is_enabled = 1;
|
|
}
|
|
|
|
enum LogLevel {
|
|
DEBUG = 0;
|
|
INFO = 1;
|
|
WARNING = 2;
|
|
ERROR = 3;
|
|
FATAL = 4;
|
|
}
|
|
enum LogType {
|
|
CORE = 0;
|
|
SERVICE = 1;
|
|
CONFIG = 2;
|
|
}
|
|
message LogMessage {
|
|
LogLevel level = 1;
|
|
LogType type = 2;
|
|
string message = 3;
|
|
}
|
|
|
|
message StopRequest{
|
|
}
|
|
|
|
|
|
|
|
message TunnelStartRequest {
|
|
bool ipv6 = 1;
|
|
int32 server_port = 2;
|
|
bool strict_route = 3;
|
|
bool endpoint_independent_nat = 4;
|
|
string stack = 5;
|
|
|
|
}
|
|
|
|
message TunnelResponse {
|
|
string message = 1;
|
|
}
|
|
|
|
service Hello {
|
|
rpc SayHello (HelloRequest) returns (HelloResponse);
|
|
rpc SayHelloStream (stream HelloRequest) returns (stream HelloResponse);
|
|
}
|
|
service Core {
|
|
rpc Start (StartRequest) returns (CoreInfoResponse);
|
|
rpc CoreInfoListener (Empty) returns (stream CoreInfoResponse);
|
|
rpc OutboundsInfo (Empty) returns (stream OutboundGroupList);
|
|
rpc MainOutboundsInfo (Empty) returns (stream OutboundGroupList);
|
|
rpc GetSystemInfo (Empty) returns (stream SystemInfo);
|
|
rpc Setup (SetupRequest) returns (Response);
|
|
rpc Parse (ParseRequest) returns (ParseResponse);
|
|
rpc ChangeHiddifySettings (ChangeHiddifySettingsRequest) returns (CoreInfoResponse);
|
|
//rpc GenerateConfig (GenerateConfigRequest) returns (GenerateConfigResponse);
|
|
rpc StartService (StartRequest) returns (CoreInfoResponse);
|
|
rpc Stop (Empty) returns (CoreInfoResponse);
|
|
rpc Restart (StartRequest) returns (CoreInfoResponse);
|
|
rpc SelectOutbound (SelectOutboundRequest) returns (Response);
|
|
rpc UrlTest (UrlTestRequest) returns (Response);
|
|
rpc GenerateWarpConfig (GenerateWarpConfigRequest) returns (WarpGenerationResponse);
|
|
rpc GetSystemProxyStatus (Empty) returns (SystemProxyStatus);
|
|
rpc SetSystemProxyEnabled (SetSystemProxyEnabledRequest) returns (Response);
|
|
rpc LogListener (Empty) returns (stream LogMessage);
|
|
}
|
|
|
|
|
|
|
|
service TunnelService {
|
|
rpc Start(TunnelStartRequest ) returns (TunnelResponse);
|
|
rpc Stop(Empty) returns (TunnelResponse);
|
|
rpc Status(Empty) returns (TunnelResponse);
|
|
rpc Exit(Empty) returns (TunnelResponse);
|
|
} |