How to get programmatically get ngrok's URL's?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 17:56:52

问题


I'm using ngrok's free level service, and after starting ngrok, would like to find out the http and/or https URL it assigned to the tunnel.

I was hoping the ngrok log would display the URL, but it does not.

I'm aware that I could probably set this URL with the paid version but would prefer not to upgrade if possible.

Is this functionality intentionally thwarted for security reasons?

Programmatically determining the URL would enable me to automate the using of the tunnel, and, more importantly, therefore, the termination of it, so that I don't need to worry about forgetting to terminate it manually.

Although the ngrok output appears on the console, I am unable to see it in stdout or stderr; or at least, if I try piping them to tee, I don't get any output at all. I would have expected to see ANSI escape sequences for the enhanced console output, but don't. How is it sending output to the terminal? By running strings ngrok | sort -u | less, I see that ngrok is a go application. What is it using if not stdout?

来源:https://stackoverflow.com/questions/53921092/how-to-get-programmatically-get-ngroks-urls

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!