Sha256: 138eb9846bf51cb35a3f5aa39e9c448e398b77843cf9aa2b4c1075504712354c

Contents?: true

Size: 572 Bytes

Versions: 2

Compression:

Stored size: 572 Bytes

Contents

#!/usr/bin/env ruby

require 'rubydns'
require 'rubydns/system'
 
INTERFACES = [
	[:udp, "0.0.0.0", 5300],
	[:tcp, "0.0.0.0", 5300]
]

Name = Resolv::DNS::Name
IN = Resolv::DNS::Resource::IN

UPSTREAM = RubyDNS::Resolver.new([[:udp, "8.8.8.8", 53], [:tcp, "8.8.8.8", 53]])
	
RubyDNS::run_server(:listen => INTERFACES) do
	# How to respond to something other than what was requested.
	match(//, IN::A) do |transaction|
		transaction.respond!(Name.create('foo.bar'), resource_class: IN::CNAME)
	end

	otherwise do |transaction|
		transaction.passthrough!(UPSTREAM)
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubydns-2.0.0.pre.rc2 examples/cname.rb
rubydns-2.0.0.pre.rc1 examples/cname.rb