Permalink
Browse files

Move ip_address files from jpmobile

Signed-off-by: Shin-ichiro OGAWA <rust.stnard+git@gmail.com>
  • Loading branch information...
1 parent dd09997 commit 6082296a6873a017ce5b991cf1c8dc74f5b2c723 @rust rust committed Sep 3, 2010
View
@@ -0,0 +1,7 @@
+Copyright (c) 2006 Yoji Shidara
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -0,0 +1,24 @@
+require 'rubygems'
+require 'rake'
+require 'rake/clean'
+require 'rake/testtask'
+require 'rake/rdoctask'
+require 'fileutils'
+include FileUtils
+
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |gem|
+ gem.name = "jpmobile-ipaddresses"
+ gem.summary = "Carrier IP Address List for jpmobile"
+ gem.description = "Carrier IP Address List for jpmobile"
+ gem.email = "rust.stnard@gmail.com"
+ gem.homepage = "http://github.com/jpmobile/jpmobile-ipaddresses"
+ gem.authors = ["Shin-ichiro OGAWA"]
+
+ gem.add_development_dependency('jeweler', '>=1.4.0')
+ end
+rescue LoadError
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
+end
+Jeweler::GemcutterTasks.new
@@ -0,0 +1,50 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{jpmobile-ipaddresses}
+ s.version = "0.0.0"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Shin-ichiro OGAWA"]
+ s.date = %q{2010-09-03}
+ s.description = %q{Carrier IP Address List for jpmobile}
+ s.email = %q{rust.stnard@gmail.com}
+ s.extra_rdoc_files = [
+ "README"
+ ]
+ s.files = [
+ "MIT-LICENSE",
+ "README",
+ "Rakefile",
+ "VERSION",
+ "lib/jpmobile.rb",
+ "lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb",
+ "lib/jpmobile/mobile/ip_addresses/au.rb",
+ "lib/jpmobile/mobile/ip_addresses/docomo.rb",
+ "lib/jpmobile/mobile/ip_addresses/emobile.rb",
+ "lib/jpmobile/mobile/ip_addresses/softbank.rb",
+ "lib/jpmobile/mobile/ip_addresses/willcom.rb"
+ ]
+ s.homepage = %q{http://github.com/jpmobile/jpmobile-ipaddresses}
+ s.rdoc_options = ["--charset=UTF-8"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.3.7}
+ s.summary = %q{Carrier IP Address List for jpmobile}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_development_dependency(%q<jeweler>, [">= 1.4.0"])
+ else
+ s.add_dependency(%q<jeweler>, [">= 1.4.0"])
+ end
+ else
+ s.add_dependency(%q<jeweler>, [">= 1.4.0"])
+ end
+end
+
View
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) ||
+ $:.include?(File.expand_path(File.dirname(__FILE__)))
+
+module Jpmobile
+ module Mobile
+ module IpAddresses
+ autoload :AbstractIpAddresses, 'jpmobile/mobile/ip_addresses/abstract_ip_addresses'
+ autoload :Docomo, 'jpmobile/mobile/ip_addresses/docomo'
+ autoload :Au, 'jpmobile/mobile/ip_addresses/au'
+ autoload :Softbank, 'jpmobile/mobile/ip_addresses/softbank'
+ autoload :Vodafone, 'jpmobile/mobile/ip_addresses/softbank'
+ autoload :Willcom, 'jpmobile/mobile/ip_addresses/willcom'
+ autoload :Ddipocket, 'jpmobile/mobile/ip_addresses/willcom'
+ autoload :Emobile, 'jpmobile/mobile/ip_addresses/emobile'
+ end
+ end
+end
@@ -0,0 +1,23 @@
+module Jpmobile
+ module Mobile
+ module IpAddresses
+ class AbstractIpAddresses
+ def valid_ip?(remote_ip_str)
+ begin
+ remote_ip = IPAddr.new(remote_ip_str)
+ rescue
+ return false
+ end
+
+ self.class.ip_address_list.any? {|ip| ip.include?(remote_ip)}
+ end
+
+ class << self
+ def ip_address_list
+ []
+ end
+ end
+ end
+ end
+ end
+end
@@ -0,0 +1,40 @@
+module Jpmobile
+ module Mobile
+ module IpAddresses
+ class Au < AbstractIpAddresses
+ class << self
+ def ip_address_list
+ @@ip_address_list ||= [
+ "210.230.128.224/28",
+ "121.111.227.160/27",
+ "61.117.1.0/28",
+ "219.108.158.0/27",
+ "219.125.146.0/28",
+ "61.117.2.32/29",
+ "61.117.2.40/29",
+ "219.108.158.40/29",
+ "219.125.148.0/25",
+ "222.5.63.0/25",
+ "222.5.63.128/25",
+ "222.5.62.128/25",
+ "59.135.38.128/25",
+ "219.108.157.0/25",
+ "219.125.145.0/25",
+ "121.111.231.0/25",
+ "121.111.227.0/25",
+ "118.152.214.192/26",
+ "118.159.131.0/25",
+ "118.159.133.0/25",
+ "118.159.132.160/27",
+ "111.86.142.0/26",
+ "111.86.141.64/26",
+ "111.86.141.128/26",
+ "111.86.141.192/26",
+ "118.159.133.192/26"
+ ].map {|ip| IPAddr.new(ip) }
+ end
+ end
+ end
+ end
+ end
+end
@@ -0,0 +1,22 @@
+module Jpmobile
+ module Mobile
+ module IpAddresses
+ class Docomo < AbstractIpAddresses
+ class << self
+ def ip_address_list
+ @@ip_address_list ||= [
+ "210.153.84.0/24",
+ "210.136.161.0/24",
+ "210.153.86.0/24",
+ "124.146.174.0/24",
+ "124.146.175.0/24",
+ "202.229.176.0/24",
+ "202.229.177.0/24",
+ "202.229.178.0/24"
+ ].map {|ip| IPAddr.new(ip)}
+ end
+ end
+ end
+ end
+ end
+end
@@ -0,0 +1,15 @@
+module Jpmobile
+ module Mobile
+ module IpAddresses
+ class Emobile < AbstractIpAddresses
+ class << self
+ def ip_address_list
+ @@ip_address_list ||= [
+ "117.55.1.224/27"
+ ].map {|ip| IPAddr.new(ip) }
+ end
+ end
+ end
+ end
+ end
+end
@@ -0,0 +1,20 @@
+module Jpmobile
+ module Mobile
+ module IpAddresses
+ class Softbank < AbstractIpAddresses
+ class << self
+ def ip_address_list
+ @@ip_address_list ||= [
+ "123.108.237.0/27",
+ "202.253.96.224/27",
+ "210.146.7.192/26",
+ "210.175.1.128/25"
+ ].map {|ip| IPAddr.new(ip) }
+ end
+ end
+ end
+ class Vodafone < Softbank
+ end
+ end
+ end
+end
@@ -0,0 +1,158 @@
+module Jpmobile
+ module Mobile
+ module IpAddresses
+ class Willcom < AbstractIpAddresses
+ class << self
+ def ip_address_list
+ @@ip_address_list ||= [
+ "61.198.128.0/24",
+ "61.198.129.0/24",
+ "61.198.130.0/24",
+ "61.198.131.0/24",
+ "61.198.132.0/24",
+ "61.198.133.0/24",
+ "61.198.134.0/24",
+ "61.198.135.0/24",
+ "61.198.136.0/24",
+ "61.198.137.0/24",
+ "61.198.138.100/32",
+ "61.198.138.101/32",
+ "61.198.138.102/32",
+ "61.198.138.103/32",
+ "61.198.139.0/29",
+ "61.198.139.128/27",
+ "61.198.139.160/28",
+ "61.198.140.0/24",
+ "61.198.141.0/24",
+ "61.198.142.0/24",
+ "61.198.143.0/24",
+ "61.198.160.0/24",
+ "61.198.161.0/24",
+ "61.198.162.0/24",
+ "61.198.163.0/24",
+ "61.198.164.0/24",
+ "61.198.165.0/24",
+ "61.198.166.0/24",
+ "61.198.168.0/24",
+ "61.198.169.0/24",
+ "61.198.170.0/24",
+ "61.198.171.0/24",
+ "61.198.172.0/24",
+ "61.198.173.0/24",
+ "61.198.174.0/24",
+ "61.198.175.0/24",
+ "61.198.248.0/24",
+ "61.198.249.0/24",
+ "61.198.250.0/24",
+ "61.198.251.0/24",
+ "61.198.252.0/24",
+ "61.198.253.0/24",
+ "61.198.254.0/24",
+ "61.198.255.0/24",
+ "61.204.0.0/24",
+ "61.204.2.0/24",
+ "61.204.3.0/25",
+ "61.204.3.128/25",
+ "61.204.4.0/24",
+ "61.204.5.0/24",
+ "61.204.6.0/25",
+ "61.204.6.128/25",
+ "61.204.7.0/25",
+ "61.204.92.0/24",
+ "61.204.93.0/24",
+ "61.204.94.0/24",
+ "61.204.95.0/24",
+ "114.20.49.0/24",
+ "114.20.50.0/24",
+ "114.20.51.0/24",
+ "114.20.52.0/24",
+ "114.20.53.0/24",
+ "114.20.54.0/24",
+ "114.20.55.0/24",
+ "114.20.56.0/24",
+ "114.20.57.0/24",
+ "114.20.58.0/24",
+ "114.20.59.0/24",
+ "114.20.60.0/24",
+ "114.20.61.0/24",
+ "114.20.62.0/24",
+ "114.20.63.0/24",
+ "114.20.64.0/24",
+ "114.20.65.0/24",
+ "114.20.66.0/24",
+ "114.20.67.0/24",
+ "114.21.255.0/27",
+ "125.28.0.0/24",
+ "125.28.1.0/24",
+ "125.28.15.0/24",
+ "125.28.16.0/24",
+ "125.28.17.0/24",
+ "125.28.2.0/24",
+ "125.28.3.0/24",
+ "125.28.4.0/24",
+ "125.28.5.0/24",
+ "125.28.8.0/24",
+ "210.168.246.0/24",
+ "210.168.247.0/24",
+ "210.169.92.0/24",
+ "210.169.93.0/24",
+ "210.169.94.0/24",
+ "210.169.95.0/24",
+ "210.169.96.0/24",
+ "210.169.97.0/24",
+ "210.169.98.0/24",
+ "210.169.99.0/24",
+ "211.126.192.128/25",
+ "211.18.232.0/24",
+ "211.18.233.0/24",
+ "211.18.234.0/24",
+ "211.18.235.0/24",
+ "211.18.236.0/24",
+ "211.18.237.0/24",
+ "219.108.10.0/24",
+ "219.108.11.0/24",
+ "219.108.12.0/24",
+ "219.108.13.0/24",
+ "219.108.14.0/24",
+ "219.108.15.0/24",
+ "219.108.7.0/24",
+ "219.108.8.0/24",
+ "219.108.9.0/24",
+ "221.119.0.0/24",
+ "221.119.1.0/24",
+ "221.119.2.0/24",
+ "221.119.3.0/24",
+ "221.119.4.0/24",
+ "221.119.6.0/24",
+ "221.119.7.0/24",
+ "221.119.8.0/24",
+ "221.119.9.0/24",
+ "114.20.49.0/24",
+ "114.20.50.0/24",
+ "114.20.51.0/24",
+ "114.20.52.0/24",
+ "114.20.53.0/24",
+ "114.20.54.0/24",
+ "114.20.55.0/24",
+ "114.20.56.0/24",
+ "114.20.57.0/24",
+ "114.20.58.0/24",
+ "114.20.59.0/24",
+ "114.20.60.0/24",
+ "114.20.61.0/24",
+ "114.20.62.0/24",
+ "114.20.63.0/24",
+ "114.20.64.0/24",
+ "114.20.65.0/24",
+ "114.20.66.0/24",
+ "114.20.67.0/24",
+ "114.21.255.0/27"
+ ].map {|ip| IPAddr.new(ip) }
+ end
+ end
+ end
+ class Ddipocket < Willcom
+ end
+ end
+ end
+end

0 comments on commit 6082296

Please sign in to comment.