From 7c6bf83ad355505fa8c7a9f6454bdd6fc4713528 Mon Sep 17 00:00:00 2001 From: MegaMaddin Date: Mon, 17 Mar 2014 19:18:56 +0100 Subject: [PATCH] - updated documentation and buildfiles --- man/vmod_geoip.3 | 31 ++++++++++++++++++++++++++++++- varnish-libvmod-geoip.spec | 22 ++++++++++++++-------- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/man/vmod_geoip.3 b/man/vmod_geoip.3 index 985f894..63b33f5 100644 --- a/man/vmod_geoip.3 +++ b/man/vmod_geoip.3 @@ -1,6 +1,6 @@ .\" Man page generated from reStructeredText. . -.TH VMOD_GEOIP 3 "2013-05-13" "0.4" "" +.TH VMOD_GEOIP 3 "2014-03-17" "0.5" "" .SH NAME vmod_geoip \- Varnish Geoip Module . @@ -125,7 +125,36 @@ vcl_recv { set req.http.X\-Country\-Name = geoip.get_country_name(req.http.X\-Forwarded\-For); } .ft P +..UNINDENT +.SS get_continent_code +.INDENT 0.0 +.TP +.B Prototype +.sp +.nf +.ft C +get_continent_code(STRING S) +.ft P .fi +.TP +.B Return value +. +STRING continent code, NULL as STRING if ip address was not found in the Geoip database. +.TP +.B Description +. +Returns the continent code which belongs to the passed ip address. +.TP +.B Example +.sp +.nf +.ft C +vcl_recv { + set req.http.X\-Forwarded\-For = client.ip; + set req.http.X\-Continent\-Code = geoip.get_continent_code(req.http.X\-Forwarded\-For); +} +.ft P +.fifi .UNINDENT .SH INSTALLATION .sp diff --git a/varnish-libvmod-geoip.spec b/varnish-libvmod-geoip.spec index abb3b8d..954da49 100644 --- a/varnish-libvmod-geoip.spec +++ b/varnish-libvmod-geoip.spec @@ -1,8 +1,8 @@ %define _varnish varnish -%define _varnishbuildver 3.0.3 +%define _varnishbuildver 3.0.5 Name: varnish-libvmod-geoip -Version: 0.4 +Version: 0.5 Release: 1%{?dist} License: BSD @@ -16,7 +16,7 @@ Source1: http://repo.varnish-cache.org/source/%{_varnish}-%{_varnishbuild # libvmod-geoip build requirements BuildRequires: GeoIP-devel GeoIP %{?el5:GeoIP-data} # Varnish build requirements -BuildRequires: pcre-devel automake libtool pkgconfig ncurses-devel libxslt groff +BuildRequires: pcre-devel automake libtool pkgconfig ncurses-devel libxslt groff readline-devel Requires: %{_varnish} = %{_varnishbuildver} Requires: %{_varnish}-libs = %{_varnishbuildver} @@ -29,11 +29,11 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} This Varnish-Module enhances the varnish caching server to use the Geo-IP functionality inside VCL-Code. - %prep %setup -n %{name} -# vmods need the compiled varnish sources to build -# so first we have to build varnish + +# to build a VMOD, we'll need the compiled varnish source tree +# so we have to build varnish first %setup -n %{name} -D -T -a 1 cd %{_varnish}-%{_varnishbuildver} %configure && %{__make} %{?_smp_mflags} @@ -60,7 +60,7 @@ export VMODDIR=%{_libdir}/varnish/vmods %{__make} check %{?el5:abs_top_builddir='$(VARNISHSRC)/$(top_builddir)/'} %install -%{__rm} -rf %{buildroot} +[ %{buildroot} != "/" ] && %{__rm} -rf %{buildroot} %{__make} install DESTDIR=%{buildroot} # adopted from varnish.spec @@ -69,7 +69,7 @@ find %{buildroot}/%{_libdir}/ -name '*.la' -exec rm -f {} ';' find %{buildroot}/%{_libdir}/ -name '*.a' -exec rm -f {} ';' %clean -%{__rm} -rf %{buildroot} +[ %{buildroot} != "/" ] && %{__rm} -rf %{buildroot} %post -p /sbin/ldconfig @@ -81,6 +81,12 @@ find %{buildroot}/%{_libdir}/ -name '*.a' -exec rm -f {} ';' %{_mandir}/man3/vmod_geoip.3.gz %changelog +* Mon Mar 17 2014 Martin Probst 0.5-1 +- added get_continent_code function to be almost feature complete with + GeoIP Country Edition +- added tests for new feature +- restructured code for better readability + * Thu May 09 2013 Martin Probst - 0.4-1 - Changed function-calls from unsupported IP args, to supported STRING args - added manpage