mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-15 18:35:47 +00:00
refactor(rpc): Centralize RPC service and unify API (#1427)
This change introduces a major refactoring of the RPC service layer to improve modularity, unify the API, and simplify the overall architecture. Key changes: - Replaced per-network-instance RPC services with a single global RPC server, reducing resource usage and simplifying management. - All clients (CLI, Web UI, etc.) now interact with EasyTier core through a unified RPC entrypoint, enabling consistent authentication and control. - RPC implementation logic has been moved to `easytier/src/rpc_service/` and organized by functionality (e.g., `instance_manage.rs`, `peer_manage.rs`, `config.rs`) for better maintainability. - Standardized Protobuf API definitions under `easytier/src/proto/` with an `api_` prefix (e.g., `cli.proto` → `api_instance.proto`) to provide a consistent interface. - CLI commands now require explicit `--instance-id` or `--instance-name` when multiple network instances are running; the parameter is optional when only one instance exists. BREAKING CHANGE: RPC portal configuration (`rpc_portal` and `rpc_portal_whitelist`) has been removed from per-instance configs and the Web UI. The RPC listen address must now be specified globally via the `--rpc-portal` command-line flag or the `ET_RPC_PORTAL` environment variable, as there is only one RPC service for the entire application.
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "common.proto";
|
||||
import "acl.proto";
|
||||
import "api_instance.proto";
|
||||
|
||||
package api.config;
|
||||
|
||||
enum ConfigPatchAction {
|
||||
ADD = 0;
|
||||
REMOVE = 1;
|
||||
CLEAR = 2;
|
||||
}
|
||||
|
||||
message InstanceConfigPatch {
|
||||
optional string hostname = 1;
|
||||
optional common.Ipv4Inet ipv4 = 2;
|
||||
optional common.Ipv6Inet ipv6 = 3;
|
||||
repeated PortForwardPatch port_forwards = 4;
|
||||
optional AclPatch acl = 5;
|
||||
repeated ProxyNetworkPatch proxy_networks = 6;
|
||||
repeated RoutePatch routes = 7;
|
||||
repeated ExitNodePatch exit_nodes = 8;
|
||||
repeated UrlPatch mapped_listeners = 9;
|
||||
repeated UrlPatch connectors = 10;
|
||||
}
|
||||
|
||||
message PortForwardPatch {
|
||||
ConfigPatchAction action = 1;
|
||||
common.PortForwardConfigPb cfg = 2;
|
||||
}
|
||||
|
||||
message StringPatch {
|
||||
ConfigPatchAction action = 1;
|
||||
string value = 2;
|
||||
}
|
||||
|
||||
message UrlPatch {
|
||||
ConfigPatchAction action = 1;
|
||||
common.Url url = 2;
|
||||
}
|
||||
|
||||
message AclPatch {
|
||||
optional acl.Acl acl = 1;
|
||||
repeated StringPatch tcp_whitelist = 2;
|
||||
repeated StringPatch udp_whitelist = 3;
|
||||
}
|
||||
|
||||
message ProxyNetworkPatch {
|
||||
ConfigPatchAction action = 1;
|
||||
common.Ipv4Inet cidr = 2;
|
||||
optional common.Ipv4Inet mapped_cidr = 3;
|
||||
}
|
||||
|
||||
message RoutePatch {
|
||||
ConfigPatchAction action = 1;
|
||||
common.Ipv4Inet cidr = 2;
|
||||
}
|
||||
|
||||
message ExitNodePatch {
|
||||
ConfigPatchAction action = 1;
|
||||
common.IpAddr node = 2;
|
||||
}
|
||||
|
||||
message PatchConfigRequest {
|
||||
InstanceConfigPatch patch = 1;
|
||||
api.instance.InstanceIdentifier instance = 2;
|
||||
}
|
||||
|
||||
message PatchConfigResponse {}
|
||||
|
||||
service ConfigRpc {
|
||||
rpc PatchConfig(PatchConfigRequest) returns (PatchConfigResponse);
|
||||
}
|
||||
Reference in New Issue
Block a user