INNER CODE UNIT · Rust

new_grpc_client

upvpn/upvpn-app · upvpn-controller/src/lib.rs:48

pub async fn new_grpc_client() -> Result<ControllerServiceClient, ControllerError> {
    let ipc_path = upvpn_config::config().socket_path();

    // URI is unused
    let channel = TonicEndpoint::from_static("http://[::]:50051")
        .connect_with_connector(service_fn(move |_: Uri| IpcEndpoint::connect(ipc_path)))
        .await
        .map_err(ControllerError::TonicTransportError)?;

    Ok(ControllerServiceClient::new(channel))
}

pub async fn spawn_grpc_server<S, P, F>(
    service: S,
    auth: P,
    shutdown: F,
) -> std::result::Result<GrpcServerJoinHandle, ControllerError>
where

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…