Ngrok has modified their free tier, and now you are limited to 1GB of traffic per month through their tunnels. Therefore, if you intend to use this service daily, you might run out of the allocatted data before the month ends.
This Python program allows you to dynamically update your Cloudflare DNS records to point to a TCP Ngrok tunnel. It's especially handy for applications where you want to expose a local server to the internet, but the IP might change (for instance, if using a service like Ngrok). The program ensures that the DNS record is always updated with the latest Ngrok tunnel information.
You can download the latest version of the program here.
Alternatively, if you prefer to set things up yourself check the How to Build It Yourself Tab.
- Generate a new SRV record that will act as your Dynamic DNS.
- Run
NgrokDynamicDNS
which should open up a configuration window. If not runNgrokDynamicDNS config
. - Fill in the appropriate API Key, Zone ID, Record ID, and Ngrok Api URL.
- Once you have saved your configuration, the program will begin to run in the background.
If you want to stop it you will have to close it through the task manager.
-
On the left side of cloudflare after you selected a Domain you can click on DNS.
-
Then click "Add record" enter:
Minecraft Server Example "Type" = SRV "Name" = "your Subdomain for example mc" "Service" = "_minecraft" "Protocol" = TCP "TTL" = Auto "Priority" = 5 "Weight" = 1 and for "Port" and "Target" you can enter a place holder.
-
Save.
- Go to cloudflare and log in.
- In the top right click on My Profile then click on Api Keys on the left side.
- Click Create Key and select "Edit zone DNS" template.
- Under "Zone Resources" you can change to one specific zone or all zones, I recommend using all zones.
- Click on "Continue to summary" -> "Create Key" and then copy it.
- Again go to cloudflare and log in.
- Click on your Domain and on the right side you will see a list of Infos regarding your Domain
- Look under "API" -> "Zone ID" and copy it.
If you have done step 2. just click on the bottom left of the configuration window where it says "Get Records". Then select the one you just made.
If you are running this program on the same computer as your Ngrok tunnel the default path would be:
http://127.0.0.1:4040/api/tunnels
if not you are probably advanced enough to find it yourself just make sure to also add /api/tunnels
to the end of the url
Here's a rundown of what this program does:
- Interacts with the Cloudflare API to update DNS records, specifically SRV records.
- Periodically checks your Ngrok TCP tunnel's current external address.
- Updates the DNS record whenever there's a change in the Ngrok tunnel information.
If you'd like to tweak, customize or just play around with the source code, here's how you can get started:
- Clone this repository and run the
createEnvironment.bat
. - Change up the code if you'd like.
- Then run the
build.bat
you can also edit it if you want for example add an icon. - The resultant executable will be located in the
dist
folder.