Описание
# Cloudflared Tunnel Mod
---
## Table of Contents
* [What is the Cloudflared Tunnel Mod?](#-what-is-the-cloudflared-tunnel-mod)
* [How It Works](#-how-it-works)
* [Installation](#-installation)
* [Configuration](#-configuration)
* [How to Use](#-how-to-use)
* [Requirements](#-requirements)
* [Troubleshooting](#-troubleshooting)
* [Contributing](#-contributing)
* [License](#-license)
---
## 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:
* **[Running a Minecraft Server](https://www.reddit.com/r/CloudFlare/comments/wdpe1p/cloudflare_tunnel_running_a_minecraft_server/)** – Reddit discussion on hosting Minecraft servers via Cloudflare Tunnel
* **[Is it possible to use a tunnel?](https://community.cloudflare.com/t/its-possible-to-use-a-tunnel-to-open-a-minecraft-server/619949)** – Official Cloudflare Community thread exploring technical feasibility
* **[Hosting through Cloudflare](https://www.reddit.com/r/CloudFlare/comments/1iw2fjt/hosting_a_minecraft_server_through_cloudflare/)** – Community experiences with server hosting
The mod automates all the manual steps discussed in these threads, making the solution accessible to all players.
---
## How It Works
### Technical Overview
1. **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
2. **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**
1. **Download Required Tools**:
* [Fabric](https://fabricmc.net/use/installer/)
* [Fabric API](https://modrinth.com/mod/fabric-api)
2. **Download the Mod**:
* Place the `.jar` file in your `mods/` folder
---
## ⚙️ Configuration
### 📁 **Configuration File**
The `config/cloudflared-tunnel.properties` file is created automatically:
```properties
# 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**
1. **Launch Minecraft** with the mod installed
2. **Wait for Initialization**: The tunnel will be created automatically
3. **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:
1. Modify the configuration file
2. Use the reload function in the mod’s GUI
3. 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**
1. **Check Logs**: `logs/latest.log`
2. **Test Connectivity**: Ping cloudflare.com
3. **Check Processes**: Ensure cloudflared is running
4. **Test Locally**: Try connecting on the local network
### **Getting Help**
* **Issues**: [GitHub Issues](https://github.com/Nosferk/Cloudflared-Tunnel-Mod/issues)
* **Docs**: [Project Wiki](https://nosferk.com/projects/cloudflared-tunnel)
* **Website**: [nosferk.com](https://nosferk.com/projects/cloudflared-tunnel)
---
## Contributing
Contributions are welcome! Please:
1. **Fork** the repository
2. **Create** a branch for your feature
3. **Commit** your changes
4. **Push** the branch
5. **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**
* Website: [nosferk.com](https://nosferk.com)
* Project: [Cloudflared Tunnel](https://nosferk.com/projects/cloudflared-tunnel)
* GitHub: [@Nosferk](https://github.com/Nosferk)
---