Short URLs are often detrimental to user privacy in that they do click tracking (mapped to users' pub IP) and more. This microservice is meant to be a slug against that. This is a simple GoLang API that needs to be hosted on a VPS/server of some sort and then you can supply the shorturl to the API and get the expanded link as a result, this way the offending (URL shortener) service will see the IP of the VPS instead of your own (thus protecting your privacy). You can also create a bot around this microservice and use it in many places (example: a Telegram bot --has wrapper for Go). To get the expanded URL of any short URL, Send a GET request like this: < scheme > < host > :< port >?shorturl=< SHORT_URL_HERE >. You'll receive a JSON in response with the expanded URL in it under the key "result" (or "error" if any).
Usage Instructions
If you want to run this as a Microservice
install Go language, and Git on your machine
clone this repository: git clone https://github.com/cyfrost/url-expander
pull deps: go install local_server.go
run: go run local_server.go
(optional) you can build it into a binary with go build local_server.go (For multi-arch/cross-compilation supply GOARCH flags alongside).
If you want to run this as a Telegram Bot
Use the Telegram's BotFather bot to create a new bot, acquire a token (make it webhook based).
Replace the BotFather issued token in the tg-bot.go file.
Compile the program with go build tg-bot.go
Start the bot server on your VPS/any machine like this ./tg-bot
Open Telegram and test if the server is responding to your messages as expected.
Docker
The Dockerfile contains instructions for this program to be run as an alpine container (statically compiled binary from Go). The net image size is 13 MiB.
Start the docker container using ./run-dockerized.sh command and open the browser to URL http://localhost:5000 to see the program output.