• Stars
    star
    234
  • Rank 171,630 (Top 4 %)
  • Language
    Go
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GeoIP API for Golang

GeoIP API for Go

This package wraps the libgeoip C library for access from Go (golang). Build Status

Install with go get github.com/abh/geoip and use godoc geoip to read the documentation.

There's a small example in the ex/ subdirectory.

You can download the free GeoLite Country database or you can subscribe to updates.

Examples

file := "/usr/share/GeoIP/GeoIP.dat"

gi, err := geoip.Open(file)
if err != nil {
	fmt.Printf("Could not open GeoIP database\n")
}

if gi != nil {
	country, netmask := gi.GetCountry("207.171.7.51")
}

// Setup gi6 by opening the optional IPv6 database and then...
country := gi6.GetCountry_v6("2607:f238:2::5")
fmt.Println(country)

Contact

Copyright 2012-2013 Ask Bjørn Hansen [email protected]. The package is MIT licensed, see the LICENSE file. Originally based on example code from [email protected].

More Repositories

1

geodns

DNS server with per-client targeted responses
Go
1,385
star
2

ntppool

NTP Pool Project
Perl
213
star
3

pgeodns

Geographic Perl Nameserver
Perl
47
star
4

djbdns

D. J. Bernsteins DNS servers
40
star
5

bgpapi

ExaBGP HTTP API
Go
31
star
6

colobus

Perl NNTP server
Perl
20
star
7

geodns-config

geodns configuration tool
Go
17
star
8

kiokudb-backend-mongodb

MongoDB backend for KiokuDB
Perl
10
star
9

dns-notify

DNS NOTIFY tool
Go
9
star
10

combust

Combust Web Framework
Perl
8
star
11

rt-docker

Dockerfile
7
star
12

ezmlm-idx

ezmlm-idx
C
6
star
13

snapback

Snapback ZFS backup server
Perl
6
star
14

zfs-snapshot-cleaner

ZFS Snapshot Cleanup script
Perl
4
star
15

cachestatus

HTTP cache status and priming tool
Go
4
star
16

net-ntp

Perl module for the NTP protocol
Perl
4
star
17

rt-mail

SparkPost to Request Tracker gateway
Go
4
star
18

httpirc

HTTP to IRC gateway
Perl
4
star
19

geo-coder-yahoo

Perl interface to the Yahoo Geocoding API
Perl
4
star
20

cpantesters-server

Server part for HTTP storage of CPAN tests
3
star
21

MojoX-Session-Store-MongoDB

MojoX::Session::Store::MongoDB
Perl
2
star
22

rersyncrecent

mirroring via rsync made efficient
Perl
2
star
23

Plack-Middleware-OpenTelemetry

Plack Middleware for OpenTelemetry
Perl
2
star
24

abh.github.com

Ask's github pages
2
star
25

dellingr

NTP Pool Data API
Go
1
star
26

v6test

IPv6 Testing
Perl
1
star
27

ntppool-static-cdn

3rd party JS/CSS resources used by the NTP Pool
1
star
28

ElasticSearch.pm

A Perl API to ElasticSearch
Perl
1
star
29

munin-plugins

1
star
30

WWW-Mechanize

WWW::Mechanize Perl module (Import from old svn.perl.org repository)
Perl
1
star
31

web-git-tar

Go
1
star
32

cpan-testers-parsereport

Fork of git://repo.or.cz/cpan-testers-parsereport.git
Perl
1
star