ipcat_jruby 0.2-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/ipcat.jar +0 -0
  3. data/lib/ipcat.rb +28 -0
  4. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c24ce1e64fd4cb9f6a013c4987c5a3964c468c1c
4
+ data.tar.gz: 569bea414a7aca790bcd7bf1aa389c0ab236644b
5
+ SHA512:
6
+ metadata.gz: 8760c449e9c9b58b1410eb3efad636baff25109d07e6ef1fb07507c0d98e3455f36ca27d65efcd00a9a596ddfba0d4632bb23da17f473d6c052d9bd20f34989d
7
+ data.tar.gz: 74da4f55dabd9f363d0322da12646ab5d7f799fe69023ad3efb5116d30c81a2823ca167bc2c9297dba3e2ac09ef9ccc3824131580ed45684d6550afd288320c2
data/lib/ipcat.jar ADDED
Binary file
data/lib/ipcat.rb ADDED
@@ -0,0 +1,28 @@
1
+ require 'java'
2
+ require 'ipcat.jar'
3
+
4
+ module IPCat
5
+ class Datacenters
6
+ def initialize(file)
7
+ @urls = []
8
+ @blocks = org.ipcat.Blocks.new
9
+ File.open(file, 'r').readlines.map do |line|
10
+ add(*line.chomp.split(','))
11
+ end
12
+ end
13
+
14
+ def add(start, stop, _name, url = nil)
15
+ @urls << url
16
+ @blocks.add org.ipcat.IP.parseIp(start), org.ipcat.IP.parseIp(stop)
17
+ end
18
+
19
+ def find(ipstring)
20
+ n = @blocks.find(org.ipcat.IP.parseIp(ipstring))
21
+ return @urls[n] unless n == -1
22
+ end
23
+
24
+ def length
25
+ @starts.length
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ipcat_jruby
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.2'
5
+ platform: java
6
+ authors:
7
+ - Mathieu Lecarme
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Client for the data from https://github.com/client9/ipcat
14
+ email: mlecarme@garambrogne.net
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/ipcat.jar
20
+ - lib/ipcat.rb
21
+ homepage: https://github.com/athoune/ipcat_jruby
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.4.8
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: 'IP Category : does it came from a datacenter?'
45
+ test_files: []