v0.8.1 · Dual-mode tunneling · Open source · MIT

All-protocol tunneling tool

Free Cloudflare tunneling + self-hosted Relay tunneling, one tool for every use case

Cloud Mode
Relay Mode
zsh
$ cftunnel quick 3000
✔ Tunnel started: https://xxx-yyy-zzz.trycloudflare.com
$ cftunnel relay add mc --local 25565 --proto tcp
✔ Rule added: tcp://localhost:25565 → remote:25565
6
Platforms
1
One-command tunnel
0
Cost
All
Protocols
COMMUNITY

Join the Telegram Community

Get free tunneling tutorials, Cloud + Relay updates, practical tips, and community support.

Join Now
Features

Two engines, every scenario

Zero-cost HTTP/WS tunnels with Cloud mode, plus self-hosted TCP/UDP Relay tunnels

Cloud Mode

Cloudflare Tunnel for free HTTP/HTTPS/WebSocket tunnels with automatic TLS and global CDN acceleration

Relay Mode

Self-hosted frp Relay for TCP/UDP tunnels, ideal for game servers, SSH, databases, and more

One-command tunneling

Run cftunnel quick 3000 to tunnel localhost:3000 instantly

One-click terminal sharing

Use --share for a QR code, clipboard copy, and Telegram share link

6 platforms supported

macOS / Linux / Windows, with ARM64 + AMD64 builds

Custom domain

Bind your domain with automatic DNS and TLS configuration

System service

Register launchd / systemd / Windows Service for startup on boot

Automatic cloudflared install

Detect your platform and download the right binary automatically

Self-update

Upgrade to the latest version with cftunnel update

Live logs

Cross-platform Go tail for real-time tunnel logs

Open source and free

MIT licensed, fully open source, and community-driven

Access protection

Enable password protection with --auth and the built-in auth proxy

Desktop client

Manage tunnels in a GUI if you prefer not to use the command line

Architecture

Dual-mode architecture

Two tunnel paths for different scenarios

Cloud Mode

localhost:PORT
↓ Local traffic
cftunnel
↓ Process manager
cloudflared
↓ QUIC tunnel
Cloudflare Edge
↓ Global CDN
Public users

Relay Mode

localhost:PORT
↓ Local traffic
cftunnel (frpc)
↓ TCP/UDP tunnel
Your server (frps)
↓ Public port mapping
Remote access
Compare

Mode comparison

Choose the right tunnel mode for your scenario

FeatureCloud ModeRelay Mode
ProtocolsHTTP / HTTPS / WebSocketTCP / UDP / All protocols
RequiresCloudflare account (free)One public server
DomainFree random domain / custom domainDirect server IP
EncryptionAutomatic TLS + Cloudflare CDNBuilt-in frp encryption
CostCompletely freeServer cost
Typical use casesWeb development, API debugging, WebhooksGame servers, SSH, databases, RDP
Start commandcftunnel quick 3000cftunnel quick 25565 --relay
Commands

Command reference

Common commands for both modes

Cloud Mode
Relay Mode
cftunnel init
Initialize configuration (API Token + Account ID)
cftunnel quick 3000
Tunnel local port 3000 (no domain required)
cftunnel quick 3000 --share
Share with a QR code, clipboard, and Telegram
cftunnel preset frontend
Start the 5173 frontend preset
cftunnel history
List recently used local ports
cftunnel create mytunnel
Create a named tunnel
cftunnel add myapp 8080 --domain app.example.com
Add a domain route
cftunnel remove myapp
Remove a domain route
cftunnel up
Start the tunnel
cftunnel down
Stop the tunnel
cftunnel logs
View live logs
cftunnel install
Register a system service (start on boot)
cftunnel destroy
Delete tunnel + DNS + configuration
cftunnel relay init
Initialize Relay config (server address + Token)
cftunnel relay add web --local 8080 --proto tcp
Add a TCP tunnel rule
cftunnel relay add mc --local 25565 --proto tcp
Tunnel a Minecraft server
cftunnel relay add voice --local 9987 --proto udp
Tunnel a UDP port (for example, voice services)
cftunnel relay remove web
Remove a tunnel rule
cftunnel relay up
Start the Relay connection
cftunnel relay down
Stop the Relay connection
cftunnel relay list
List all tunnel rules
cftunnel relay install
Register the Relay system service
cftunnel relay server setup
Install the frps server over SSH
cftunnel relay logs
View Relay logs
Troubleshoot

Troubleshooting

Common fixes for frequent issues

QUIC connection timeout

Some networks block UDP/443. Fix: set --protocol http2 to fall back to HTTP/2, or check your firewall rules.

fake-IP conflict

The fake-IP mode in Clash and similar proxies may hijack Cloudflare DNS. Fix: add trycloudflare.com to your direct-connection rules.

Error 1033

Cloudflare Argo Tunnel error, usually caused by a mismatched tunnel configuration. Fix:cftunnel down then run cftunnel up,or delete and recreate the tunnel.

Error 530

DNS points to the wrong tunnel. Fix: verify that the DNS CNAME targets the correct tunnel UUID, then use cftunnel remove to clean it up and add it again.

Install

Quick Install

Choose your platform and run one command

macOS / Linux
Windows
Build from source
# Uses a mirror automatically when available
curl -fsSL https://raw.githubusercontent.com/qingchencloud/cftunnel/main/install.sh | bash

# If GitHub is slow, download from a mirror manually:
# curl -fsSL https://ghfast.top/https://github.com/qingchencloud/cftunnel/releases/latest/download/cftunnel_linux_amd64.tar.gz -o cftunnel.tar.gz
# tar xzf cftunnel.tar.gz && sudo install -m 755 cftunnel /usr/local/bin/
irm https://raw.githubusercontent.com/qingchencloud/cftunnel/main/install.ps1 | iex
git clone https://github.com/qingchencloud/cftunnel.git
cd cftunnel
go build -o cftunnel .
Quick Start

Three modes, choose what fits

Go from zero to a tunnel in 3 minutes

1

Quick tunnel

No Cloudflare account needed; get a random URL for quick sharing and debugging

cftunnel quick 3000
2

Custom domain

Bind your domain with a Cloudflare account and API Token

cftunnel init
cftunnel create mytunnel
cftunnel add myapp 8080 --domain app.example.com
cftunnel up
3

Relay mode

Run your own Relay server for full TCP/UDP tunneling

cftunnel relay init
cftunnel relay add mc --local 25565 --proto tcp
cftunnel relay up
Server

Relay server deployment

Deploy frps on your public server as a Relay node

SSH install
One-command script
Docker Compose
# Install the server and configure the client with one local command
cftunnel relay server setup --host YOUR_SERVER_IP --user root

# Key authentication
cftunnel relay server setup --host 1.2.3.4 --key ~/.ssh/id_ed25519

# Password authentication (entered interactively, not saved in shell history)
cftunnel relay server setup --host 1.2.3.4 --password

# Fully interactive mode
cftunnel relay server setup
curl -fsSL https://raw.githubusercontent.com/qingchencloud/cftunnel/main/install-relay.sh | bash
# 1. Download the configuration files
mkdir -p cftunnel-relay && cd cftunnel-relay
curl -fsSLO https://raw.githubusercontent.com/qingchencloud/cftunnel/main/docker/relay-server/docker-compose.yml
curl -fsSLO https://raw.githubusercontent.com/qingchencloud/cftunnel/main/docker/relay-server/frps.toml.example
cp frps.toml.example frps.toml

# 2. Edit frps.toml and set auth.token
# bindPort = 7000
# auth.token = "YOUR_TOKEN"

# 3. Start
docker compose up -d
Desktop

Desktop client

Manage tunnels in a clear, visual interface

cftunnel Desktop

Built with Tauri for a lightweight native experience, with visual management for Cloud and Relay modes

项目详情 晴辰导航