2011-05-01から1日間の記事一覧

単純なDNSのプロキシを書いてみた

クエリの最大長っていくつだろう? require 'socket' HOST = '8.8.8.8' # Google DNS Server sock = UDPSocket.open sock.bind('', 53) def proxy(msg) s = UDPSocket.open s.send(msg, 0, HOST, 53) msg = s.recvfrom(1024)[0] s.close return msg end loop…