Module egeoip

Geolocation by IP address.

Copyright © 2006 Bob Ippolito

Behaviours: gen_server.

Authors: Bob Ippolito (bob@redivi.com).

Description

Geolocation by IP address.

Data Types

geoip_atom()

geoip_atom() = country_code | country_code3 | country_name | region | city | postal_code | latitude | longitude | area_code | dma_code

geoip_field()

geoip_field() = geoip_atom | [geoip_atom()]

Function Index

bench/0
bench/1
code_change/3gen_server callback.
filename/0Get the database filename currently being used by the server.
get/2Get a field from the geoip record returned by lookup.
handle_call/3gen_server callback.
handle_cast/2gen_server callback.
handle_info/2gen_server callback.
init/1initialize the server with the database at Path.
ip2long/1Convert an IP address from a string, IPv4 tuple or IPv6 tuple to the big endian integer representation.
lookup/1Get a geoip() record for the given address.
lookup/2Lookup a geoip record for Addr using the database D.
lookup_pl/1Get a proplist version of a geoip() record for the given address.
new/0Create a new geoipdb database record using the default priv/GeoLiteCity.dat.gz database.
new/1Create a new geoipdb database record using the database at Path.
record_fields/0Get an ordered list of the geoip record fields.
reload/0Reload the existing database in this process and then change the state of the running server.
reload/1Load the database at Path in this process and then change the state of the running server with the new database.
start/0Start the egeoip application with the default database.
start/1Start the egeoip application with the File as database.
start_link/1Start the server using the default priv/GeoLitecity.dat.gz database.
start_link/2Start the server using the database at Path registered as Name.
stop/0Stop the server.
terminate/2gen_server callback.

Function Details

bench/0

bench() -> any()

bench/1

bench(Count) -> any()

code_change/3

code_change(OldVsn, State, Extra) -> NewState

gen_server callback.

filename/0

filename() -> string()

Get the database filename currently being used by the server.

get/2

get(R::geoip(), Field::geoip_field()) -> term()

Get a field from the geoip record returned by lookup.

handle_call/3

handle_call(What::Msg, From, State) -> term()

gen_server callback.

handle_cast/2

handle_cast(What::Msg, State) -> term()

gen_server callback.

handle_info/2

handle_info(Info, State) -> {noreply, State}

gen_server callback.

init/1

init(FileName::Path) -> {ok, State}

initialize the server with the database at Path.

ip2long/1

ip2long(Address) -> {ok, integer()}

Convert an IP address from a string, IPv4 tuple or IPv6 tuple to the big endian integer representation.

lookup/1

lookup(Address) -> geoip()

Get a geoip() record for the given address. Fields can be obtained from the record using get/2.

lookup/2

lookup(D::geoipdb(), Addr) -> {ok, geoip()}

Lookup a geoip record for Addr using the database D.

lookup_pl/1

lookup_pl(Address) -> geoip()

Get a proplist version of a geoip() record for the given address.

new/0

new() -> {ok, geoipdb()}

Create a new geoipdb database record using the default priv/GeoLiteCity.dat.gz database.

new/1

new(Path) -> {ok, geoipdb()}

Create a new geoipdb database record using the database at Path.

record_fields/0

record_fields() -> Fields::list()

Get an ordered list of the geoip record fields

reload/0

reload() -> ok

Reload the existing database in this process and then change the state of the running server.

reload/1

reload(FileName::Path) -> ok

Load the database at Path in this process and then change the state of the running server with the new database.

start/0

start() -> ok

Start the egeoip application with the default database.

start/1

start(File) -> ok

Start the egeoip application with the File as database.

start_link/1

start_link(Name) -> {ok, Pid}

Start the server using the default priv/GeoLitecity.dat.gz database. The process will be registered as Name

start_link/2

start_link(Name, FileName::Path) -> {ok, Pid}

Start the server using the database at Path registered as Name.

stop/0

stop() -> ok

Stop the server.

terminate/2

terminate(Reason, State) -> ok

gen_server callback.


Generated by EDoc, Aug 16 2014, 11:31:20.