Cloudflare提供のngrokみたいにローカルのアプリケーションを外部に公開するサービス - Argo Tunnel
#Argo_Tunnel #Cloudflare #ngrok #サービス
https://gyazo.com/4c024848226e72a4e60b92618c296659
Argo Tunnelというプロジェクト。無償で使える。
Cloudflareは1.1.1.1やWARPなどを提供し、セキュリティやプライバシーを大事にしている会社なので信頼度は高いかなと思ってる。
WAFとして使うことが目的だと思われる。
リンク
公式説明: A free Argo Tunnel for your next project
日本語公式: Argo Tunnel | Cloudflare
GitHub:
cloudflared (CLI)のインストール
Macだと以下
$ brew install cloudflare/cloudflare/cloudflared
その他のLinux/Windowsは Downloads - Argo Tunnelを参考。
使い方
ローカルで適当なポートで待ち受けるサーバー等を立ち上げる
今回はポート8080でPiping Serverを立ち上げた。
以下のcloudflared tunnel ...より先に立ち上げないと以下でエラーすることに注意。
以下のコマンドを叩き、開放する
$ cloudflared tunnel --url localhost:8080
上記のコマンドを叩くと以下のようなメッセージが出る
code:txt
...
INFO0004 +----------------------------------------------------------+
INFO0004 | Your free tunnel has started! Visit it: |
INFO0004 | https://looks-kinds-recipes-glance.trycloudflare.com |
INFO0004 +----------------------------------------------------------+
...
今回の場合はhttps://looks-kinds-recipes-glance.trycloudflare.comにアクセスすればOK。
アカウントとかログインは不要
Getting Started - Argo Tunnelではloginしたりアカウントが必要のように書いてあるが、しなくて大丈夫だった。
実際の動作
URLに注目すると、...trycloudflare.comになっている。
https://gyazo.com/2980f4183c194ed1a07fd7dd1a880e8e
以下はコマンドでPiping Serverするところ。
https://gyazo.com/de1e28c9862e7ffe968c8cdf4b1455d1
残念ながら、Argo TunnelではHTTPでのストリーミングはできない様子。通常のWebアプリとかならこれで全然問題ないはず。
Graceful shutdown
ctrl + cで止めようとすると、graceful shutdownが始まる。割と時間はかかる。数十秒ぐらい。
code:txt
^CINFO3268 Initiating graceful shutdown...
INFO3298 Quitting...
INFO3298 Metrics server stopped
INFO3298 Muxer shutdown connectionID=1
INFO3298 Muxer shutdown connectionID=3
INFO3298 Muxer shutdown connectionID=2
INFO3298 Muxer shutdown connectionID=0
4つほど出てるのは、いくつかサーバーを立ててくれているからだと思う。おそらく Argo Tunnel | Cloudflareに説明があるスマートルーティング。