8个版本
0.1.3 | 2024年5月22日 |
---|---|
0.1.2 | 2023年6月3日 |
0.1.1 | 2023年4月24日 |
0.1.0 | 2023年2月27日 |
0.0.11 | 2022年11月23日 |
#2 in #hole
每月下载量44次
用于localtunnel
10KB
164 行
Localtunnel
Localtunnel将您的localhost端点暴露给世界,用例包括
- API测试
- 多设备访问单个数据存储
- 点对点连接,NAT打洞的解决方案。
客户端使用
已知问题:公共代理服务器已关闭,请设置自己的服务器。
在CLI中使用
cargo install localtunnel
localtunnel client --host https://init.so --subdomain kaichao --port 3000
作为Rust库使用
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(());
服务器使用
在CLI中使用
localtunnel server --domain init.so --port 3000 --proxy-port 3001 --secure
作为Rust库使用
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?
赞助商
请帮助我构建开源软件 👉 GitHub Sponsors
资源
依赖关系
~8–20MB
~309K SLoC