[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Debian JP master SVN www commits (rev.552)



=======================================================
Repository: /org/svn.debian.or.jp/repos
  Revision: 552
  Commiter: yasu
      Date: 2008-02-04 11:09:14 +0900 (月, 04  2月 2008)
=======================================================
Log:

add continent and country

=======================================================
Changed:

U   cdn/trunk/DNS-Balance/ChangeLog
U   cdn/trunk/DNS-Balance/dns_balance.rb
U   cdn/trunk/check-surrogates.rb
A   cdn/trunk/continent/
A   cdn/trunk/continent/AF_deb_cdn_araki_net.rb
A   cdn/trunk/continent/AS_deb_cdn_araki_net.rb
A   cdn/trunk/continent/EU_deb_cdn_araki_net.rb
A   cdn/trunk/continent/NA_deb_cdn_araki_net.rb
A   cdn/trunk/continent/OC_deb_cdn_araki_net.rb
A   cdn/trunk/continent/SA_deb_cdn_araki_net.rb
A   cdn/trunk/country/JPN_deb_cdn_araki_net.rb
A   cdn/trunk/country/JPN_jp_cdn_araki_net.rb
D   cdn/trunk/country/JP_deb_cdn_araki_net.rb
D   cdn/trunk/country/JP_jp_cdn_araki_net.rb
A   cdn/trunk/country/KOR_deb_cdn_araki_net.rb
D   cdn/trunk/country/KR_deb_cdn_araki_net.rb

Modified: cdn/trunk/DNS-Balance/ChangeLog
===================================================================
--- cdn/trunk/DNS-Balance/ChangeLog	2008-02-03 12:24:53 UTC (rev 551)
+++ cdn/trunk/DNS-Balance/ChangeLog	2008-02-04 02:09:14 UTC (rev 552)
@@ -1,3 +1,8 @@
+2008-02-04  ARAKI Yasuhiro  <ar@debian.org>
+
+	* dns_balance.rb (select_namespace): コマンドラインオプションに
+	--country と -p ポート番号 を追加。
+
 2005-06-09  YOKOTA Hiroshi  <yokota@xxxxxxxxxxxxxxxxxxxxxxx>
 
 	* dns_balance.rb: コマンドラインオプションの解析を "getopts.rb" か

Modified: cdn/trunk/DNS-Balance/dns_balance.rb
===================================================================
--- cdn/trunk/DNS-Balance/dns_balance.rb	2008-02-03 12:24:53 UTC (rev 551)
+++ cdn/trunk/DNS-Balance/dns_balance.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -93,16 +93,15 @@
     end
   }
 
-  # XXX by GeoIP
-  if OPT["geoip"] &&
+  # country by GeoIP
+  if OPT["country"] &&
       ip_mask(addrstr,  8) != "10.0.0.0"      &&
       ip_mask(addrstr, 12) != "172.16.0.0"    &&
       ip_mask(addrstr, 16) != "192.168.0.0"   &&
-      ip_mask(addrstr, 21) != "204.152.184.0" #&&
-#      addrstr              != "127.0.0.1"
+      ip_mask(addrstr, 21) != "204.152.184.0" &&
+      addrstr              != "127.0.0.1"
     
-    addrstr = "210.130.0.1"
-    as = geoip_search(addrstr)
+    as = geoip_search_country(addrstr)
 
     if as                  != nil &&
 	$addr_db[as]       != nil &&
@@ -111,6 +110,24 @@
     end
   end
 
+  # continent: AS, EU, SA, AF, OC, NA
+  # continent by GeoIP
+  if OPT["continent"] &&
+      ip_mask(addrstr,  8) != "10.0.0.0"      &&
+      ip_mask(addrstr, 12) != "172.16.0.0"    &&
+      ip_mask(addrstr, 16) != "192.168.0.0"   &&
+      ip_mask(addrstr, 21) != "204.152.184.0" &&
+      addrstr              != "127.0.0.1"
+    
+    as = geoip_search_continent(addrstr)
+
+    if as                  != nil &&
+	$addr_db[as]       != nil &&
+	$addr_db[as][name] != nil
+      return as
+    end
+  end
+
   # AS namespace
   if OPT["as"] &&
       # RFC1918 / プライベートアドレスはどこの AS にも属していない
@@ -131,12 +148,17 @@
   return "default"
 end
 
-def geoip_search(str)
+def geoip_search_country(str)
   geo = GeoIP.new('/usr/share/GeoIP/GeoIP.dat').country(str)
-  return geo[3]
+  return geo[4]
 end
 
+def geoip_search_continent(str)
+  geo = GeoIP.new('/usr/share/GeoIP/GeoIP.dat').country(str)
+  return geo[6]
+end
 
+
 # 重みつき変数のための表を作る
 def make_rand_array(namespace, name)
   rnd_max = 0
@@ -231,8 +253,8 @@
     |o|
     OPT["port"] = o;
   }
-  opt.on("--geoip", "Enable GeoIP namespace") {
-    OPT["geoip"] = true
+  opt.on("--country", "Enable Country by GeoIP ") {
+    OPT["country"] = true
   }
   opt.on("--as", "Enable AS namespace") {
     OPT["as"] = true

Modified: cdn/trunk/check-surrogates.rb
===================================================================
--- cdn/trunk/check-surrogates.rb	2008-02-03 12:24:53 UTC (rev 551)
+++ cdn/trunk/check-surrogates.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -65,6 +65,7 @@
   def make_surrogate_line(listfile)
     domain = listfile.gsub(/\.\/lists_/, '')
     domain.gsub!(/\.\/country\/[A-Z]+_/, '')
+    domain.gsub!(/\.\/continent\/[A-Z]+_/, '')
     domain.gsub!(/_/, '.')
 
     surrogates = ''
@@ -146,7 +147,6 @@
   end
 end
 countries.uniq!
-
 countries.each do |country|
   cs = CheckSurrogate.new
   Find.find(File.dirname(__FILE__) + '/country') do |f|
@@ -168,11 +168,41 @@
   cs.logclose
 end
 
+###
 
+listfiles = Array.new
+continents = Array.new
+Find.find(File.dirname(__FILE__) + '/continent') do |f|
+  if f =~ /^\.\/continent\/([A-Z]+)_[\w_]+\.rb$/
+    continents.push $1
+  end
+end
+continents.uniq!
+continents.each do |continent|
+  cs = CheckSurrogate.new
+  Find.find(File.dirname(__FILE__) + '/continent') do |f|
+    if f =~ /^\.\/continent\/#{continent}_[\w_]+\.rb$/
+      f.gsub!(/\.rb$/,'')
+      cs.make_surrogate_line(f)
+    end
+  end
+  foo = File.open(".addrs/#{continent}", 'w')
+  foo.puts "##" + Time.now.to_s + "\n\n"
+  foo.puts "$tmp_db = {
+  \"#{continent}\" => {
+"
+  foo.puts cs.lines
+  foo.puts '
+  },
+}'
+  foo.close
+  cs.logclose
+end
 
+###
+
 Find.find(File.dirname(__FILE__) + '/.addrs') do |f|
   if f =~ /^\.\/\.addrs\/([\w_]+)$/
-    country = $1
     bar = File.open(f, 'r')
     eval(bar.read)
 

Added: cdn/trunk/continent/AF_deb_cdn_araki_net.rb
===================================================================
--- cdn/trunk/continent/AF_deb_cdn_araki_net.rb	                        (rev 0)
+++ cdn/trunk/continent/AF_deb_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -0,0 +1,3 @@
+$surrogates = {
+  '155.232.137.216' => '9000', # debian.mirror.ac.za
+}

Added: cdn/trunk/continent/AS_deb_cdn_araki_net.rb
===================================================================
--- cdn/trunk/continent/AS_deb_cdn_araki_net.rb	                        (rev 0)
+++ cdn/trunk/continent/AS_deb_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -0,0 +1,16 @@
+$tracefile = 'hanzubon.jp' # hanzubon 2007apr5
+$first_surrogate = '61.115.118.67'
+
+$surrogates = {
+  '203.178.137.175' => '9000', # naist
+  '61.115.118.67' => '1000', # hanzubon 2007apr5
+  '210.157.158.38' => '9900', # plat
+  '202.229.186.27' => '20', # topstudio
+  '133.5.166.3' => '10', # dennou-q.gfd-dennou.org
+  '130.54.59.159' => '10', # dennou-k.gfd-dennou.org
+  '133.50.218.117' => '10', # dennou-h.gfd-dennou.org
+  '61.206.119.174' => '20', # oyu-net.jp
+##  '219.111.15.135' => '1000', # tagoh
+#  '15.12.218.222' => '9900', # fail data for test
+#  '210.157.158.59' => '9900' ## fail data for test
+}

Added: cdn/trunk/continent/EU_deb_cdn_araki_net.rb
===================================================================
--- cdn/trunk/continent/EU_deb_cdn_araki_net.rb	                        (rev 0)
+++ cdn/trunk/continent/EU_deb_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -0,0 +1,4 @@
+$surrogates = {
+  '141.76.2.4' => '9000', # de
+  '83.142.228.128' => '9000', # uk
+}

Added: cdn/trunk/continent/NA_deb_cdn_araki_net.rb
===================================================================
--- cdn/trunk/continent/NA_deb_cdn_araki_net.rb	                        (rev 0)
+++ cdn/trunk/continent/NA_deb_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -0,0 +1,5 @@
+$surrogates = {
+  '35.9.37.225' => '9000', 
+  '128.30.2.36' => '9000', 
+  '204.152.191.39' => '9000', 
+}

Added: cdn/trunk/continent/OC_deb_cdn_araki_net.rb
===================================================================
--- cdn/trunk/continent/OC_deb_cdn_araki_net.rb	                        (rev 0)
+++ cdn/trunk/continent/OC_deb_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -0,0 +1,3 @@
+$surrogates = {
+  '150.203.164.37' => '9000', # mirror.linux.org.au
+}

Added: cdn/trunk/continent/SA_deb_cdn_araki_net.rb
===================================================================
--- cdn/trunk/continent/SA_deb_cdn_araki_net.rb	                        (rev 0)
+++ cdn/trunk/continent/SA_deb_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -0,0 +1,3 @@
+$surrogates = {
+  '200.17.202.1' => '9000', 
+}

Copied: cdn/trunk/country/JPN_deb_cdn_araki_net.rb (from rev 551, cdn/trunk/country/JP_deb_cdn_araki_net.rb)
===================================================================
--- cdn/trunk/country/JPN_deb_cdn_araki_net.rb	                        (rev 0)
+++ cdn/trunk/country/JPN_deb_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -0,0 +1,16 @@
+$tracefile = 'hanzubon.jp' # hanzubon 2007apr5
+$first_surrogate = '61.115.118.67'
+
+$surrogates = {
+  '203.178.137.175' => '9000', # naist
+  '61.115.118.67' => '1000', # hanzubon 2007apr5
+  '210.157.158.38' => '9900', # plat
+  '202.229.186.27' => '20', # topstudio
+  '133.5.166.3' => '10', # dennou-q.gfd-dennou.org
+  '130.54.59.159' => '10', # dennou-k.gfd-dennou.org
+  '133.50.218.117' => '10', # dennou-h.gfd-dennou.org
+  '61.206.119.174' => '20', # oyu-net.jp
+##  '219.111.15.135' => '1000', # tagoh
+#  '15.12.218.222' => '9900', # fail data for test
+#  '210.157.158.59' => '9900' ## fail data for test
+}

Copied: cdn/trunk/country/JPN_jp_cdn_araki_net.rb (from rev 551, cdn/trunk/country/JP_jp_cdn_araki_net.rb)
===================================================================
--- cdn/trunk/country/JPN_jp_cdn_araki_net.rb	                        (rev 0)
+++ cdn/trunk/country/JPN_jp_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -0,0 +1,16 @@
+$tracefile = 'hanzubon.jp' # hanzubon 2007apr5
+$first_surrogate = '61.115.118.67'
+
+$surrogates = {
+  '203.178.137.175' => '9000', # naist
+  '61.115.118.67' => '1000', # hanzubon 2007apr5
+  '210.157.158.38' => '9900', # plat
+  '202.229.186.27' => '20', # topstudio
+  '133.5.166.3' => '10', # dennou-q.gfd-dennou.org
+  '130.54.59.159' => '10', # dennou-k.gfd-dennou.org
+  '133.50.218.117' => '10', # dennou-h.gfd-dennou.org
+  '61.206.119.174' => '20', # oyu-net.jp
+##  '219.111.15.135' => '1000', # tagoh
+#  '15.12.218.222' => '9900', # fail data for test
+#  '210.157.158.59' => '9900' ## fail data for test
+}

Deleted: cdn/trunk/country/JP_deb_cdn_araki_net.rb
===================================================================
--- cdn/trunk/country/JP_deb_cdn_araki_net.rb	2008-02-03 12:24:53 UTC (rev 551)
+++ cdn/trunk/country/JP_deb_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -1,16 +0,0 @@
-$tracefile = 'hanzubon.jp' # hanzubon 2007apr5
-$first_surrogate = '61.115.118.67'
-
-$surrogates = {
-  '203.178.137.175' => '9000', # naist
-  '61.115.118.67' => '1000', # hanzubon 2007apr5
-  '210.157.158.38' => '9900', # plat
-  '202.229.186.27' => '20', # topstudio
-  '133.5.166.3' => '10', # dennou-q.gfd-dennou.org
-  '130.54.59.159' => '10', # dennou-k.gfd-dennou.org
-  '133.50.218.117' => '10', # dennou-h.gfd-dennou.org
-  '61.206.119.174' => '20', # oyu-net.jp
-##  '219.111.15.135' => '1000', # tagoh
-#  '15.12.218.222' => '9900', # fail data for test
-#  '210.157.158.59' => '9900' ## fail data for test
-}

Deleted: cdn/trunk/country/JP_jp_cdn_araki_net.rb
===================================================================
--- cdn/trunk/country/JP_jp_cdn_araki_net.rb	2008-02-03 12:24:53 UTC (rev 551)
+++ cdn/trunk/country/JP_jp_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -1,16 +0,0 @@
-$tracefile = 'hanzubon.jp' # hanzubon 2007apr5
-$first_surrogate = '61.115.118.67'
-
-$surrogates = {
-  '203.178.137.175' => '9000', # naist
-  '61.115.118.67' => '1000', # hanzubon 2007apr5
-  '210.157.158.38' => '9900', # plat
-  '202.229.186.27' => '20', # topstudio
-  '133.5.166.3' => '10', # dennou-q.gfd-dennou.org
-  '130.54.59.159' => '10', # dennou-k.gfd-dennou.org
-  '133.50.218.117' => '10', # dennou-h.gfd-dennou.org
-  '61.206.119.174' => '20', # oyu-net.jp
-##  '219.111.15.135' => '1000', # tagoh
-#  '15.12.218.222' => '9900', # fail data for test
-#  '210.157.158.59' => '9900' ## fail data for test
-}

Copied: cdn/trunk/country/KOR_deb_cdn_araki_net.rb (from rev 551, cdn/trunk/country/KR_deb_cdn_araki_net.rb)
===================================================================
--- cdn/trunk/country/KOR_deb_cdn_araki_net.rb	                        (rev 0)
+++ cdn/trunk/country/KOR_deb_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -0,0 +1,3 @@
+$surrogates = {
+  '143.248.234.110' => '20', 
+}

Deleted: cdn/trunk/country/KR_deb_cdn_araki_net.rb
===================================================================
--- cdn/trunk/country/KR_deb_cdn_araki_net.rb	2008-02-03 12:24:53 UTC (rev 551)
+++ cdn/trunk/country/KR_deb_cdn_araki_net.rb	2008-02-04 02:09:14 UTC (rev 552)
@@ -1,3 +0,0 @@
-$surrogates = {
-  '143.248.234.110' => '20', 
-}