Sha256: 00c94639b7cebe16b277a74a6a4feda9d69875120ae5e06521876bb2e8767f71

Contents?: true

Size: 542 Bytes

Versions: 3

Compression:

Stored size: 542 Bytes

Contents

#!/usr/bin/env ruby
require 'rubydns'

INTERFACES = [
	[:udp, '0.0.0.0', 5300],
	[:tcp, '0.0.0.0', 5300]
]

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

# Use upstream DNS for name resolution.
UPSTREAM = RubyDNS::Resolver.new([[:udp, '8.8.8.8', 53], [:tcp, '8.8.8.8', 53]])

# Start the RubyDNS server
RubyDNS.run_server(INTERFACES) do
	match(/test.mydomain.org/, IN::A) do |transaction|
			transaction.respond!('10.0.0.80')
	end

	# Default DNS handler
	otherwise do |transaction|
			transaction.passthrough!(UPSTREAM)
	 end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubydns-2.0.2 examples/simple.rb
rubydns-2.0.1 examples/simple.rb
rubydns-2.0.0 examples/simple.rb