Cloudflared Tunnel 模组
目录
什么是 Cloudflared Tunnel 模组?
Cloudflared Tunnel 模组是一款 Minecraft Fabric 模组,它将 Cloudflare Tunnel (cloudflared) 直接集成到你的 Minecraft 客户端中。它允许你创建隧道以连接到 Minecraft 服务器,而无需进行端口转发或处理动态 IP。
灵感来源
此解决方案的灵感来自于社区关于如何使用 Cloudflare 隧道进行游戏的讨论:
该模组自动化了这些帖子中讨论的所有手动步骤,使所有玩家都能轻松使用此方案。
工作原理
技术概览
-
自动初始化:当你启动安装了模组的 Minecraft 时,它会自动执行以下操作:
- 从 JAR 文件中提取
cloudflared.exe 可执行文件到 ./data/ 文件夹
- 使用你的配置启动 Cloudflare 隧道
- 将隧道连接到特定的本地端口
-
进程管理:模组管理整个 cloudflared 进程的生命周期:
- 自动启动进程
- 监控输出和日志
- 在需要时停止进程
- 如果隧道失败,则自动重新连接
网络架构
[你的 Minecraft] ←→ [本地隧道] ←→ [Cloudflare 边缘节点] ←→ [互联网] ←→ [其他玩家]
本地端口 cloudflared 全球网络 公共访问
安装
前置条件
- Minecraft 1.21.8
- Fabric Loader 0.16.14+
- Fabric API
- Java 21+
安装步骤
-
下载所需工具:
-
下载模组:
⚙️ 配置
? 配置文件
config/cloudflared-tunnel.properties 文件会自动创建:
# 使用随机端口(推荐,以避免与其他玩家冲突)
useRandomPort=true
# 固定端口(如果 useRandomPort=false)
fixedPort=25565
# 隧道主机名
hostname=play.exemple.com
# 自动添加到服务器列表
autoAddToServerList=true
# 列表中的服务器名称
serverName=Nosferk
菜单内配置
通过模组菜单访问配置界面以调整设置。
使用方法
基本用法
- 启动 Minecraft(已安装模组)
- 等待初始化:隧道将自动创建
- 检查日志:确认隧道已成功建立
监控
- 日志:查看
logs/latest.log 获取详细信息
- 进程:模组会自动管理 cloudflared 进程
重载
如果需要更改设置:
- 修改配置文件
- 使用模组 GUI 中的重载功能
- 隧道将自动重启
要求
系统
- Windows: Windows 10/11(原生支持)
- Linux: Ubuntu 18.04+ / Debian 9+ / CentOS 7+
- macOS: macOS 10.15+
Minecraft
- 版本: 1.21.8
- 加载器: Fabric 0.16.14+
- API: Fabric API
- Java: OpenJDK/Oracle JDK 21+
网络
- 连接: 稳定的互联网连接
- 端口: 对互联网的出站访问权限(HTTPS/80,443)
- 防火墙: 允许
cloudflared.exe 运行
故障排除
常见问题
“找不到 cloudflared.exe”
- 确保文件包含在
./data/ 文件夹中
- 检查文件夹权限
“隧道启动失败”
- 检查你的互联网连接
- 确保没有防火墙阻止
- 尝试使用不同的端口
“无法连接到服务器”
- 通过日志确认隧道处于活动状态
- 验证本地端口是否正确
- 先测试本地连接性
诊断
- 检查日志:
logs/latest.log
- 测试连通性:Ping cloudflare.com
- 检查进程:确保 cloudflared 正在运行
- 本地测试:尝试在局域网内连接
寻求帮助
贡献代码
欢迎贡献!请执行以下操作:
- Fork 仓库
- 创建 功能分支
- 提交 你的更改
- 推送 分支
- 打开 Pull Request
指南
- 遵循现有的代码规范
- 在适当处添加测试
- 记录重大更改
- 使用描述性的提交信息
许可证
本项目根据 Attribution-NonCommercial-NoDerivatives 4.0 International 许可证授权。
作者
Nosferk
Cloudflared Tunnel Mod
Table of Contents
What is the Cloudflared Tunnel Mod?
The Cloudflared Tunnel Mod is a Minecraft Fabric mod that integrates Cloudflare Tunnel (cloudflared) directly into your Minecraft client. It allows you to create tunnels to connect to Minecraft servers without needing port forwarding or dealing with dynamic IPs.
Where did the idea come from?
This solution was inspired by community discussions on how to use Cloudflare tunnels for gaming:
The mod automates all the manual steps discussed in these threads, making the solution accessible to all players.
How It Works
Technical Overview
-
Automatic Initialization: When you launch Minecraft with the mod installed, it automatically:
- Extracts the
cloudflared.exe executable from the JAR to the ./data/ folder
- Starts a Cloudflare tunnel using your configuration
- Connects the tunnel to a specific local port
-
Process Management: The mod manages the entire cloudflared process lifecycle:
- Starts the process automatically
- Monitors output and logs
- Stops the process when needed
- Reconnects automatically if the tunnel fails
Network Architecture
[Your Minecraft] ←→ [Local Tunnel] ←→ [Cloudflare Edge] ←→ [Internet] ←→ [Other Players]
Local Port cloudflared Global Network Public Access
Installation
Prerequisites
- Minecraft 1.21.8
- Fabric Loader 0.16.14+
- Fabric API
- Java 21+
Installation Steps
-
Download Required Tools:
-
Download the Mod:
- Place the
.jar file in your mods/ folder
⚙️ Configuration
? Configuration File
The config/cloudflared-tunnel.properties file is created automatically:
# Use random port (recommended to avoid conflicts with other players)
useRandomPort=true
# Fixed port (if useRandomPort=false)
fixedPort=25565
# Tunnel hostname
hostname=play.exemple.com
# Automatically add to server list
autoAddToServerList=true
# Server name in the list
serverName=Nosferk
In-Menu Configuration
Access the configuration menu via the mod menu to adjust settings.
How to Use
Basic Usage
- Launch Minecraft with the mod installed
- Wait for Initialization: The tunnel will be created automatically
- Check Logs: Confirm that the tunnel has been successfully established
Monitoring
- Logs: Check
logs/latest.log for detailed info
- Process: The mod automatically manages the cloudflared process
Reloading
If you need to change settings:
- Modify the configuration file
- Use the reload function in the mod’s GUI
- The tunnel will restart automatically
Requirements
System
- Windows: Windows 10/11 (native support)
- Linux: Ubuntu 18.04+ / Debian 9+ / CentOS 7+
- macOS: macOS 10.15+
Minecraft
- Version: 1.21.8
- Mod Loader: Fabric 0.16.14+
- APIs: Fabric API
- Java: OpenJDK/Oracle JDK 21+
Network
- Connection: Stable internet connection
- Ports: Outbound access to the internet (HTTPS/80,443)
- Firewall: Allow
cloudflared.exe to run
Troubleshooting
Common Issues
"cloudflared.exe not found"
- Make sure the file is included in the
./data/ folder
- Check folder permissions
"Failed to start tunnel"
- Check your internet connection
- Ensure there are no firewall blocks
- Try using a different port
"Cannot connect to server"
- Confirm the tunnel is active via logs
- Verify the local port is correct
- Test local connectivity first
Diagnostics
- Check Logs:
logs/latest.log
- Test Connectivity: Ping cloudflare.com
- Check Processes: Ensure cloudflared is running
- Test Locally: Try connecting on the local network
Getting Help
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a branch for your feature
- Commit your changes
- Push the branch
- Open a Pull Request
Guidelines
- Follow existing code conventions
- Add tests where appropriate
- Document significant changes
- Use descriptive commit messages
License
This project is licensed under the Attribution-NonCommercial-NoDerivatives 4.0 International license.
Author
Nosferk
评论 0
登录后参与评分
还没有评论,来抢沙发吧