geoipdb 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.travis.yml +11 -0
- data/Gemfile +6 -7
- data/README.md +40 -0
- data/Rakefile +11 -3
- data/ext/geoipdb/geoipdb.c +1 -1
- data/geoipdb.gemspec +17 -19
- data/lib/cgeoipdb.rb +2 -0
- data/lib/geoipdb.rb +1 -2
- data/lib/jgeoipdb.rb +2 -3
- data/spec/geoipdb_spec.rb +1 -1
- metadata +24 -38
- data/.document +0 -5
- data/.jrubyrc +0 -12
- data/.rvmrc +0 -1
- data/README.markdown +0 -18
- data/lib/geoipdb.jar +0 -0
- data/tasks/compile.rake +0 -8
- data/tasks/rspec.rake +0 -7
- data/tasks/yard.rake +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bd4014a1f5219ad80dcc4edf0f2676cfe6a25c15
|
4
|
+
data.tar.gz: 9023e01afee88c14087ce533ba53a835db050153
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 051bf0ed38ea950a7ac3d738cbbce26f5dfa13d748c5d56a80676124ac8c82c950265bc937cffafcb615c84bc8a096aca2225ffa2625d14927a878ad8d822431
|
7
|
+
data.tar.gz: a86a82c253f1f1521adfc046765d3b3b6b57dec78ee9990d8f8666534c9db82a0faf99da8bdb58720cd2b4ce1802e74e38a72db2325859bfa03e68e3f01ae1c6
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- jruby
|
4
|
+
- 2.1.0
|
5
|
+
- 2.0.0
|
6
|
+
- 1.9.3
|
7
|
+
notifications:
|
8
|
+
email: false
|
9
|
+
hipchat:
|
10
|
+
rooms:
|
11
|
+
secure: RFtqDVDCk3BfP9yrVgToifCEbtEljndNWX61YCtsFXuCYihPODfii33HqEJ/CCZARuSMpomezOWsHP10+gT2VgRG8nfSQ6AIPLR1H2cs4uFtNN3WKd3I+LDF/GDua4rfEY8g4tZWFYTLbxgtpxD5rrGL6/ASLdAlKy33i/gTuPM=
|
data/Gemfile
CHANGED
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# geoipdb: fast (in memory!) geo location db.
|
2
|
+
|
3
|
+
Fast GeoIpDb implementation for Ruby using C/Java-Extensions.
|
4
|
+
|
5
|
+
* Returns a GeoLocation and additional information for a given IP.
|
6
|
+
* Reads Data from CSV-Files and uses internal binary caching.
|
7
|
+
|
8
|
+
[![Gem Version](https://badge.fury.io/rb/geoipdb.png)](http://badge.fury.io/rb/geoipdb)
|
9
|
+
[![Build Status](https://secure.travis-ci.org/liquidm/geoipdb.png)](http://travis-ci.org/liquidm/geoipdb)
|
10
|
+
[![Code Climate](https://codeclimate.com/github/liquidm/geoipdb.png)](https://codeclimate.com/github/liquidm/geoipdb)
|
11
|
+
[![Dependency Status](https://gemnasium.com/liquidm/geoipdb.png)](https://gemnasium.com/liquidm/geoipdb)
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
gem 'geoipdb'
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install geoipdb
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
db = IpDb.init "city_codes.csv", "ip_city.txt", "ip_city.cache"
|
30
|
+
ip_info = db.information_for_ip("178.0.0.1")
|
31
|
+
ip_info.inspect
|
32
|
+
=> #<IpInformation:0x101385c78 @city_name="eschborn", @city_code="ax5", @lng=8.55, @country_iso_code="de", @lat=50.133333, @is_mobile=true>
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
1. Fork it ( http://github.com/liquidm/geoipdb/fork )
|
37
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
38
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
39
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
40
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "bundler/setup"
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require "liquid/tasks"
|
3
4
|
|
4
|
-
|
5
|
+
case RUBY_PLATFORM
|
6
|
+
when 'java'
|
7
|
+
require 'rake/javaextensiontask'
|
8
|
+
Rake::JavaExtensionTask.new('geoipdb')
|
9
|
+
else
|
10
|
+
require 'rake/extensiontask'
|
11
|
+
Rake::ExtensionTask.new('geoipdb')
|
12
|
+
end
|
5
13
|
|
6
14
|
task :default => [:spec]
|
7
15
|
task :build => :compile
|
data/ext/geoipdb/geoipdb.c
CHANGED
@@ -74,7 +74,7 @@ VALUE build_ip_information_object(IpRange *range, City *city, char* isp) {
|
|
74
74
|
rb_ivar_set(ip_information, rb_intern("@lng"), rb_float_new(city->lng) );
|
75
75
|
rb_ivar_set(ip_information, rb_intern("@lat"), rb_float_new(city->lat) );
|
76
76
|
rb_ivar_set(ip_information, rb_intern("@is_mobile"), range->is_mobile == 1 ? Qtrue : Qfalse );
|
77
|
-
rb_ivar_set(ip_information, rb_intern("@isp_name"), isp == NULL ? Qnil : ID2SYM( rb_intern(isp) ) );
|
77
|
+
rb_ivar_set(ip_information, rb_intern("@isp_name"), isp == NULL || strcmp(isp, "?") == 0 ? Qnil : ID2SYM( rb_intern(isp) ) );
|
78
78
|
|
79
79
|
return ip_information;
|
80
80
|
}
|
data/geoipdb.gemspec
CHANGED
@@ -1,28 +1,26 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
|
-
Gem::Specification.new do |
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "geoipdb"
|
5
|
+
spec.version = "0.5.6"
|
6
|
+
spec.authors = ["LiquidM, Inc."]
|
7
|
+
spec.email = ["opensource@liquidm.com"]
|
8
|
+
spec.description = "Fast GeoIpDb implementation for Ruby"
|
9
|
+
spec.summary = "Fast GeoIpDb implementation for Ruby"
|
10
|
+
spec.homepage = "http://github.com/liquidm/geoipdb"
|
11
|
+
spec.licenses = ["MIT"]
|
7
12
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
gem.summary = "Fast (>3 Mio queries/sec!!!) GeoIpDb implementation for Ruby using C-Extensions."
|
13
|
-
gem.homepage = "http://github.com/madvertise/geoipdb"
|
14
|
-
|
15
|
-
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
-
gem.files = `git ls-files`.split("\n")
|
17
|
-
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
-
gem.require_paths = ["lib", "ext"]
|
13
|
+
spec.files = `git ls-files`.split($/)
|
14
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
15
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
|
+
spec.require_paths = ["lib", "ext"]
|
19
17
|
|
20
18
|
if RUBY_PLATFORM =~ /java/
|
21
|
-
|
22
|
-
|
19
|
+
spec.platform = "java"
|
20
|
+
spec.files << "lib/geoipdb.jar"
|
23
21
|
else
|
24
|
-
|
22
|
+
spec.extensions = ["ext/geoipdb/extconf.rb"]
|
25
23
|
end
|
26
24
|
|
27
|
-
|
25
|
+
spec.add_development_dependency "rake-compiler"
|
28
26
|
end
|
data/lib/cgeoipdb.rb
ADDED
data/lib/geoipdb.rb
CHANGED
data/lib/jgeoipdb.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rbconfig'
|
1
2
|
require 'java'
|
2
3
|
require File.expand_path('../geoipdb.jar', __FILE__)
|
3
4
|
|
@@ -28,15 +29,13 @@ class GeoIpDb
|
|
28
29
|
|
29
30
|
def build_ip_information_object(range, city, isp)
|
30
31
|
info = IpInformation.new
|
31
|
-
|
32
32
|
info.country_iso_code = city.country_iso2
|
33
33
|
info.city_name = city.name
|
34
34
|
info.city_code = city.city_code
|
35
35
|
info.lng = city.lng
|
36
36
|
info.lat = city.lat
|
37
37
|
info.is_mobile = range.is_mobile
|
38
|
-
info.isp_name = isp
|
39
|
-
|
38
|
+
info.isp_name = isp ? isp.to_sym : :"?"
|
40
39
|
info
|
41
40
|
end
|
42
41
|
|
data/spec/geoipdb_spec.rb
CHANGED
@@ -51,7 +51,7 @@ describe GeoIpDb do
|
|
51
51
|
init_db
|
52
52
|
@db.information_for_ip("1.0.0.1").isp_name.should == :vodafone
|
53
53
|
@db.information_for_ip("1.1.1.1").isp_name.should == "1vodafone2vodafone3vodafone4vodafone5vodafone1vodafone2vodafone3vodafone4vodafone5vodafone1vodafone2vodafone3vodafone4vodafone5vodafone1vodafone2vodafone3vodafone4vodafone5vodafone"[0..99].to_sym
|
54
|
-
@db.information_for_ip("1.2.1.1").isp_name.should ==
|
54
|
+
@db.information_for_ip("1.2.1.1").isp_name.should == :"?"
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should write and read the cachefile correctly"
|
metadata
CHANGED
@@ -1,50 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geoipdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
9
|
-
- Martin Karlsch
|
10
|
-
- Thomas Hirsch
|
11
|
-
- Benedikt Böhm
|
7
|
+
- LiquidM, Inc.
|
12
8
|
autorequire:
|
13
9
|
bindir: bin
|
14
10
|
cert_chain: []
|
15
|
-
date:
|
11
|
+
date: 2014-01-07 00:00:00.000000000 Z
|
16
12
|
dependencies:
|
17
13
|
- !ruby/object:Gem::Dependency
|
18
14
|
name: rake-compiler
|
19
|
-
requirement:
|
20
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
21
16
|
requirements:
|
22
|
-
- -
|
17
|
+
- - ">="
|
23
18
|
- !ruby/object:Gem::Version
|
24
19
|
version: '0'
|
25
20
|
type: :development
|
26
21
|
prerelease: false
|
27
|
-
version_requirements:
|
28
|
-
|
29
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Fast GeoIpDb implementation for Ruby
|
30
28
|
email:
|
31
|
-
-
|
32
|
-
- martin.karlsch@madvertise.com
|
33
|
-
- thomas.hirsch@madvertise.com
|
34
|
-
- benedikt.boehm@madvertise.com
|
29
|
+
- opensource@liquidm.com
|
35
30
|
executables: []
|
36
31
|
extensions:
|
37
32
|
- ext/geoipdb/extconf.rb
|
38
33
|
extra_rdoc_files: []
|
39
34
|
files:
|
40
|
-
- .
|
41
|
-
- .
|
42
|
-
- .
|
43
|
-
- .rspec
|
44
|
-
- .rvmrc
|
35
|
+
- ".gitignore"
|
36
|
+
- ".rspec"
|
37
|
+
- ".travis.yml"
|
45
38
|
- Gemfile
|
46
39
|
- LICENSE.txt
|
47
|
-
- README.
|
40
|
+
- README.md
|
48
41
|
- Rakefile
|
49
42
|
- ext/geoipdb/extconf.rb
|
50
43
|
- ext/geoipdb/geoipdb.c
|
@@ -55,7 +48,7 @@ files:
|
|
55
48
|
- ext/geoipdb/src/GeoIpDb.java
|
56
49
|
- ext/geoipdb/src/IpRange.java
|
57
50
|
- geoipdb.gemspec
|
58
|
-
- lib/
|
51
|
+
- lib/cgeoipdb.rb
|
59
52
|
- lib/geoipdb.rb
|
60
53
|
- lib/ip_information.rb
|
61
54
|
- lib/jgeoipdb.rb
|
@@ -65,38 +58,31 @@ files:
|
|
65
58
|
- sample_data/ip_ranges_corrupt.csv
|
66
59
|
- spec/geoipdb_spec.rb
|
67
60
|
- spec/spec_helper.rb
|
68
|
-
|
69
|
-
- tasks/rspec.rake
|
70
|
-
- tasks/yard.rake
|
71
|
-
homepage: http://github.com/madvertise/geoipdb
|
61
|
+
homepage: http://github.com/liquidm/geoipdb
|
72
62
|
licenses:
|
73
63
|
- MIT
|
64
|
+
metadata: {}
|
74
65
|
post_install_message:
|
75
66
|
rdoc_options: []
|
76
67
|
require_paths:
|
77
68
|
- lib
|
78
69
|
- ext
|
79
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
-
none: false
|
81
71
|
requirements:
|
82
|
-
- -
|
72
|
+
- - ">="
|
83
73
|
- !ruby/object:Gem::Version
|
84
74
|
version: '0'
|
85
|
-
segments:
|
86
|
-
- 0
|
87
|
-
hash: -2066128621521199120
|
88
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
76
|
requirements:
|
91
|
-
- -
|
77
|
+
- - ">="
|
92
78
|
- !ruby/object:Gem::Version
|
93
79
|
version: '0'
|
94
80
|
requirements: []
|
95
81
|
rubyforge_project:
|
96
|
-
rubygems_version:
|
82
|
+
rubygems_version: 2.2.0
|
97
83
|
signing_key:
|
98
|
-
specification_version:
|
99
|
-
summary: Fast
|
84
|
+
specification_version: 4
|
85
|
+
summary: Fast GeoIpDb implementation for Ruby
|
100
86
|
test_files:
|
101
87
|
- spec/geoipdb_spec.rb
|
102
88
|
- spec/spec_helper.rb
|
data/.document
DELETED
data/.jrubyrc
DELETED
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use --create jruby-1.7.2@geoipdb
|
data/README.markdown
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# geoipdb: fast (in memory!) geo location db.
|
2
|
-
|
3
|
-
Fast (>3 Mio queries/sec!!!) GeoIpDb implementation for Ruby using C/Java-Extensions.
|
4
|
-
|
5
|
-
* Returns a GeoLocation and additional information for a given IP.
|
6
|
-
* Reads Data from CSV-Files and uses internal binary caching.
|
7
|
-
|
8
|
-
## Usage
|
9
|
-
|
10
|
-
db = IpDb.init "city_codes.csv", "ip_city.txt", "ip_city.cache"
|
11
|
-
ip_info = db.information_for_ip("178.0.0.1")
|
12
|
-
ip_info.inspect
|
13
|
-
=> #<IpInformation:0x101385c78 @city_name="eschborn", @city_code="ax5", @lng=8.55, @country_iso_code="de", @lat=50.133333, @is_mobile=true>
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2010 madvertise GmbH. See LICENSE.txt for
|
18
|
-
further details.
|
data/lib/geoipdb.jar
DELETED
Binary file
|
data/tasks/compile.rake
DELETED
data/tasks/rspec.rake
DELETED