ip2cn-server

An IP to country names (IP Geolocation) server using inet domain sockets, allowing multiple connections without exclusive access locking. By default ip2cn-server binds to the 'localhost' address and is thus not available via the network or the Internet. The advantage of running ip2cn-server is that casual clients do not need to wait for the database to time when making IP to country queries, the IP to country database stays resident in memory.

database reload

The ip2cn-server can be signalled to reload the database files. The server suspends servicing the clients during the reload time and resumes service quickly. Reloading the database is done by sending a signal and any connected clients will remain connected during the data reload.

shell clients

gawk-3.1.5 can do inet domain sockets, so making a shell client for accessing the ip2c-server involves writing the client in gawk, or wrapping a gawk accessor in a shell script. Some examples of simple clients are shown below.

Clients written in gawk will exit with a fatal error if the server is not listening on the expected port. This issue is handled either by testing that the ip2cn-server is listening before use, or sending the error message to /dev/null. Both methods are demonstrated in the client examples below.

client files

client1
simple casual access client
client2
simple casual access client that checks the server is listening before sending a query
client3
SSI script shows user IP to country name:  38.107.191.93 US:United States 
Use like this: <!--#exec cmd="./lookup-ip" -->

server files

ip2cn-server.conf
configuration file
rc.ip2cn-server
start/stop/restart/reload control script
ip2cn-server
ip2cn-server source code
server user documentation
you get this by incanting the perl spell: perldoc ip2cn-server.

database

download
ip2c-database.tar.gz for ip2c-database tarball with these files:
.
|-- er-ip2c		ER diagram
|-- ip2c-index		IP to country code table
`-- ip2c-names		country code to name table

0 directories, 3 files
information
See: server user documentation, and the firewall tools page.