Skip to content

piuniverse/hostedby

Repository files navigation

hostedby

Hostedby is a simple (REST API) written in GoLang that takes an IP address in string format and searches for it in a SQLite database. If it finds the IP Address in the database it will return a json response. The example response shows an AWS IP address having been found in the database.

{
   "Net":"52.93.153.170/32",
   "Start_ip":878549418,
   "End_ip":878549418,
   "Url":"https://ip-ranges.amazonaws.com/ip-ranges.json",
   "Cloudplatform":"aws",
   "Iptype":"IPv4",
   "Error":"None"
 }

(back to top)

Built With

  • Golang
  • SQLite

(back to top)

Getting Started Locally

The following instructions list how to install the API locally using docker and docker-compose.

Installation

  1. Install [Docker] (https://docs.docker.com/get-docker/)
  2. Install [Docker-compose] (https://docs.docker.com/compose/install/)
  3. Using a shell cli clone the repo
    git clone https://github.com/stclaird/hostedby.git
  4. Run Docker-compose
    cd hostedby
    docker-compose up
  5. Test the API - curl example shown, although a web browser or postman should work also.
    curl "http://localhost:8080/findip?ip=52.93.153.170"

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)