agrinman/tunnelto

GitHub: agrinman/tunnelto

一款基于 Rust 和 Tokio 的内网穿透工具,能够将本地 Web 服务通过公网 URL 暴露到互联网。

Stars: 6044 | Forks: 460

BuildRelease crate GitHub Docker Registry crate

# `tunnelto` `tunnelto` 允许你通过公共 URL 将本地运行的 Web 服务器暴露出去。 使用 Rust 编写。基于 tokio 完全使用 async-io 构建。 1. [安装](#install) 2. [使用说明](#usage) 3. [自托管](#host-it-yourself) # 安装 ## Brew (macOS) ``` brew install agrinman/tap/tunnelto ``` ## Cargo ``` cargo install tunnelto ``` ## 所有平台 或者 **在此处下载适合你目标操作系统的版本**:[tunnelto/releases](https://github.com/agrinman/tunnelto/releases) # 使用 ## 快速开始 ``` tunnelto --port 8000 ``` 上述命令会打开一个隧道并将流量转发到 `localhost:8000`。 ## 更多选项: ``` tunnelto 0.1.14 USAGE: tunnelto [FLAGS] [OPTIONS] [SUBCOMMAND] FLAGS: -h, --help Prints help information -V, --version Prints version information -v, --verbose A level of verbosity, and can be used multiple times OPTIONS: --dashboard-address Sets the address of the local introspection dashboard -k, --key Sets an API authentication key to use for this tunnel --host Sets the HOST (i.e. localhost) to forward incoming tunnel traffic to [default: localhost] -p, --port Sets the port to forward incoming tunnel traffic to on the target host --scheme Sets the SCHEME (i.e. http or https) to forward incoming tunnel traffic to [default: http] -s, --subdomain Specify a sub-domain for this tunnel SUBCOMMANDS: help Prints this message or the help of the given subcommand(s) set-auth Store the API Authentication key ``` # 自托管 1. 为 musl 目标编译服务器。请参阅 `musl_build.sh`,了解如何使用 Docker 简单地完成此操作! 2. 请参阅 `Dockerfile`,它定义了一个运行该服务器二进制文件的简单 alpine 镜像。 3. 将镜像部署到你想要的任何地方。 ## 本地测试 ``` # 运行服务器:在 8080 端口接收 TCP 流量,并在 5000 端口进行控制 websockets ALLOWED_HOSTS="localhost" cargo run --bin tunnelto_server # 运行与本地 tunnelto_server 通信的本地 tunnelto 客户端 CTRL_HOST="localhost" CTRL_PORT=5000 CTRL_TLS_OFF=1 cargo run --bin tunnelto -- -p 8000 # 试一试! # 请记住,8080 是我们本地的 tunnelto TCP 服务器 curl -H '.localhost' "http://localhost:8080/some_path?with=somequery" ``` 请参阅 `tunnelto_server/src/config.rs` 了解用于配置的环境变量。 ## 自托管注意事项 该实现不支持多个运行中的服务器(即集中式协调)。 因此,如果你部署了多个服务器实例,只有当客户端连接到与远程 TCP 流相同的服务器实例时,它才能正常工作。 [我们托管的版本](https://tunnelto.dev) 是一个运行在出色的 [fly.io](https://fly.io) 服务上的正规分布式系统。 简而言之,fly.io 通过其 [Private Networking](https://fly.io/docs/reference/privatenetwork/) 功能使这一切变得非常简单。 请参阅 `tunnelto_server/src/network/mod.rs` 了解我们 gossip 机制的实现细节。
标签:Ngrok替代品, Rust, TCP隧道, Tokio, Webhook调试, 内网穿透, 反向代理, 可视化界面, 开发运维, 异步IO, 本地服务器暴露, 端口转发, 网络安全, 网络流量审计, 网络隧道, 请求拦截, 通知系统, 通知系统, 隐私保护, 隧道工具