Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaichaosun/rlt
Localtunnel implementation in Rust, expose local API to the public.
https://github.com/kaichaosun/rlt
localtunnel p2p proxy relay rust
Last synced: 6 days ago
JSON representation
Localtunnel implementation in Rust, expose local API to the public.
- Host: GitHub
- URL: https://github.com/kaichaosun/rlt
- Owner: kaichaosun
- License: mit
- Created: 2022-06-27T05:57:34.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-08T17:04:49.000Z (about 1 month ago)
- Last Synced: 2024-12-03T20:02:25.947Z (20 days ago)
- Topics: localtunnel, p2p, proxy, relay, rust
- Language: Rust
- Homepage:
- Size: 129 KB
- Stars: 98
- Watchers: 3
- Forks: 12
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Localtunnel
[![localtunnel](https://img.shields.io/crates/v/localtunnel.svg)](https://crates.io/crates/localtunnel)
[![localtunnel-client](https://img.shields.io/crates/v/localtunnel-client.svg)](https://crates.io/crates/localtunnel-client)
[![localtunnel-server](https://img.shields.io/crates/v/localtunnel-server.svg)](https://crates.io/crates/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:
```shell
cargo install localtunnellocaltunnel client --host https://your-domain.com --subdomain kaichao --port 3000
```Use as a Rust library:
```shell
cargo add localtunnel-client
``````Rust
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:
```shell
localtunnel server --domain your-domain.com --port 3000 --proxy-port 3001 --secure
```Use as a Rust library,
```shell
cargo install localtunnel-server
``````Rust
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](https://github.com/sponsors/kaichaosun)
## Resources
- [localtunnel](https://github.com/localtunnel/localtunnel)