| Crates.io | letngorok-rs-sdk |
| lib.rs | letngorok-rs-sdk |
| version | 0.1.0 |
| created_at | 2025-05-10 16:19:48.906048+00 |
| updated_at | 2025-05-10 16:19:48.906048+00 |
| description | Rust SDK for creating tunnel connections to Letngorok servers |
| homepage | https://letngorok.studio/ |
| repository | https://github.com/seiortech/letngorok-rs-sdk |
| max_upload_size | |
| id | 1668532 |
| size | 88,937 |
letngorok-rs-sdk is a Rust SDK for creating tunnel connections to Letngorok servers.
First, you need to get an authentication token from the Letngorok Dashboard.
Then, Add this to your Cargo.toml:
[dependencies]
letngorok-rs-sdk = "0.1.0"
tokio = { version = "1", features = ["full"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
Here is a basic example:
use letngorok_rs_sdk::TunnelClient;
use tracing_subscriber::FmtSubscriber;
#[tokio::main]
async fn main() {
let subscriber = FmtSubscriber::builder()
.with_max_level(tracing::Level::INFO)
.finish();
tracing::subscriber::set_global_default(subscriber)
.expect("Setting default tracing subscriber failed.");
let token = "set-your-token-here";
let local_port = "set-your-local-port-here";
let client = match TunnelClient::new(None, token.to_string()) {
Ok(c) => c,
Err(e) => {
tracing::error!("Failed to create TunnelClient: {:?}", e);
return;
}
};
tracing::info!("TunnelClient created.");
if let Err(e) = client.start(local_port.to_string(), None).await {
tracing::error!("Failed to start tunnel for port {}: {:?}", local_port, e);
return;
}
tracing::info!(
"Tunnel initiation for local port {} requested. Check logs for connection status.",
local_port
);
tracing::info!("Tunnel is active. Press Ctrl+C to stop and exit.");
tokio::signal::ctrl_c()
.await
.expect("Failed to listen for Ctrl+C signal");
tracing::info!("Ctrl+C received. Shutting down tunnel(s)...");
if let Err(e) = client.stop_all().await {
tracing::error!("Error during tunnel shutdown: {:?}", e);
}
tracing::info!("Application has exited.");
}å
This SDK is licensed under the MIT License. See LICENSE for details.