TunnelMC 🌐
通过 ngrok、cloudflared 或 playit.gg 将任何本地端口暴露到互联网 —— 无需分配端口。包含一个完整的基于浏览器的管理仪表板。
TunnelMC 是一个 Bukkit/Spigot/Paper 插件,它会自动下载并管理 ngrok、cloudflared 和/或 playit.gg,为任何本地端口创建隧道,并在隧道就绪时将公共 URL 广播到控制台和在线的管理员(OPs)。
🆕 1.5.2 更新内容:Windows 上的 playit.gg
修复
- 已修复:playit.gg 在 Windows 上无法工作。 playit 代理在启动后立即停止(
not a named pipe path),导致 playit 隧道不断重启。
- 已修复:Bedrock 版和自定义的 playit.gg 隧道显示的地址缺少端口号,导致玩家无法连接。Java 版地址不需要端口号,因此保持不变。
- 已修复:32 位 ARM Linux(例如较旧的 Raspberry Pi OS)会为所有提供商下载 x64 程序。
- 对于 Unix socket 路径过深的服务器文件夹,现在会回退到使用临时文件夹来处理 playit。
同时包含自 1.5.1 以来的更新
如果您使用的是 1.5.0,请进行更新。 1.5.0 版本的仪表板登录功能完全失效。1.5.1 修复了该问题,以及随后全面审查中发现的问题,并已针对 Paper 26.3 API 确认无误。
安全
- 新安装将获得随机生成的仪表板密码,该密码会在控制台中打印一次并保存至
config.yml。此前,每次安装都使用 changeme。现有安装保留其当前密码,因此如果您的密码仍然是 changeme,请立即更改 —— 默认的 dashboard 隧道会使仪表板可从互联网访问。
- 已修复:登录锁定机制可被绕过,通过同时发送大量猜测请求,陌生人的错误猜测可能会将您自己的仪表板锁定。
- 已修复:超大的登录请求和未知的 API 地址 可能导致服务器内存和连接资源耗尽。
- 已修复:浏览器中打开的其他网站可能会向您的仪表板发送请求。
- ngrok 和 cloudflared 的令牌以及 playit.gg 的密钥不再出现在系统进程列表中。
隧道
- 已修复:崩溃、超时或在重启延迟期间停止和启动后,已停止的隧道可能在后台继续运行。
- 已修复:在隧道启动或二进制文件下载期间,服务器可能会冻结。
- 已修复:每当添加、编辑或删除任何隧道时,ngrok 预留域名都会丢失。
- 已修复:Windows 上的 playit.gg 下载了错误的程序。受影响的安装会自动修复。
- 已修复:如果 playit 代理崩溃,playit.gg 隧道永远不会恢复。
- ngrok 预留的 TCP 地址(如
1.tcp.ngrok.io:12345)现在可以在 hostname 中使用。
- 带引号的端口(
"25565")现在可以正常工作,而不是静默变为 8080,并且无效端口将被拒绝。
仪表板
- 已修复:包含
" 或 \ 的密码问题。 如果您从旧版仪表板设置了一个,请在 config.yml 中重新设置。
- 已修复:保存为 0 的设置 会被显示为默认值,然后被覆盖。
- 当您的会话结束时,仪表板现在会返回到登录屏幕,而不是静默冻结。
✨ 功能
🌐 三种隧道提供商 — ngrok、cloudflared 和 playit.gg,可按隧道配置。自由混合使用。
📡 UDP + 静态地址 (playit.gg) — 此处唯一提供稳定 UDP 地址的提供商,专为 Bedrock/Geyser 设计。也提供仅 TCP 和组合 TCP+UDP 隧道(需要 playit premium)。
🔑 多个 ngrok 账户 — 每个 ngrok 隧道都有自己独立的 authtoken(v3 版本必需)。同时运行不同的账户。
🚀 零设置快速隧道 — Cloudflared 快速隧道开箱即用,无需账户。
📌 自定义域名 — Cloudflared 命名隧道通过 Cloudflare Zero Trust 为您提供持久的自定义主机名。ngrok 隧道可以使用预留域名或 TCP 地址:在 ngrok 的仪表板中选择其中一个并将其放入 hostname,或者留空以便每次启动时生成随机的一个。
🖥️ Web 仪表板 — 完整的管理界面。实时创建/编辑/删除隧道,下载二进制文件,更改设置 —— 全部通过浏览器完成。保存的令牌绝不会发送回浏览器;编辑时留空字段以保持当前令牌不变。
⚡ 自动下载 — 检测操作系统和 CPU 架构,首次使用时下载正确的二进制文件。之后永久缓存。
🔔 即时 URL 广播 — 一旦隧道就绪,URL 就会发送到控制台和所有在线的管理员(OPs)。
🎮 完整的命令支持 — /tunnel 命令支持所有功能的 Tab 补全。
🔁 自动重启与崩溃循环保护 — 隧道失败后会自动重启。如果在短时间内失败次数过多,则停止重试。
🩺 健康检查 — ngrok 隧道获得 API 级别的检查;cloudflared 隧道获得进程存活检查。
🐋 兼容 Pterodactyl — 隧道是出站连接,因此永远不需要额外的端口分配。
📥 安装
- 将
TunnelMC.jar 放入 plugins/ 目录
- 启动服务器 —— TunnelMC 会生成其配置文件,打开一个指向仪表板的公共 cloudflared 隧道,并在控制台中打印 URL 和生成的密码
- 在浏览器中打开打印的 URL,并使用该密码登录
- 从仪表板配置隧道,或编辑
config.yml 并运行 /tunnel reload
⚙️ 配置
auto-start: false
default-region: "us" # ngrok 隧道的备用区域
notify-ops: true
auto-restart: true
restart-delay-seconds: 10
max-restarts: 5
crash-window-seconds: 60
health-check-interval-seconds: 30
dashboard:
enabled: true
port: 8090
bind-address: "127.0.0.1"
password: "" # 留空 = 首次启动时生成
auto-expose-on-first-run: true
tunnels:
# Cloudflared 快速隧道 —— 无需账户,随机 URL,仅限 HTTP
- name: "dashboard"
port: 8090
provider: "cloudflared"
auto-start: true
# ngrok HTTP 隧道,带有其自己的账户令牌
- name: "noderunner"
port: 8080
provider: "ngrok"
protocol: "http"
region: "us"
authtoken: "your-ngrok-token-here"
使用其他账户的 ngrok TCP 隧道
- name: "gameserver"
port: 25565
provider: "ngrok"
protocol: "tcp"
region: "eu"
authtoken: "another-account-token"
具有保留/静态域名的 ngrok 隧道(从 ngrok 仪表板选择)
对于 protocol: "tcp",请使用保留地址,例如 "1.tcp.ngrok.io:12345"
- name: "stable-web"
port: 8080
provider: "ngrok"
protocol: "http"
authtoken: "your-ngrok-token-here"
hostname: "your-reserved-domain.ngrok-free.dev"
Cloudflared 命名隧道 — 持久化自定义域名
- name: "mc"
port: 25565
provider: "cloudflared"
token: "your-cloudflare-zero-trust-token"
hostname: "mc.yourdomain.com"
playit.gg — 请先在仪表板中关联账户(设置选项卡);Bedrock 仅支持 UDP
- name: "bedrock"
port: 19132
provider: "playit"
playit-type: "minecraft-bedrock"
auto-start: true
每个隧道都需要一个唯一的名称。请使用字母、数字、`_` 和 `-`(仪表板仅接受这些字符)。
---
## 🎮 命令与权限
**权限:** `tunnelmc.admin` *(默认:OP)*
| 命令 | 描述 |
|---|---|
| `/tunnel start [name]` | 启动所有或特定隧道 |
| `/tunnel stop [name]` | 停止所有或特定隧道 |
| `/tunnel restart [name]` | 重启所有或特定隧道 |
| `/tunnel url [name]` | 显示公共 URL(s) |
| `/tunnel status` | 显示所有隧道状态 |
| `/tunnel download ngrok` | 下载 ngrok 二进制文件 |
| `/tunnel download cloudflared` | 下载 cloudflared 二进制文件 |
| `/tunnel download playit` | 下载 playit 二进制文件 |
| `/tunnel playit claim` | 打印链接以关联 playit.gg 账户 |
| `/tunnel playit status` | 显示 playit.gg 关联状态 |
| `/tunnel playit unlink` | 解除 playit.gg 关联并停止其隧道 |
| `/tunnel dashboard` | 显示仪表板端口信息 |
| `/tunnel reload` | 重新加载配置并重启隧道 |
---
## 📋 提供商对比
| | ngrok | Cloudflared 快速隧道 | Cloudflared 命名隧道 | playit.gg |
|---|:---:|:---:|:---:|:---:|
| 需要账户 | ✅ 免费 | ❌ 无 | ✅ 免费 | ✅ 免费 |
| HTTP 隧道 | ✅ | ✅ | ✅ | ✅(通过 TCP) |
| TCP 隧道 | ✅ | ❌ | ✅ | ✅(Java 预设免费;自定义 TCP 需高级版) |
| UDP 隧道 | ❌ | ❌ | ❌ | ✅(免费 — Bedrock 预设及自定义 UDP) |
| 持久化 URL | 仅限付费 | ❌ | ✅ | ✅ |
| 多账户支持 | ✅ 每隧道独立 | — | — | — |
| macOS 构建 | ✅ | ✅ | ✅ | ⚠️ TunnelMC 构建 |
---
## ⚠️ 免费计划说明
**ngrok 免费版:** 同时只能有一个活动隧道,每次重启时 URL 随机生成,除非你在 `hostname` 中设置了保留域名,且有带宽限制。所有 ngrok v3 隧道均需要 Authtoken。通过为每个隧道设置不同的 authtoken,你可以使用多个免费账户来绕过单隧道限制。
**Cloudflared 快速隧道:** 仅支持 HTTP,使用随机的 `*.trycloudflare.com` URL,无带宽限制。
**Cloudflared 命名隧道:** 需要 Cloudflare 账户(免费),支持任意协议,提供持久化的自定义域名。
---
## 🐋 Pterodactyl
无需额外的端口分配——隧道仅为出站连接。仪表板也绑定在本地,不需要分配的端口。
**下载缓慢?** 如果手动安装步骤耗时超过 30 秒,TunnelMC 会发出警告。请将二进制文件放置在 `plugins/TunnelMC/ngrok/ngrok`、`plugins/TunnelMC/cloudflared/cloudflared` 或 `plugins/TunnelMC/playit/playitd`,然后重启服务器。
---
## 📊 兼容性
| | |
|---|---|
| **平台** | Bukkit, Spigot, Paper, Purpur |
| **Minecraft** | 1.21.x – 26.3.x |
| **Java** | 25+(使用 Java 25 编译) |
| **操作系统** | Linux, macOS, Windows |
| **架构** | x64, ARM64 |
> ⚠️ **macOS + playit.gg:** ngrok 和 cloudflared 提供官方 macOS 构建版本,可正常运行。对于 playit.gg,TunnelMC 使用其自建的 `playitd` 版本(SHA-256 验证),可在仪表板的“设置”选项卡中找到,同时也提供了自行构建的说明。
---
## 🔗 相关内容
**[NodeRunner](https://modrinth.com/plugin/noderunner)** — 在你的 Minecraft 服务器内运行 Node.js Discord 机器人。
**[PyRunner](https://modrinth.com/plugin/pyrunner)** — 在你的 Minecraft 服务器内运行 Python Discord 机器人。
*TunnelMC 与两者完美搭配——将 Cloudflared 快速隧道指向 8080 端口,即可零端口分配地公开访问它们的仪表板。*
---
*由 [Spider](https://github.com/Spider2742) 开发*
TunnelMC 🌐
Expose any local port to the internet via ngrok, cloudflared, or playit.gg — no port allocations needed. Includes a full browser-based management dashboard.
TunnelMC is a Bukkit/Spigot/Paper plugin that automatically downloads and manages ngrok, cloudflared, and/or playit.gg, creates tunnels for any local port, and broadcasts the public URL to console and online OPs the moment the tunnel is ready.
🆕 What's New in 1.5.2: playit.gg on Windows
Fixes
- Fixed: playit.gg didn't work on Windows. The playit agent stopped right after starting (
not a named pipe path), so playit tunnels kept restarting.
- Fixed: Bedrock and custom playit.gg tunnels showed an address without its port, so players couldn't connect. Java Edition addresses don't need one and are unchanged.
- Fixed: 32-bit ARM Linux (such as older Raspberry Pi OS) downloaded x64 programs for every provider.
- A server folder too deep for a Unix socket path now falls back to the temp folder for playit.
Also included from 1.5.1
If you're on 1.5.0, please update. The 1.5.0 dashboard login didn't work at all. 1.5.1 fixed that, plus the issues found in a full review afterwards, and was confirmed against the Paper 26.3 API.
Security
- New installs get a random dashboard password, printed once in the console and saved to
config.yml. Before, every install used changeme. Existing installs keep their current password, so if yours is still changeme, change it now — the default dashboard tunnel makes the dashboard reachable from the internet.
- Fixed: the login lockout could be bypassed by sending many guesses at once, and one stranger's bad guesses could lock you out of your own dashboard.
- Fixed: oversized login requests and unknown API addresses could tie up server memory and connections.
- Fixed: other websites open in your browser could send requests to your dashboard.
- ngrok and cloudflared tokens and the playit.gg secret no longer appear in the system's process list.
Tunnels
- Fixed: stopped tunnels could keep running in the background after a crash, a timeout, or a stop and start during the restart delay.
- Fixed: the server could freeze while tunnels were starting or a binary was downloading.
- Fixed: ngrok reserved domains were lost whenever any tunnel was added, edited or deleted.
- Fixed: playit.gg on Windows downloaded the wrong program. An affected install is repaired automatically.
- Fixed: playit.gg tunnels never recovered if the playit agent crashed.
- ngrok reserved TCP addresses (like
1.tcp.ngrok.io:12345) now work in hostname.
- A port in quotes (
"25565") now works instead of silently becoming 8080, and invalid ports are refused.
Dashboard
- Fixed: passwords containing
" or \. If you set one from an older dashboard, set it again in config.yml.
- Fixed: settings saved as 0 were shown as defaults and then overwritten.
- When your session ends, the dashboard now returns to the login screen instead of silently freezing.
✨ Features
🌐 Three Tunnel Providers — ngrok, cloudflared, and playit.gg, configurable per tunnel. Mix them freely.
📡 UDP + Static Addresses (playit.gg) — the only provider here with a stable UDP address, built for Bedrock/Geyser. TCP-only and combined TCP+UDP tunnels are also available (require playit premium).
🔑 Multiple ngrok Accounts — Each ngrok tunnel has its own authtoken (required for v3). Run different accounts simultaneously.
🚀 Zero-Setup Quick Tunnels — Cloudflared quick tunnels work out of the box with no account.
📌 Custom Domains — Cloudflared named tunnels give you persistent custom hostnames via Cloudflare Zero Trust. ngrok tunnels can use a reserved domain or TCP address: pick one in ngrok's dashboard and put it in hostname, or leave it blank for a random one each start.
🖥️ Web Dashboard — Full management UI. Create/edit/delete tunnels live, download binaries, change settings — all from a browser. Saved tokens are never sent back to the browser; leave the field blank when editing to keep the current one.
⚡ Auto-Download — Detects OS and CPU arch, downloads the right binary on first use. Cached forever after.
🔔 Instant URL Broadcast — URL goes to console and all online OPs the moment the tunnel is ready.
🎮 Full Command Support — /tunnel with tab completion for everything.
🔁 Auto-Restart & Crash Loop Protection — Tunnels restart after failure. Stops retrying if it fails too many times in a short window.
🩺 Health Checks — ngrok tunnels get API-level checks; cloudflared tunnels get process-alive checks.
🐋 Pterodactyl Compatible — Tunnels are outbound connections, so no extra port allocations are ever needed.
📥 Installation
- Drop
TunnelMC.jar into plugins/
- Start the server — TunnelMC generates its config, opens a public cloudflared tunnel to the dashboard, and prints the URL and a generated password in the console
- Open the printed URL in your browser and log in with that password
- Configure tunnels from the dashboard, or edit
config.yml and run /tunnel reload
⚙️ Configuration
auto-start: false
default-region: "us" # fallback region for ngrok tunnels
notify-ops: true
auto-restart: true
restart-delay-seconds: 10
max-restarts: 5
crash-window-seconds: 60
health-check-interval-seconds: 30
dashboard:
enabled: true
port: 8090
bind-address: "127.0.0.1"
password: "" # blank = generated on first start
auto-expose-on-first-run: true
tunnels:
# Cloudflared quick tunnel — no account, random URL, HTTP only
- name: "dashboard"
port: 8090
provider: "cloudflared"
auto-start: true
# ngrok HTTP tunnel with its own account token
- name: "noderunner"
port: 8080
provider: "ngrok"
protocol: "http"
region: "us"
authtoken: "your-ngrok-token-here"
# ngrok TCP tunnel from a different account
- name: "gameserver"
port: 25565
provider: "ngrok"
protocol: "tcp"
region: "eu"
authtoken: "another-account-token"
# ngrok tunnel with a reserved/static domain (picked from ngrok's dashboard)
# For protocol: "tcp", use a reserved address such as "1.tcp.ngrok.io:12345" instead
- name: "stable-web"
port: 8080
provider: "ngrok"
protocol: "http"
authtoken: "your-ngrok-token-here"
hostname: "your-reserved-domain.ngrok-free.dev"
# Cloudflared named tunnel — persistent custom domain
- name: "mc"
port: 25565
provider: "cloudflared"
token: "your-cloudflare-zero-trust-token"
hostname: "mc.yourdomain.com"
# playit.gg — link an account from the dashboard first (Settings tab); Bedrock is UDP-only
- name: "bedrock"
port: 19132
provider: "playit"
playit-type: "minecraft-bedrock"
auto-start: true
Each tunnel needs its own name. Use letters, numbers, _ and - (the dashboard only accepts these).
🎮 Commands & Permissions
Permission: tunnelmc.admin (default: OP)
| Command |
Description |
/tunnel start [name] |
Start all or a specific tunnel |
/tunnel stop [name] |
Stop all or a specific tunnel |
/tunnel restart [name] |
Restart all or a specific tunnel |
/tunnel url [name] |
Show public URL(s) |
/tunnel status |
Show all tunnel status |
/tunnel download ngrok |
Download ngrok binary |
/tunnel download cloudflared |
Download cloudflared binary |
/tunnel download playit |
Download playit binary |
/tunnel playit claim |
Print a link to link a playit.gg account |
/tunnel playit status |
Show playit.gg link status |
/tunnel playit unlink |
Unlink playit.gg and stop its tunnels |
/tunnel dashboard |
Show dashboard port info |
/tunnel reload |
Reload config and restart tunnels |
📋 Provider Comparison
|
ngrok |
Cloudflared Quick |
Cloudflared Named |
playit.gg |
| Account required |
✅ free |
❌ none |
✅ free |
✅ free |
| HTTP tunnels |
✅ |
✅ |
✅ |
✅ (via TCP) |
| TCP tunnels |
✅ |
❌ |
✅ |
✅ (Java preset free; custom TCP-only needs premium) |
| UDP tunnels |
❌ |
❌ |
❌ |
✅ (free — Bedrock preset and custom UDP) |
| Persistent URL |
paid only |
❌ |
✅ |
✅ |
| Multiple accounts |
✅ per-tunnel |
— |
— |
— |
| macOS build |
✅ |
✅ |
✅ |
⚠️ TunnelMC-built |
⚠️ Free Plan Notes
ngrok free: one active tunnel at a time, random URL on each restart unless you set a reserved domain in hostname, bandwidth limits. Authtoken is required for all ngrok v3 tunnels. Per-tunnel authtokens let you use multiple free accounts to work around the one-tunnel limit.
Cloudflared quick tunnels: HTTP only, random *.trycloudflare.com URL, no bandwidth limits.
Cloudflared named tunnels: require a Cloudflare account (free), any protocol, persistent custom domain.
🐋 Pterodactyl
No extra port allocations needed — tunnels are outbound connections only. The dashboard also binds locally and doesn't need an allocated port.
Slow download? TunnelMC will warn after 30 seconds with manual install steps. Place the binary at plugins/TunnelMC/ngrok/ngrok, plugins/TunnelMC/cloudflared/cloudflared, or plugins/TunnelMC/playit/playitd and restart.
📊 Compatibility
|
|
| Platforms |
Bukkit, Spigot, Paper, Purpur |
| Minecraft |
1.21.x – 26.3.x |
| Java |
25+ (compiled with Java 25) |
| OS |
Linux, macOS, Windows |
| Arch |
x64, ARM64 |
⚠️ macOS + playit.gg: ngrok and cloudflared ship official macOS builds and work normally. For playit.gg, TunnelMC uses its own playitd build (SHA-256 verified), available from the dashboard's Settings tab along with self-build instructions.
🔗 Related
NodeRunner — Run a Node.js Discord bot inside your Minecraft server.
PyRunner — Run a Python Discord bot inside your Minecraft server.
TunnelMC pairs perfectly with both — a cloudflared quick tunnel to port 8080 makes their dashboards publicly accessible with zero port allocation.
Developed by Spider
评论 0
登录后参与评分
还没有评论,来抢沙发吧