Skip to content

Commit

Permalink
- updated documentation and buildfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaMaddin committed Mar 17, 2014
1 parent fcae24f commit 7c6bf83
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 9 deletions.
31 changes: 30 additions & 1 deletion man/vmod_geoip.3
Original file line number Diff line number Diff line change
@@ -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
.
Expand Down Expand Up @@ -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
Expand Down
22 changes: 14 additions & 8 deletions varnish-libvmod-geoip.spec
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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 <github@megamaddin.org> 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 <github@megamaddin.org> - 0.4-1
- Changed function-calls from unsupported IP args, to supported STRING args
- added manpage
Expand Down

0 comments on commit 7c6bf83

Please sign in to comment.