Localtunnel exposes your localhost endpoint to the world, user cases are: - API testing - multiple devices access to single data store - peer to peer connection, workaround for NAT hole punching.
Use in CLI:
```shell cargo install localtunnel-cli
localtunnel-cli client --host https://localtunnel.me --subdomain kaichao --port 3000 ```
Use as a Rust library:
shell
cargo add localtunnel-client
```Rust use localtunnelclient::{opentunnel, broadcast};
let (notifyshutdown, _) = broadcast::channel(1); let result = opentunnel( Some("https://localtunnel.me"), Some("kaichao"), Some("locallhost"), 3000, notify_shutdown.clone(), 10, None, ).await;
// Shutdown the background tasks by sending a signal. let _ = notify_shutdown.send(()); ```
Use in CLI:
shell
localtunnel-cli server --domain localtunnel.me --port 3000 --proxy-port 3001 --secure
Use as a Rust library,
shell
cargo install localtunnel-server
```Rust use localtunnel_server::start;
start("localtunnel.me", 3000, true, 10, 3001, false).await? ```