Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3509672
D5997.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D5997.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 7:14 AM (54 m, 12 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690540
Default Alt Text
D5997.diff (1 KB)
Attached To
Mode
D5997: [native/rust_library] Adding of the Tunnelbroker Tonic client initialization
Attached
Detach File
Event Timeline
Log In to Comment