Skip to content

Latest commit

 

History

History
23 lines (21 loc) · 1 KB

README.md

File metadata and controls

23 lines (21 loc) · 1 KB

Build Status Coverage Status Go Report Card
ip2country is a golang package to find out IP's origin country. It uses db-ip.com's csv file to provide answers.

Install

go get -u github.com/mostafa-asg/ip2country

Usage

package main

import (
   "github.com/mostafa-asg/ip2country"
)

func main() {
   ip2country.Load( PATH_TO_DB-IP.COM'S CSV FILE )
   println(ip2country.GetCountry("2.179.6.12"))
   println(ip2country.GetCountry("172.217.18.14"))
   println(ip2country.GetCountry("217.160.123.58"))
}

Tips : Load method should be called once.