Crates.io | localtunnel |
lib.rs | localtunnel |
version | 0.1.5 |
source | src |
created_at | 2022-07-07 09:12:14.427642 |
updated_at | 2024-11-08 17:04:24.989791 |
description | A CLI to proxy with localtunnel server. |
homepage | |
repository | https://github.com/kaichaosun/rlt |
max_upload_size | |
id | 621069 |
size | 62,735 |
Localtunnel exposes your localhost endpoint to the world, user cases are:
Known issue: the public proxy server is down, please setup your own server.
Use in CLI:
cargo install localtunnel
localtunnel client --host https://init.so --subdomain kaichao --port 3000
Use as a Rust library:
cargo add localtunnel-client
use localtunnel_client::{open_tunnel, broadcast, ClientConfig};
let (notify_shutdown, _) = broadcast::channel(1);
let config = ClientConfig {
server: Some("https://init.so".to_string()),
subdomain: Some("demo".to_string()),
local_host: Some("localhost".to_string()),
local_port: 3000,
shutdown_signal: notify_shutdown.clone(),
max_conn: 10,
credential: None,
};
let result = open_tunnel(config).await?;
// Shutdown the background tasks by sending a signal.
let _ = notify_shutdown.send(());
Use in CLI:
localtunnel server --domain init.so --port 3000 --proxy-port 3001 --secure
Use as a Rust library,
cargo install localtunnel-server
use localtunnel_server::{start, ServerConfig};
let config = ServerConfig {
domain: "init.so".to_string(),
api_port: 3000,
secure: true,
max_sockets: 10,
proxy_port: 3001,
require_auth: false,
};
start(config).await?
Please help me build OSS 👉 GitHub Sponsors