Created
September 28, 2026 19:25
-
-
Save mahelbir/b8fb37bf6ac92825e06237861d7cb9ad to your computer and use it in GitHub Desktop.
Cloudflare Quick Tunnels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cfd() { | |
| local port=$1 | |
| cloudflared tunnel --url "http://localhost:$port" 2>&1 | while IFS= read -r line; do | |
| echo "$line" | |
| if echo "$line" | grep -qE 'https://[a-zA-Z0-9.-]+\.trycloudflare\.com'; then | |
| local url=$(echo "$line" | grep -oE 'https://[a-zA-Z0-9.-]+\.trycloudflare\.com') | |
| if command -v pbcopy &>/dev/null; then | |
| echo -n "$url" | pbcopy | |
| elif command -v xclip &>/dev/null; then | |
| echo -n "$url" | xclip -selection clipboard | |
| elif command -v wl-copy &>/dev/null; then | |
| echo -n "$url" | wl-copy | |
| fi | |
| echo "" | |
| echo "URL: $url" | |
| fi | |
| done | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment