Coder Social home page Coder Social logo

go-libgeoip's Introduction

General Description

This is the Go implementation of the Maxmind GeoIP API. It is incomplete and work in progress the initial goal is support only two of the database types โ€“ the City Lite and Country Lite. The only supported method is loading the full db on startup into memory (memory cache).

Supported Access Methods

  • In Memory (Load(string))

Supported Database Formats

  • Country Edition (dbType=1)
  • City Edition REV 0 (dbType=6)
  • City Edition REV 1 (dbType=2)

Supported Lookups

  • By IP Address (GetLocationByIP(string))
  • By IP Number (GetLocationByIPNum(uint32))

Supported Responses

  • CountryCode string (available in all databases)
  • CountryName string (available in all databases)
  • City string
  • Region string
  • PostalCode string
  • Latitude float32
  • Longitude float32

To Do

  • Implement better error handling (report the error on load and lookups)
  • Better returns, country edition has only code and name (perhaps use interfaces)
  • Add test cases and benchmarking
  • Add support for more database formats

Build

make (See Makefile for more details)

Example

./example DBFILE IPADDRESS (i.e. ./example GeoIP.dat 1.1.1.1)

Usage

Please see example.go for a complete example of how to use this library.

go-libgeoip's People

Contributors

nranchev avatar borisz avatar emmaly avatar tomerdmnt avatar pitr avatar

Stargazers

mkobar avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.