cloudflared README

The project's README from github.com/cloudflare/cloudflared. As one markdown file: README.md.

Cloudflare Tunnel client

Contains the command-line client for Cloudflare Tunnel, a tunneling daemon that proxies traffic from the Cloudflare network to your origins. This daemon sits between Cloudflare network and your origin (e.g. a webserver). Cloudflare attracts client requests and sends them to you via this daemon, without requiring you to poke holes on your firewall --- your origin can remain as closed as possible. Extensive documentation can be found in the Cloudflare Tunnel section of the Cloudflare Docs. All usages related with proxying to your origins are available under cloudflared tunnel help.

You can also use cloudflared to access Tunnel origins (that are protected with cloudflared tunnel) for TCP traffic at Layer 4 (i.e., not HTTP/websocket), which is relevant for use cases such as SSH, RDP, etc. Such usages are available under cloudflared access help.

You can instead use WARP client to access private origins behind Tunnels for Layer 4 traffic without requiring cloudflared access commands on the client side.

Before you get started

Before you use Cloudflare Tunnel, you'll need to complete a few steps in the Cloudflare dashboard: you need to add a website to your Cloudflare account. Note that today it is possible to use Tunnel without a website (e.g. for private routing), but for legacy reasons this requirement is still necessary:

  1. Add a website to Cloudflare
  2. Change your domain nameservers to Cloudflare

Installing cloudflared

Downloads are available as standalone binaries, a Docker image, and Debian, RPM, and Homebrew packages. You can also find releases here on the cloudflared GitHub repository.

User documentation for Cloudflare Tunnel can be found at https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/

Creating Tunnels and routing traffic

Once installed, you can authenticate cloudflared into your Cloudflare account and begin creating Tunnels to serve traffic to your origins.

TryCloudflare

Want to test Cloudflare Tunnel before adding a website to Cloudflare? You can do so with TryCloudflare using the documentation available here.

Breaking Changes

Removal of CLI flags, environment variables, configuration keys, or commands is a breaking change. Such removals must be announced in the Cloudflare Tunnel changelog before the release that removes them.

Deprecated versions

Cloudflare currently supports versions of cloudflared that are within one year of the most recent release. Breaking changes unrelated to feature availability may be introduced that will impact versions released more than one year ago. You can read more about upgrading cloudflared in our developer documentation.

For example, as of January 2023 Cloudflare will support cloudflared version 2023.1.1 to cloudflared 2022.1.1.

Development

Requirements

Build

To build cloudflared locally run make cloudflared

Test

To locally run the tests run make test

Linting

To format the code and keep a good code quality use make fmt and make lint

Mocks

After changes on interfaces you might need to regenerate the mocks, so run make mocks

Git Hooks

To avoid CI errors, you can install pre-push hooks that run linting and tests before each push:

make install-hooks

This will configure git to use the hooks in .githooks/ that run make fmt-check lint test before each push.

cloudflared (cloudflare/cloudflared)

Searching Database…

这是什么东西?cloudflared 是 Cloudflare Tunnel 的命令行客户端 —— 它是一个守护进程,负责把流量从 Cloudflare 的网络转发到你的源站服务器,这样客户端的请求就能到达你这里,而不需要在防火墙上开放任何端口。
这是要装在我服务器上的东西,还是在 Cloudflare 控制台里配置的东西?它运行在托管你源站的那台机器上(比如你的网站服务器)。这个守护进程位于 Cloudflare 的网络和你的源站之间,接收 Cloudflare 发过来的流量。
怎么安装 cloudflared?可以下载独立的可执行文件、Debian、RPM 或 Homebrew 软件包,也可以拉取官方 Docker 镜像 —— macOS、Linux 和 Windows 都支持。开发者还可以用 make cloudflared 从源码构建。
创建 Tunnel 之前必须先有 Cloudflare 账户吗?是的 —— 你需要先把一个网站添加到你的 Cloudflare 账户,并把域名的 nameserver 改成 Cloudflare 的。README 里说明这个网站要求是出于历史遗留原因,但目前仍然适用。
已安装的 cloudflared 版本能获得多长时间的支持?Cloudflare 只支持最近一次发布之后一年内发布的版本。更旧的版本即使功能还能用,也可能遇到与功能无关的破坏性变更,所以要计划定期升级。
如果某个新版本删掉了我正在用的 CLI 标志,会怎么样?这属于破坏性变更:CLI 标志、环境变量、配置项或命令的移除,都必须在正式发布之前先在 Cloudflare Tunnel 的 changelog 里公布。
Creator
cloudflare
Size
45.1 MB
Stars
16.2K
Age
9y
Commits · 90 Days