Skip to content

kaichaosun/rlt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d907d41 Â· Dec 16, 2024
Nov 3, 2024
Nov 8, 2024
Dec 12, 2024
Dec 12, 2024
Jan 31, 2024
Dec 16, 2024
Nov 7, 2022
Jan 31, 2024
Nov 8, 2024
Oct 30, 2024
Jun 2, 2023
Jul 6, 2023
Nov 9, 2022
Dec 12, 2024
Mar 7, 2024

Repository files navigation

Localtunnel

localtunnel localtunnel-client localtunnel-server

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.

Client Usage

Known issue: the public proxy server is down, please setup your own server.

Use in CLI:

cargo install localtunnel

localtunnel client --host https://your-domain.com --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://your-domain.com".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(());

Server Usage

Use in CLI:

localtunnel server --domain your-domain.com --port 3000 --proxy-port 3001 --secure

Use as a Rust library,

cargo install localtunnel-server
use localtunnel_server::{start, ServerConfig};

let config = ServerConfig {
    domain: "your-domain.com".to_string(),
    api_port: 3000,
    secure: true,
    max_sockets: 10,
    proxy_port: 3001,
    require_auth: false,
};

start(config).await?

Sponsor

Please help me build OSS 👉 GitHub Sponsors

Resources