NgrokutilA WPF Console app to generate an ngrok TCP tunnels config file.- And
NgrokTunnelsConfigA WPF Form based app to do same and orchestratengrok start -all
- Generate a ngrok.yml with the app.
- Noramlly leave the path as default so ngrok can easily find it.
- And normally leave the network 192.168.0.0 as local as default
- You will need your authtoken, generated as part of the ngrok setup.
- For ngrok setup see Softata: ngrok update
- An update page coming specifically for this
## Ngrokutil
---------------------------
MgrokUtil Help
---------------------------
MgrokUtil command line options:
--help, -h
Show this help and exit.
--clear, -c
Clear persisted settings (Path/AuthToken/Port) and exit.
--path=<file>, -p=<file> [Default]
Default: %HOMEPATH%\AppData\Local\ngrok\ngrok.yml
Path to ngrok.yml ('.yml' is appended if missing).
If a single positional argument is provided, it is treated as the path.
--authtoken=<token>, -a=<token>
Optional ngrok authtoken (must be 49 chars, [A-Za-z0-9_]).
If the config file is missing, providing a valid authtoken will create it.
--port=<port>, -t=<port>
Default: 4242.
If existing tunnels contain an addr port, that port is used unless overridden by th e commandline.
--network=<ipv4>, --nw=<ipv4>, -n=<ipv4>
Network IPv4 used for tunnel addr generation; must exist locally.
Default: 192.168.0.0
--ipBase=<csv>, -i=<csv>
CSV of ports/ids (1..234).
If value starts with '+', merges with existing tcp<port> tunnels; otherwise replaces them.
---------------------------
- App documentation below.
Once generated run with
ngrok start --all
Or you can just name the tunnels eg ngrot start tcp11 etc
- Can new orchestrate
ngrok start --allfromTunnelsmenu:- Start Runs ngrok start --all
- Then copy the Shell text.
- Capture Get list of tunnels from text on Clipboard.
- Select From list.
- Start Runs ngrok start --all
- Get list of tunnels to choose from such as
tcp://0.tcp.au.ngrok.io:13964 -> 192.168.0.5:4242
tcp://0.tcp.au.ngrok.io:18348 -> 192.168.0.4:4242
Can then select and get eg tcp://0.tcp.au.ngrok.io:13964 on Clipboard.
- Run
File->Exitto exit- Close ngrok procvess and window.
Menu items and behavior.
Note: The ngrok configuration is typically stored in c:\users\CurrentUser\AppData\Local\ngrok\ngrok.yml
When you run, say, ngrok start -all, it uses the tunnels specified in that ngrok.yml file.
-
Load
- Action: Loads YAML from path bound to
Path. - Handler:
MenuFileLoad_Click - Effects: updates
RawYaml,RootNodes, andAuthToken.
- Action: Loads YAML from path bound to
-
Save
- Action: Writes current YAML to
Path(creates directory if needed). - Handler:
MenuFileSave_Click
- Action: Writes current YAML to
- Exit
- Action: Attempts to stop ngrok and exits the application.
- Handler:
MenuFileExit_Click - Notes: Calls
MenuTunnelsStopNgrok_ClickandMenuTunnelsStopNgrokExe_Clickbefore shutdown.
-
Start
- Action: Stops other
ngrokinstances and launchesngrok start --allin a shell. - Handler:
MenuTunnelsStart_Click - Notes: Keeps process tracked in
_ngrokProcess. UI shows instructions to copy shell output for capture.
- Action: Stops other
-
Capture
- Action: Parses the current clipboard text for lines beginning with
Forwarding, extracts thetcp://...tail, deduplicates and stores them. Copies CSV to clipboard. - Handler:
MenuTunnelsCapture_Click - Effects: Populates in-memory
Tunnelslist and copies CSV of captures to the clipboard.
- Action: Parses the current clipboard text for lines beginning with
-
Select
- Action: Presents a dialog showing
Tunnels. Double-click, Enter, or OK copies the selected tunnel token (substring up to the first space) to the clipboard. - Handler:
MenuTunnelSelect_Click
- Action: Presents a dialog showing
-
Stop
- Action: Attempts to stop the process started by the app (
_ngrokProcess) — polite close then kill fallback. - Handler:
MenuTunnelsStopNgrok_Click
- Action: Attempts to stop the process started by the app (
-
Stop ngrok.exe
- Action: Enumerates all
ngrokprocesses (Process.GetProcessesByName("ngrok")) and tries to stop/kill them. - Handler:
MenuTunnelsStopNgrokExe_Click
- Action: Enumerates all
- Add New / Replace / Remove / Clear
- Actions: Modify tunnels in the YAML preview according to
IpBaseandNetwork. - Handlers:
- Add New
MenuTunnelsAdd_ClickAdds tunnels to in-memory Tunnels Yaml - Replace
MenuTunnelsReplace_ClickReplace tunnels in in-memory Tunnels yaml - Remove
MenuTunnelsRemove_ClickRemoves tunnels in-memory Tunnels yaml - Clear
MenuTunnelsClear_ClickClears in-memory Tunnels yaml - Note: Need to run File->Save to lock in these changes to tunnels
- Add New
- Actions: Modify tunnels in the YAML preview according to
-
Save
- Action: Persist app settings (
Path,AuthToken,Port) viaAppSettingsStore. - Handler:
MenuSettingsSave_Click
- Action: Persist app settings (
-
Clear
- Action: Delete stored app settings.
- Handler:
MenuSettingsClear_Click
- Help
- Action: Show help text.
- Handler:
MenuHelp_Click
-
Typical workflow:
Tunnels -> Startto runngrok start --all.- Copy the shell output (leave ngrok running).
Tunnels -> Captureto parse clipboard and populateTunnels.Tunnels -> Selectto pick a tunnel (double-click or press Enter) and copy itstcp://...token to the clipboard.
-
Implementation details:
- Captured lines are stored in the
TunnelsList<string>as the full tail; selection extracts the token up to the first space. - Status and errors are surfaced via the view-model
Errorproperty (bound in the UI).
- Captured lines are stored in the