mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 10:14:35 +00:00
feat(web): full-power RPC access + typed JSON proxy endpoint (#1983)
- extend web controller bindings to cover full RPC service set - update rpc_service API wiring and session/controller integration - generate trait-level json_call_method in rpc codegen - route restful proxy-rpc requests via scoped typed clients - add json-call regression tests and required Sync bound fixes~
This commit is contained in:
@@ -31,7 +31,7 @@ use crate::{
|
||||
stats::StatsRpcService, vpn_portal::VpnPortalRpcService,
|
||||
},
|
||||
tunnel::{tcp::TcpTunnelListener, TunnelListener},
|
||||
web_client::DefaultHooks,
|
||||
web_client::{DefaultHooks, WebClientHooks},
|
||||
};
|
||||
|
||||
pub struct ApiRpcServer<T: TunnelListener + 'static> {
|
||||
@@ -64,7 +64,7 @@ impl ApiRpcServer<TcpTunnelListener> {
|
||||
impl<T: TunnelListener + 'static> ApiRpcServer<T> {
|
||||
pub fn from_tunnel(tunnel: T, instance_manager: Arc<NetworkInstanceManager>) -> Self {
|
||||
let rpc_server = StandAloneServer::new(tunnel);
|
||||
register_api_rpc_service(&instance_manager, rpc_server.registry());
|
||||
register_api_rpc_service(&instance_manager, rpc_server.registry(), None);
|
||||
Self { rpc_server }
|
||||
}
|
||||
}
|
||||
@@ -87,9 +87,10 @@ impl<T: TunnelListener + 'static> Drop for ApiRpcServer<T> {
|
||||
}
|
||||
}
|
||||
|
||||
fn register_api_rpc_service(
|
||||
pub fn register_api_rpc_service(
|
||||
instance_manager: &Arc<NetworkInstanceManager>,
|
||||
registry: &ServiceRegistry,
|
||||
hooks: Option<Arc<dyn WebClientHooks>>,
|
||||
) {
|
||||
registry.register(
|
||||
PeerManageRpcServer::new(PeerManageRpcService::new(instance_manager.clone())),
|
||||
@@ -148,7 +149,7 @@ fn register_api_rpc_service(
|
||||
registry.register(
|
||||
WebClientServiceServer::new(InstanceManageRpcService::new(
|
||||
instance_manager.clone(),
|
||||
Arc::new(DefaultHooks),
|
||||
hooks.unwrap_or(Arc::new(DefaultHooks)),
|
||||
)),
|
||||
"",
|
||||
);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
mod acl_manage;
|
||||
mod api;
|
||||
mod config;
|
||||
mod connector_manage;
|
||||
mod credential_manage;
|
||||
@@ -11,6 +10,7 @@ mod proxy;
|
||||
mod stats;
|
||||
mod vpn_portal;
|
||||
|
||||
pub mod api;
|
||||
pub mod instance_manage;
|
||||
pub mod logger;
|
||||
pub mod remote_client;
|
||||
|
||||
Reference in New Issue
Block a user