Sha256: e55cc1d8506223f719f6ce10033d2b890b36e06337071980aa548517b8a71d86

Contents?: true

Size: 510 Bytes

Versions: 3

Compression:

Stored size: 510 Bytes

Contents

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

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

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(%r{test.local}, 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/basic-dns.rb
rubydns-2.0.1 examples/basic-dns.rb
rubydns-2.0.0 examples/basic-dns.rb