Golang project for looking up geo from an IP. Meant to be deployed on Render.

geoip-render-go

Golang project for looking up geo from an IP. Meant to be deployed on Render.

Dependencies

In order to use this project, you'll need a copy of your own Maxmind GeoIP database. You can sign up for the GeoLite2 database here.

This project then relies on the oschwald/geoip2-golang package for looking up an IP in a MaxMind GeoIP database. See the documentation for all of the queries that can be made and the resulting structs.

Environment variables

This project relies on the following environment variables:

ENV Variable Description Required Default
GEO_FILE The location of your Maxmind GeoIP database (e.g., ./GeoLite2-City.mmdb) Yes None
MODE The mode to launch the application in. No "release"
PORT The port for the web service to listen on. No 3000

How to use

1. Fork Repository

Fork this repository into your own account.

2. Include your Maxmind GeoIP database

Include your Maxmind GeoIP database in the root of the project. For example, ./GeoLite2-City.mmdb. Commit this to the repository.

3. Update code

Update the handler() function in main.go to make the appropriate query and return the response.

The example in main.go uses the IP address provided to make a City() query and returns the zip code as JSON.

4. Deploy to render

Create a new web service on Render. Use your new repository and set the above environment variables to make them available at run time.

5. Make request

The web service listens for requests to /:ipaddress.

Notes

  • This project DOES NOT log web requests. It only prints status logs. If you want to log each request, you can add it to the Go Gin logger.
  • The web service responds to a 200 status code on /healthz, to be used as a health check.
Owner
Kirk Morales
Co-founder @ Persosa. SaaS Entrepreneur.
Kirk Morales
Similar Resources

Moldy CLI the best project starter and manager of the world

Moldy CLI the best project starter and manager of the world

You don't know how to start your project ... you want to help other people know your tool or language. Use Moldy! the best helper to start your project

Oct 17, 2022

✨ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command!

✨ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command!

✨ Create a new production-ready project with backend, frontend and deploy automation by running one CLI command!

Dec 31, 2022

Sotardok generator project

bagong Generate template add template base bagong template add --name project_name --value template_location get template bagong template get --name

Oct 20, 2021

A project templating CLI tool.

Clonr Project Templating CLI About Installation Homebrew Go install npm Quick start for developers Configuring a project. Basic Example Example With G

Nov 21, 2022

Code examples for Algorithm Analysis and design (CS311) [School project]

Introduction Algorithm Analysis and design 2021/2022 Code examples implemeneted using golang Why Golang? Low Level programming language Awesome garbag

Dec 5, 2021

Show Languages In Code. A fast and lightweight CLI to generate stats on the languages inside your project

Show Languages In Code. A fast and lightweight CLI to generate stats on the languages inside your project

slic Show Languages In Code. Usage Run it with an -h flag to list all commands. -d flag can be used to specify the directory of search -i flag can be

Dec 25, 2021

One-line-at-a-time was a hobby project inspired by the character Dwight K. Schrute of 'The Office'

One-line-at-a-time was a hobby project inspired by the character Dwight K. Schrute of 'The Office'

One Line at a Time Introduction One-line-at-a-time was a hobby project inspired by the character Dwight K. Schrute of 'The Office'. His efficient usag

Dec 13, 2021

GO project that retrieve and return weather data from airports sensors

Airport Project GO project that retrieve and return weather data from airports sensors (temperature, wind speed and atmospheric pressure). Built with

May 16, 2022
A command line utility and library for generating professional looking invoices in Go.
A command line utility and library for generating professional looking invoices in Go.

ginvoicer A command line utility and library for generating professional looking invoices in Go. This is a very rough draft and there could still be b

Dec 15, 2022
Terminal based wordle clone. Uses the amazing charm.sh libraries to render and expose the game over SSH

Terminal based wordle clone. Uses the amazing charm.sh libraries to render and expose the game over SSH

Nov 17, 2022
The Cloud Aviator: TUI client for cloud services (AWS, Vultr, Heroku, Render.com, ...)
The Cloud Aviator: TUI client for cloud services (AWS, Vultr, Heroku, Render.com, ...)

=== T H E C L O U D A V I A T O R === ⠀⠀⠀⠀⠀⠀⠀⠀⢶⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

Dec 17, 2022
Project-2 - Create a project that calls service created above, pass text and prints JSON output returned from the service

Project Assignment Steps to run the project: First Download the repo present her

Jan 27, 2022
Lynx is a command line application that build simple golang project
Lynx is a command line application that build simple golang project

Lynx Lynx is a Golang application for easily creating simple Go project Install Just run below commands for install lynx in your system go get -u gith

Oct 1, 2021
Gocheat - Golang terminal client for cht.sh that uses charm.sh's bubbletea project

Go Cheat.sh install gotext go get -u golang.org/x/text/cmd/gotext go generate

Jun 3, 2022
This project is used to get familiar with GoLang cli apps, along with cobra generator.

SecretCTL SecretCTL About the project Status Getting started Layout Notes About the project This project is used to get familiar with GoLang cli apps,

Jan 11, 2022
A general purpose project template for golang CLI applications

golang-cli-template A general purpose project template for golang CLI applications golang-cli-template Features Project Layout How to use this templat

Jan 15, 2022
Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies.
Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies.

Sensible and fast command-line flag parsing with excellent support for subcommands and positional values. Flags can be at any position. Flaggy has no

Jan 1, 2023
A command line utility for generating language-specific project structure.
A command line utility for generating language-specific project structure.

hydra hydra is a command line utility for generating language-specific project structures. ⏬ ✨ Features Build project templates with just one command

Oct 8, 2021