geoipdb 0.5.5-java → 0.5.6-java
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.jar +0 -0
- data/lib/geoipdb.rb +1 -2
- data/lib/jgeoipdb.rb +2 -3
- data/spec/geoipdb_spec.rb +1 -1
- metadata +24 -45
- data/.document +0 -5
- data/.jrubyrc +0 -12
- data/.rvmrc +0 -1
- data/README.markdown +0 -18
- 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: 132f6fde9a253cfc08c90276c6ff39a6b03ba48a
|
4
|
+
data.tar.gz: 8abeb447c126c6011c817a34f6284fea52eb32db
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 70c1b265c2f42c0daf177b6c4f9c47e572f616fdc0ef63a30b558cdc1278d5100504b730770255c6534c250ffce8b567989ee0d5dc41d0740b0863ffd4f0a3df
|
7
|
+
data.tar.gz: 751b2acfdbaa3864ea689624eab464fed95d2a00cf3dcb731e559f73b89f9c55ff6b5e1b31c8ee3e9ad84ff6fe9738c1068d574b78a078f3be985b801e621b8f
|
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.jar
CHANGED
Binary file
|
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,55 +1,42 @@
|
|
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: java
|
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
15
|
version_requirements: !ruby/object:Gem::Requirement
|
20
16
|
requirements:
|
21
|
-
- -
|
17
|
+
- - '>='
|
22
18
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
-
MA==
|
25
|
-
none: false
|
19
|
+
version: '0'
|
26
20
|
requirement: !ruby/object:Gem::Requirement
|
27
21
|
requirements:
|
28
|
-
- -
|
22
|
+
- - '>='
|
29
23
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
31
|
-
MA==
|
32
|
-
none: false
|
24
|
+
version: '0'
|
33
25
|
prerelease: false
|
34
26
|
type: :development
|
35
|
-
description:
|
27
|
+
description: Fast GeoIpDb implementation for Ruby
|
36
28
|
email:
|
37
|
-
-
|
38
|
-
- martin.karlsch@madvertise.com
|
39
|
-
- thomas.hirsch@madvertise.com
|
40
|
-
- benedikt.boehm@madvertise.com
|
29
|
+
- opensource@liquidm.com
|
41
30
|
executables: []
|
42
31
|
extensions: []
|
43
32
|
extra_rdoc_files: []
|
44
33
|
files:
|
45
|
-
-
|
46
|
-
-
|
47
|
-
-
|
48
|
-
- ".rspec"
|
49
|
-
- ".rvmrc"
|
34
|
+
- .gitignore
|
35
|
+
- .rspec
|
36
|
+
- .travis.yml
|
50
37
|
- Gemfile
|
51
38
|
- LICENSE.txt
|
52
|
-
- README.
|
39
|
+
- README.md
|
53
40
|
- Rakefile
|
54
41
|
- ext/geoipdb/extconf.rb
|
55
42
|
- ext/geoipdb/geoipdb.c
|
@@ -60,7 +47,7 @@ files:
|
|
60
47
|
- ext/geoipdb/src/GeoIpDb.java
|
61
48
|
- ext/geoipdb/src/IpRange.java
|
62
49
|
- geoipdb.gemspec
|
63
|
-
- lib/
|
50
|
+
- lib/cgeoipdb.rb
|
64
51
|
- lib/geoipdb.rb
|
65
52
|
- lib/ip_information.rb
|
66
53
|
- lib/jgeoipdb.rb
|
@@ -70,12 +57,11 @@ files:
|
|
70
57
|
- sample_data/ip_ranges_corrupt.csv
|
71
58
|
- spec/geoipdb_spec.rb
|
72
59
|
- spec/spec_helper.rb
|
73
|
-
-
|
74
|
-
|
75
|
-
- tasks/yard.rake
|
76
|
-
homepage: http://github.com/madvertise/geoipdb
|
60
|
+
- lib/geoipdb.jar
|
61
|
+
homepage: http://github.com/liquidm/geoipdb
|
77
62
|
licenses:
|
78
63
|
- MIT
|
64
|
+
metadata: {}
|
79
65
|
post_install_message:
|
80
66
|
rdoc_options: []
|
81
67
|
require_paths:
|
@@ -83,27 +69,20 @@ require_paths:
|
|
83
69
|
- ext
|
84
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
71
|
requirements:
|
86
|
-
- -
|
72
|
+
- - '>='
|
87
73
|
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
- 0
|
90
|
-
version: !binary |-
|
91
|
-
MA==
|
92
|
-
hash: 2
|
93
|
-
none: false
|
74
|
+
version: '0'
|
94
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
76
|
requirements:
|
96
|
-
- -
|
77
|
+
- - '>='
|
97
78
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
99
|
-
MA==
|
100
|
-
none: false
|
79
|
+
version: '0'
|
101
80
|
requirements: []
|
102
81
|
rubyforge_project:
|
103
|
-
rubygems_version: 1.
|
82
|
+
rubygems_version: 2.1.9
|
104
83
|
signing_key:
|
105
|
-
specification_version:
|
106
|
-
summary: Fast
|
84
|
+
specification_version: 4
|
85
|
+
summary: Fast GeoIpDb implementation for Ruby
|
107
86
|
test_files:
|
108
87
|
- spec/geoipdb_spec.rb
|
109
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/tasks/compile.rake
DELETED
data/tasks/rspec.rake
DELETED