Skip to content

Latest commit

 

History

History
80 lines (56 loc) · 2.72 KB

README.md

File metadata and controls

80 lines (56 loc) · 2.72 KB

made-with-Go codecov https://goreportcard.com/report/github.com/mmiranda/cfdtunnel Test

Cloudflared Tunnel Wrapper

cfdtunnel is a wrapper for cloudflared access tunnel, designed to access multiple tunnels without having to worry about your cloudflared process.

Why?

To manage the cloudflared process is tedious and error prone when using multiple tunnels, leading to port conflicts, clients left running for no reason and so on.

This tool automates the following process:

cloudflared access tcp --hostname foo.bar.com --url 127.0.0.1:1234
cloudflared access tcp --hostname foo.bar2.com --url 127.0.0.1:5678
cloudflared access tcp --hostname foo.bar3.com --url 127.0.0.1:xxxx

Installation

The easiest way to install it is using Homebrew:

brew tap mmiranda/apps
brew install cfdtunnel

If you prefer, you also can download the latest binary on the release section

How does it work?

Basically this tool takes care of the cloudflared process initialization for you.

  1. Runs cloudflared based on you config ini file
  2. Runs the command you want
  3. Kills the cloudflared proccess at the end

You can use any command on top of cfdtunnel:

Kubectl

cfdtunnel --profile my-profile1 -- kubectl get namespaces

K9S

cfdtunnel --profile my-profile1 -- k9s

Configuration

Configuration is really simple, you just need to create your profiles in ~/.cfdtunnel/config

Example:

[my-profile1]
host = https://kubernetes.foo.bar.com
port = 1234
env = HTTPS_PROXY=socks5://127.0.0.1:1234
# env = OTHER=value

[my-profile2]
host = sql.foo.bar.com
# port is not necessary

Defining a port is not required, if you don't specify, cfdtunnel will launch the tunnel using the most random port 5555

Environment Variables

In case your application demands specific environment variables, cfdtunnel will make sure it is created prior to its execution. You just need to define it on config file as well.

Contributing

Contributions, issues, and feature requests are welcome!

Give a ⭐️ if you like this project!

License

MIT