Module: RubyDNS

Defined in:
lib/rubydns.rb,
lib/rubydns/rule.rb,
lib/rubydns/server.rb,
lib/rubydns/version.rb

Overview

Released under the MIT License. Copyright, 2009-2025, by Samuel Williams.

Defined Under Namespace

Classes: Rule, Server

Constant Summary collapse

Resolver =

Backwards compatibility:

Async::DNS::Resolver
VERSION =
"2.1.1"

Class Method Summary collapse

Class Method Details

.run(*arguments, server_class: Server, **options, &block) ⇒ Object

Run a server with the given rules.


18
19
20
21
22
23
24
25
26
# File 'lib/rubydns.rb', line 18

def self.run(*arguments, server_class: Server, **options, &block)
	server = server_class.new(*arguments, **options)
	
	if block_given?
		server.instance_eval(&block)
	end
	
	return server.run
end

.run_server(*arguments, **options, &block) ⇒ Object

Deprecated.

Use run instead.


29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rubydns.rb', line 29

def self.run_server(*arguments, **options, &block)
	if arguments.first.is_a?(Array)
		warn "Using an array of interfaces is deprecated. Please use `Async::DNS::Endpoint` instead.", uplevel: 1
		
		endpoints = arguments[0].map do |specification|
			IO::Endpoint.public_send(*specification)
		end
		
		arguments[0] = IO::Endpoint.composite(*endpoints)
	end
	
	self.run(*arguments, **options, &block)
end