Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32405655
D6281.1765342864.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
902 B
Referenced Files
None
Subscribers
None
D6281.1765342864.diff
View Options
diff --git a/shared/tunnelbroker-client/src/lib.rs b/shared/tunnelbroker-client/src/lib.rs
new file mode 100644
--- /dev/null
+++ b/shared/tunnelbroker-client/src/lib.rs
@@ -0,0 +1,28 @@
+use lazy_static::lazy_static;
+use std::sync::Arc;
+use tokio::runtime::{Builder, Runtime};
+use tonic::transport::Channel;
+
+pub mod protobuff {
+ tonic::include_proto!("tunnelbroker");
+}
+use protobuff::tunnelbroker_service_client::TunnelbrokerServiceClient;
+
+lazy_static! {
+ pub static ref RUNTIME: Arc<Runtime> = Arc::new(
+ Builder::new_multi_thread()
+ .worker_threads(1)
+ .max_blocking_threads(1)
+ .enable_all()
+ .build()
+ .unwrap()
+ );
+}
+
+pub fn initialize_client<T>(
+ addr: String,
+) -> TunnelbrokerServiceClient<Channel> {
+ RUNTIME
+ .block_on(TunnelbrokerServiceClient::connect(addr))
+ .expect("Failed to connect ot the Tunnelbroker Service")
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 10, 5:01 AM (11 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5861233
Default Alt Text
D6281.1765342864.diff (902 B)
Attached To
Mode
D6281: [tunnelbroker-client] Adding Tunnelbroker tonic client initialization function
Attached
Detach File
Event Timeline
Log In to Comment