IP geolocation tools are used to find basic information about an IP address like country, region, city, ISP, and more. In this post, you will create your own simple IP geolocation tool in Termux using the Go programming language. It runs on any Linux terminal and displays IP information in a clean format with a hacker-style banner.
Hereโs what you can do with this tool:
- Get IP address details
- Find country and city information
- Identify ISP details
- Learn basic Go programming
- Build your own CLI tool in Termux
- Understand API-based data fetching
Create Your Own IP Geolocation Tool
Below are the simple commands to create the IP geolocation tool in Termux. Copy and run each command step by step.
Update Termux packages.
pkg update && pkg upgrade -yInstall Go language.
pkg install golang -yCreate project directory.
mkdir ipgeo && cd ipgeoInitialize Go module.
go mod init ipgeoCreate the main file.
nano main.goPaste the full code below into the file.
package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
)
type GeoData struct {
Query string `json:"query"`
Country string `json:"country"`
RegionName string `json:"regionName"`
City string `json:"city"`
ISP string `json:"isp"`
}
func banner() {
green := "\033[32m"
cyan := "\033[36m"
yellow := "\033[33m"
reset := "\033[0m"
fmt.Println(green + "โโโโโโโโโโ โโโโโโโ โโโโโโโโ โโโโโโโ " + reset)
fmt.Println(green + "โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ" + reset)
fmt.Println(green + "โโโโโโโโโโโโโโ โโโโโโโโโโ โโโ โโโ" + reset)
fmt.Println(green + "โโโโโโโโโโ โโโ โโโโโโโโโ โโโ โโโ" + reset)
fmt.Println(green + "โโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโ" + reset)
fmt.Println(green + "โโโโโโ โโโโโโโ โโโโโโโโ โโโโโโโ " + reset)
fmt.Println(cyan + "========================================" + reset)
fmt.Println(yellow + " IP GEOLOCATION TOOL v1.0" + reset)
fmt.Println(cyan + "========================================" + reset)
fmt.Println()
}
func main() {
banner()
if len(os.Args) < 2 {
fmt.Println("Usage: ipgeo <ip-address>")
return
}
ip := os.Args[1]
url := "http://ip-api.com/json/" + ip
resp, err := http.Get(url)
if err != nil {
fmt.Println("Error:", err)
return
}
defer resp.Body.Close()
var data GeoData
json.NewDecoder(resp.Body).Decode(&data)
fmt.Println("RESULTS")
fmt.Println("========================================")
fmt.Println("IP :", data.Query)
fmt.Println("Country :", data.Country)
fmt.Println("Region :", data.RegionName)
fmt.Println("City :", data.City)
fmt.Println("ISP :", data.ISP)
fmt.Println("========================================")
}
Save and exit nano.
To save the file:
- Press CTRL + X
- Press Y
- Press Enter
Build the tool.
go build -o ipgeoUsage Commands
You have successfully created your own IP Geolocation Tool in Termux, and now itโs time to run and test it. Below are the commands you can use to execute the tool and get IP information from your terminal.
Run the tool with an IP address.
./ipgeo 8.8.8.8Run another example.
./ipgeo 1.1.1.1If no IP is provided, it will show help message.
./ipgeoExample output:
โโโโโโโโโโ โโโโโโโ โโโโโโโโ โโโโโโโ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโ โโโโโโโโโโ โโโ โโโ
โโโโโโโโโโ โโโ โโโโโโโโโ โโโ โโโ
โโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโ โโโโโโโ โโโโโโโโ โโโโโโโ
IP GEOLOCATION TOOL v1.0
========================================
IP : 8.8.8.8
Country : United States
Region : California
City : Mountain View
ISP : Google LLC
========================================Edit and Customize the Tool
You can modify or improve this IP geolocation tool anytime by editing the source file. You can add new features like more IP details, better UI design, or even different APIs.
Open the file again using nano:
nano main.goInside nano, you can edit the code as needed.
To save changes:
- Press CTRL + X
- Press Y
- Press Enter
After saving, rebuild the tool:
go build -o ipgeoThis makes your updated version ready to run again.
End Note
This is a simple IP geolocation tool made in Termux. It helps you learn how APIs and Go programming work together. You can also improve it later by adding more features or changing the design.

