Page MenuHomePhabricator

D5997.diff
No OneTemporary

D5997.diff

diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs
--- a/native/native_rust_library/src/lib.rs
+++ b/native/native_rust_library/src/lib.rs
@@ -3,12 +3,16 @@
use tokio::runtime::{Builder, Runtime};
use tonic::{transport::Channel, Status};
use tracing::instrument;
+use tunnelbroker::tunnelbroker_service_client::TunnelbrokerServiceClient;
mod crypto_tools;
mod identity_client;
mod identity {
tonic::include_proto!("identity");
}
+mod tunnelbroker {
+ tonic::include_proto!("tunnelbroker");
+}
use crypto_tools::generate_device_id;
use identity::identity_service_client::IdentityServiceClient;
@@ -84,6 +88,12 @@
user_public_key: String,
) -> Result<String>;
+ // Tunnelbroker Service Client
+ type TunnelbrokerClient;
+
+ #[cxx_name = "TunnelbrokerInitializeClient"]
+ fn initialize_tunnelbroker_client(addr: String) -> Box<TunnelbrokerClient>;
+
// Crypto Tools
fn generate_device_id(device_type: DeviceType) -> Result<String>;
}
@@ -180,3 +190,16 @@
user_public_key,
))
}
+
+#[derive(Debug)]
+pub struct TunnelbrokerClient {
+ tunnelbroker_client: TunnelbrokerServiceClient<Channel>,
+}
+
+fn initialize_tunnelbroker_client(addr: String) -> Box<TunnelbrokerClient> {
+ Box::new(TunnelbrokerClient {
+ tunnelbroker_client: RUNTIME
+ .block_on(TunnelbrokerServiceClient::connect(addr))
+ .expect("Failed to create Tokio runtime for the Tunnelbroker client"),
+ })
+}

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 7:14 AM (6 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690540
Default Alt Text
D5997.diff (1 KB)

Event Timeline