Modflared
无需单独安装 cloudflared,即可自动连接到 Cloudflare 隧道。
此模组尚未经过充分测试!
使用方法
要使用此模组,您的操作系统必须是 Windows、Linux 或 MacOS。
其他资源
如需更详细的说明,您可以阅读 Adalie 的博客文章。
配置 Cloudflared
您需要先在服务器上设置 Cloudflare 才能使此功能正常工作。网上有许多关于如何操作的指南。
请确保在您的配置文件(可能位于 /etc/cloudflared/config.yml)中包含以下行:
- hostname: example.domain.net
service: tcp://localhost:25565
将 example.domain.net 替换为您想要使用的正确子域名。如果您正在运行多个实例(例如使用 Docker),请将端口 25565 更改为您正在使用的任意端口。
重新启动 Cloudflare 守护进程(sudo systemctl restart cloudflared)以应用更改。
添加正确的 DNS 记录:前往 Cloudflare 仪表板,进入您的网站和 DNS 记录页面,然后添加一个新的 CNAME DNS 记录,主机名为您的子域名,目标设置为 <tunnelID>.cfargotunnel.com,其中 tunnel ID 可在 cloudflare config.yml 文件中找到。
示例 DNS 记录

对于玩家
如果您的服务器管理员已正确配置了服务器,您应该可以像往常一样连接至服务器。
无需额外配置。
如果您的服务器管理员未正确配置服务器,则需要将其服务器添加到 modflared 配置文件夹中的 forced_tunnels.json 文件里。
配置示例 (modflared/forced_tunnels.json)
["example.domain.net", "example2.domain.net"]
服务器管理员(设置 cloudflared)
按照上述“配置 Cloudflared”部分中的描述安装 Cloudflared。
告知 modflared 使用 cloudflared 连接到您的服务器
为您希望玩家连接的域名(例如 example.domain.net)创建一个 TXT DNS 记录,值可以是以下任一选项:
cloudflared-use-tunnel - 这将使 modflared 直接通过该主机名(例如 example.domain.net)连接到隧道
cloudflared-route=<route> - 这将使 modflared 通过 <route> 的主机名连接到隧道。
(例如,设置 cloudflared-route=example2.domain.net 将使 modflared 连接到 example2.domain.net 上的隧道,而不是 example.domain.net)
Modflared
Automatically connects you to a Cloudflare tunnel without having to install cloudflared separately.
This mod has not yet been fully tested!
How to use
To be able to use the mod you have to be on the operating system Windows, Linux, or MacOS.
Other resources
For more detailed instructions, you can read Adalie's blog post.
Configuring Cloudflared
You need to set up cloudflare on your server for this to work. There's plenty of guides on how to do this elsewhere.
Make sure in your config file (possibly in /etc/cloudflared/config.yml) you have the lines:
- hostname: example.domain.net
service: tcp://localhost:25565
Replace example.domain.net with the correct subdomain you want to use. If you're running multiple instances (eg. with docker), change the port 25565 to whatever port you're using.
Restart the cloudflare daemon (sudo systemctl restart cloudflared) to apply the changes.
Add the correct DNS entry: go to Cloudflare dashboard, go to your website and DNS entries, then add a new CNAME DNS entry with your subdomain and set the target to <tunnelID>.cfargotunnel.com, with the tunnel ID found in the cloudflare config.yml file.
Example DNS Entries

For Players
If your server admin has properly configured their server you should be able to connect to the server as usual.
No extra configuration is needed.
If your server admin has not properly configured their server, you will need to add their server to the forced_tunnels.json file in the modflared config folder.
Example configuration (modflared/forced_tunnels.json)
["example.domain.net", "example2.domain.net"]
Server Admins (Setting Up cloudflared)
Install Cloudflared as described in the “Configuring Cloudflared” part above.
Telling modflared to use connect to your server using cloudflared
For the hostname that you want your players to connect to (eg. example.domain.net), create a TXT dns record with either of the following values:
cloudflared-use-tunnel - This will make modflared connect to the tunnel on the hostname itself (eg. example.domain.net)
cloudflared-route=<route> - This will make modflared connect to the tunnel under the hostname of <route>.
(ex. setting cloudflared-route=example2.domain.net will make modflared connect to the tunnel on example2.domain.net instead of example.domain.net)
评论 0
登录后参与评分
还没有评论,来抢沙发吧