fix: register PeerCenterRpc in management API server so CLI peer-center works (#1929)

PeerCenterRpc was only registered in the per-instance peer-to-peer RPC
manager (domain = network_name), but not in the management API server
(domain = ""). The CLI connects to the management API with an empty
domain, causing "Invalid service name: PeerCenterRpc" errors.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
fanyang
2026-03-04 09:37:37 +08:00
committed by GitHub
co-authored by Claude Sonnet 4.6 Copilot
parent 9e9916efa5
commit eeb507d6ea
5 changed files with 137 additions and 4 deletions
+9 -2
View File
@@ -17,6 +17,7 @@ use crate::{
logger::LoggerRpcServer,
manage::WebClientServiceServer,
},
peer_rpc::PeerCenterRpcServer,
rpc_impl::{service_registry::ServiceRegistry, standalone::StandAloneServer},
rpc_types::error::Error,
},
@@ -24,8 +25,9 @@ use crate::{
acl_manage::AclManageRpcService, config::ConfigRpcService,
connector_manage::ConnectorManageRpcService, instance_manage::InstanceManageRpcService,
logger::LoggerRpcService, mapped_listener_manage::MappedListenerManageRpcService,
peer_manage::PeerManageRpcService, port_forward_manage::PortForwardManageRpcService,
proxy::TcpProxyRpcService, stats::StatsRpcService, vpn_portal::VpnPortalRpcService,
peer_center::PeerCenterManageRpcService, peer_manage::PeerManageRpcService,
port_forward_manage::PortForwardManageRpcService, proxy::TcpProxyRpcService,
stats::StatsRpcService, vpn_portal::VpnPortalRpcService,
},
tunnel::{tcp::TcpTunnelListener, TunnelListener},
web_client::DefaultHooks,
@@ -149,6 +151,11 @@ fn register_api_rpc_service(
)),
"",
);
registry.register(
PeerCenterRpcServer::new(PeerCenterManageRpcService::new(instance_manager.clone())),
"",
);
}
fn parse_rpc_portal(rpc_portal: Option<String>) -> anyhow::Result<SocketAddr> {