Nessuna descrizione

Andrey Blinov d8c2ba1daf Merge pull request #4 from kodnaplakal/feature/fix_concurent_map_writes 6 anni fa
test-data 85219bdf2c Add test-data folder 7 anni fa
.gitignore ce70214ca1 Fix fatal error: concurrent map writes 6 anni fa
.travis.yml 85219bdf2c Add test-data folder 7 anni fa
LICENSE 173f421b51 Add LICENSE 7 anni fa
README.md 16c5a0d626 Update README.md 7 anni fa
config.go 69dc5474c8 Move to placeholders 7 anni fa
config_test.go 69dc5474c8 Move to placeholders 7 anni fa
setup.go ce70214ca1 Fix fatal error: concurrent map writes 6 anni fa
setup_test.go 33e22abfd1 Replacers test fixes 7 anni fa

README.md

Build Status

Overview

geoip is a Caddy plugin that allow to determine user Geolocation by IP address using MaxMind database.

Placeholders

The following placeholders are available:

  geoip_country_code - Country ISO code, example CY for Cyprus
  geoip_latitude - Latitude, example 34.684100
  geoip_longitude - Longitude, example 33.037900
  geoip_time_zone - Time zone, example Asia/Nicosia
  geoip_country_eu - Return 'true' if country in Europen Union
  geoip_country_name - Full country name
  geoip_city_name - City name

Examples

(1) Set database path and return country code header:

geoip /path/to/db/GeoLite2-City.mmdb
header Country-Code {geoip_country_code}

(2) Proxy pass headers to backend:

localhost
geoip /path/to/db/GeoLite2-City.mmdb
proxy / localhost:3000 {
  header_upstream Country-Name {geoip_country_name}
  header_upstream Country-Code {geoip_country_code}
  header_upstream Country-Eu {geoip_country_eu}
  header_upstream City-Name {geoip_city_name}
  header_upstream Latitude {geoip_latitude}
  header_upstream Longitude {geoip_longitude}
  header_upstream Time-Zone {geoip_time_zone}
}

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors