それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

No-IPに乗り換え。DynDNSが2014/05/07に無料サービス停止です。

DynDNSがいよいよ無料DDNSのサービスを全廃してサーバーすら停止します。

ありがとうございましたDynDNS

ブログがポストされてる。

For the last 15 years, all of us at Dyn have taken pride in offering a free version of our Dynamic DNS Pro product. What was originally a product built for a > small group of users has blossomed into an exciting technology used around the world.

That is why with mixed emotions we announced the end of that free hostname program today, officially turning down on May 7th.

Of course, the big question when these things happen is, “Why?”>
- We have an obligation to have the cleanest DNS network possible. There is a danger to a free infrastructure and over the years, we have seen mixed results > from our freemium model. We have seen an increase in abuse and a portion of users violating our trust, so we felt closing this down was the most responsible > action we could take to our paying customers. This is something we have been struggling with for years.

  • This change in the business will allow us to invest in our customer support teams so that we can continue to strive to deliver an exceptional customer > experience. For us, it’s simple: we need to support those that are supporting us. Our plan is to invest millions of dollars into our platform and to the > support of those using it. In order for everyone to get the most out of that investment, this move had to be made.

  • Our early donors will be un> affected by this change. We promised that group free services for life as a thanks for their financial commitment, and we will > always stand by that promise.>
    Our free users have been an important part of our early success and for that, we are all extremely grateful. We have offered a discounted rate for those free > customers to help ease the transition and experience the differences, which will be significant.

With the end of this era comes the beginning of a new one, and we’re excited to see what’s next in the ever-changing world of the Internet.

こんにちは No-IP

とりあえず、No-IPにします。

ルーターの対応考えなきゃいけないけど、更新くらいなら、API経由ですぐなんですね。

ドメインを持ってたら、DynamicDNSもいっぱい選択しあるし、DNSサーバ運営したたらよいですがね。そういうのが不便なんですよ。

#!/usr/bin/env ruby -Ku
#conding: utf-8
require 'mechanize'
require 'kconv'
$:.push "."
require'mechanize'
class NoIP
  class << self
    def update (user,pass,domain,new_ip)
      endpoint_url = "https://dynupdate.no-ip.com/nic/update?hostname=#{domain}&myip=#{new_ip}"
      m = Mechanize.new
      m.add_auth( endpoint_url, user,pass )
      m.get endpoint_url
      m.page.body
    end
  end
end

class GlobalIPAddrChecker
  def initialize(hostname,ns=nil)
    @hostname = hostname
    @ns = ns  || "8.8.8.8"
  end
  def current_global_ip_addr
    return @curr if @curr
    require 'mechanize'
    ua = Mechanize.new
    ua.get "http://www.ugtop.com/spill.shtml"
      @curr = ua.page.search('/html/body//table/tr[4]//p/font').text

  end
  def global_ip_is_changed?
    #puts current_a_record,  current_global_ip_addr
    return current_a_record != current_global_ip_addr
  end
  def current_a_record
    str =`dig  #{@hostname}  #{@ns} `
    ret = str.lines.grep(%r"^#{Regexp.escape(@hostname)}\.\s+\d+\s+IN\s+A").first
    return ret.split.last
  end
end


gip = GlobalIPAddrChecker.new("**DOMAIN**")
if gip.global_ip_is_changed? then
  puts NoIP.update("**USERNANME**","**PASSWOPRD","***DOMAIN**", gip.current_global_ip_addr)
end

puts "END"

ぱぱっと書いておいた。