The cl-geoip Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-geoip Reference Manual

This is the cl-geoip Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 03:41:09 2022 GMT+0.

Table of Contents


1 Introduction

cl-geoip

A simple cffi-wrapper around some basic functionality of libGeoIP as provided by the debian package http://packages.debian.org/wheezy/libgeoip-dev (original source http://www.maxmind.com). I only implemented the functionality I actually need, and released it since it might be useful for other people. If anybody needs more functionality, patches are welcome!

I tested this under SBCL, Linux x64.

Copyright

Copyright (C) 2013 (let ((n "Christoph-Simon Senjak")) #| |#
 (format nil "~A <~C~C~C~C~A>" n (elt n 0) (elt n 10) (elt n 16)
 #\@ "uxul.de"))

This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://www.wtfpl.net/ for more details.

Usage

Under Debian/Ubuntu, the packages libgeoip-dev and geoip-database should provide the necessary files to get started.

Before we can use the databases, they have to be initialized using open-databases, which wants two file names, one for the IPv4 and one fore the IPv6 database. Under Debian/Ubuntu, the following should be correct:

(geoip:open-databases "/usr/share/GeoIP/GeoIP.dat"
                      "/usr/share/GeoIP/GeoIPv6.dat")

After that, you should be able to find Country-Codes for IP-Strings using get-country-code. If it is not found, NIL is returned:

  CL-USER> (geoip:get-country-code "188.40.170.99")
  "DE"
  CL-USER> (geoip:get-country-code "2a01:4f8:101:281:7ad5:1003:0:1")
  "DE"
  CL-USER> (geoip:get-country-code "some clusterfuck")
  NIL

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 cl-geoip

Wrapper around libGeoIP

License

WTFPL 2.0

Dependency

cffi (system).

Source

cl-geoip.asd.

Child Component

geoip.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 cl-geoip/cl-geoip.asd

Source

cl-geoip.asd.

Parent Component

cl-geoip (system).

ASDF Systems

cl-geoip.


Previous: , Up: Lisp   [Contents][Index]

3.1.2 cl-geoip/geoip.lisp

Source

cl-geoip.asd.

Parent Component

cl-geoip (system).

Packages

geoip.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 geoip

Source

geoip.lisp.

Use List
  • cffi.
  • common-lisp.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Ordinary functions

Function: get-country-code (ip)
Package

geoip.

Source

geoip.lisp.

Function: open-databases (ip4 ip6)
Package

geoip.

Source

geoip.lisp.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *ip4-db*
Package

geoip.

Source

geoip.lisp.

Special Variable: *ip6-db*
Package

geoip.

Source

geoip.lisp.


Previous: , Up: Internals   [Contents][Index]

5.2.2 Ordinary functions

Function: geoip-country-code-by-addr (database ip-4)
Package

geoip.

Source

geoip.lisp.

Function: geoip-country-code-by-addr-v6 (database ip-6)
Package

geoip.

Source

geoip.lisp.

Function: geoip-open (filename flags)
Package

geoip.

Source

geoip.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts