Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3491053
D5997.id20024.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.id20024.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
@@ -5,12 +5,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");
+}
lazy_static! {
pub static ref RUNTIME: Arc<Runtime> = Arc::new(
@@ -83,6 +87,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>;
}
@@ -179,3 +189,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
Thu, Dec 19, 6:16 PM (17 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2678319
Default Alt Text
D5997.id20024.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