View random ngrok URL when run in background

前端 未结 12 1703
旧时难觅i
旧时难觅i 2021-02-02 08:16

When I start an ngrok client with ./ngrok tcp 22 it runs in the foreground and I can see the randoming generated forwarding URL, such as tcp://0.tcp.ngrok.io:

12条回答
  •  礼貌的吻别
    2021-02-02 08:33

    If you want to get the first tunnel then jq will be your friend:

    curl -s localhost:4040/api/tunnels | jq -r .tunnels[0].public_url
    

    When running more than one instance of ngrok then use the tunnel name /api/tunnels/:name.

提交回复
热议问题