返回顶部
r

rustunnelrustunnel隧道

Expose local services via secure tunnels using rustunnel MCP server. Create public URLs for local HTTP/TCP services for testing, webhooks, and deployment.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.3.1
安全检测
已通过
187
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

rustunnel

Rustunnel - 安全隧道管理

使用 rustunnel 通过公共 URL 暴露本地服务(HTTP/TCP)。非常适合测试 Webhook、共享本地开发环境以及部署工作流。

使用场景

  • - Webhook 测试 - 暴露本地服务器以接收来自外部服务的 Webhook
  • 演示共享 - 与利益相关者共享本地开发环境
  • CI/CD 集成 - 暴露预览环境
  • 数据库访问 - 暴露本地 TCP 服务(PostgreSQL、Redis 等)
  • 移动端测试 - 针对本地后端测试移动应用

⚠️ 重要提示:使用 MCP 工具,而非 CLI

始终使用 MCP 工具进行隧道管理。 它们会自动处理生命周期。

方法生命周期推荐
MCP 工具(createtunnel、closetunnel)自动清理✅ 是
CLI(rustunnel http 3000)
手动进程管理 | ❌ 仅限云沙箱 |

为什么选择 MCP 工具?

  • - 关闭时自动清理
  • 无孤立进程
  • 正确的隧道生命周期管理
  • 返回 tunnel_id 用于跟踪



配置文件

位置: ~/.rustunnel/config.yml

此文件存储您的服务器地址和认证令牌。代理将从此文件读取,而不是每次都询问。

格式:
yaml

rustunnel 配置


文档:https://github.com/joaoh82/rustunnel

server: edge.rustunnel.com:4040
auth_token: your-token-here

tunnels:
expense_tracker:
proto: http
local_port: 3000
# api:
# proto: http
# local_port: 8080
# subdomain: myapi

首次设置

使用隧道前,请确保配置文件存在:

  1. 1. 检查配置文件是否存在: ~/.rustunnel/config.yml
  2. 如果不存在,询问用户: 您的 rustunnel 认证令牌和服务器地址是什么?
  3. 直接创建配置文件:
bash mkdir -p ~/.rustunnel chmod 700 ~/.rustunnel
  1. 4. 使用用户的令牌写入配置:
yaml server: <用户提供的服务器> auth_token: <用户提供的令牌>
  1. 5. 设置权限: chmod 600 ~/.rustunnel/config.yml

代理工作流

始终遵循以下顺序:

步骤 1:检查配置

bash

检查配置是否存在


cat ~/.rustunnel/config.yml

如果配置存在且包含 auth_token: 读取令牌并继续。

如果配置缺失:

  1. 1. 询问用户:您的 rustunnel 认证令牌和服务器地址是什么?
  2. 直接创建配置文件:

bash
mkdir -p ~/.rustunnel
chmod 700 ~/.rustunnel

  1. 3. 使用用户的令牌写入配置:
yaml server: <用户提供的服务器> auth_token: <用户提供的令牌>
  1. 4. 设置权限:chmod 600 ~/.rustunnel/config.yml

步骤 2:从配置读取令牌

进行工具调用时,从 ~/.rustunnel/config.yml 读取 auth_token:
yaml
auth_token: your-token-here
server: edge.rustunnel.com:4040

在工具调用中使用这些值 - 不要每次都询问用户。

步骤 3:使用 MCP 工具

使用从配置中获取的令牌,直接调用 MCP 工具。



MCP 工具(推荐)

create_tunnel

暴露本地端口并获取公共 URL。

参数:

参数类型必填描述
token字符串API 令牌(从配置读取)
local_port
整数 | 是 | 要暴露的本地端口 |
| protocol | http \| tcp | 是 | 隧道类型 |
| subdomain | 字符串 | 否 | 自定义子域名(仅限 HTTP) |
| region | 字符串 | 否 | 区域 ID(例如 eu、us、ap)。省略则自动选择。使用 list_regions 查看选项。 |

返回:
json
{
public_url: https://abc123.edge.rustunnel.com,
tunnel_id: a1b2c3d4-...,
protocol: http
}

生命周期: 隧道保持开放,直到调用 close_tunnel 或 MCP 服务器退出。

close_tunnel

通过 ID 关闭隧道。公共 URL 立即停止工作。

参数:

参数类型必填描述
token字符串API 令牌
tunnelid
字符串 | 是 | 来自 createtunnel 的 UUID |

这是关闭隧道的正确方式。 无孤立进程。

list_tunnels

列出所有当前活动的隧道。

参数:

参数类型必填描述
token字符串API 令牌(从配置读取)

返回: 隧道对象的 JSON 数组。

gettunnelhistory

检索过去隧道的历史记录。

参数:

参数类型必填描述
token字符串API 令牌
protocol
http \| tcp | 否 | 按协议筛选 |
| limit | 整数 | 否 | 最大条目数(默认:25) |

list_regions

列出可用的隧道服务器区域。无需认证。

参数:

返回: 区域对象的 JSON 数组:
json
[
{ id: eu, name: Europe, location: Helsinki, FI, host: eu.edge.rustunnel.com, control_port: 4040, active: true }
]

getconnectioninfo

返回 CLI 命令字符串,不启动任何进程。当 MCP 无法生成子进程(云沙箱、容器)或您更愿意自己运行 CLI 时使用。

参数:

参数类型必填描述
token字符串API 令牌
local_port
整数 | 是 | 要暴露的本地端口 |
| protocol | http \| tcp | 是 | 隧道类型 |
| region | 字符串 | 否 | 区域 ID(例如 eu)。省略则自动选择。 |

返回:
json
{
cli_command: rustunnel http 3000 --server edge.rustunnel.com:4040 --token abc123,
server: edge.rustunnel.com:4040,
install_url: https://github.com/joaoh82/rustunnel/releases/latest
}



常见工作流




常见工作流

1. 暴露本地 API(MCP 工具)

  1. 1. 从 ~/.rustunnel/config.yml 读取 authtoken
  2. 创建隧道:createtunnel(token, localport=3000, protocol=http)
  3. 存储 tunnelid 以便后续清理
  4. 向用户返回 publicurl
  5. 完成后:closetunnel(token, tunnel_id)

2. 自定义子域名

  1. 1. 从配置读取 authtoken
  2. createtunnel(token, localport=5173, protocol=http, subdomain=myapp-preview)
  3. 返回 URL:https://myapp-preview.edge.rustunnel.com
  4. 完成后 closetunnel(token, tunnel_id)

3. TCP 隧道(数据库)

  1. 1. 从配置读取 authtoken
  2. createtunnel(token, localport=5432, protocol=tcp)
  3. 返回 tcp://host:port 用于连接
  4. 完成后 closetunnel(token, tunnel_id)

4. 云沙箱(CLI 回退)

  1. 1. 从配置读取 authtoken
  2. getconnectioninfo(token, localport=3000, protocol=http)
  3. 输出 CLI 命令供用户在本地运行
  4. 用户运行命令
  5. listtunnels(token) 验证并获取 publicurl
  6. 完成后,用户按 Ctrl+C 终止 CLI 进程

先决条件

  1. 1. 已安装

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 rustunnel-1776271274 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 rustunnel-1776271274 技能

通过命令行安装

skillhub install rustunnel-1776271274

下载

⬇ 下载 rustunnel v1.3.1(免费)

文件大小: 3.68 KB | 发布时间: 2026-4-17 15:58

v1.3.1 最新 2026-4-17 15:58
- Added new optional region selection to create_tunnel and get_connection_info commands (useful for choosing server region).
- Introduced list_regions method to enumerate available rustunnel server regions.
- Documentation updated to reflect new parameters and region workflows.
- No code changes; documentation only.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部