Resolv::MDNS is a one-shot Multicast DNS (mDNS) resolver. It blindly makes queries to the mDNS addresses without understanding anything about multicast ports.

Information taken form the following places:

  • RFC 6762

Methods
E
N
Constants
Port = 5353
 

Default mDNS Port

AddressV4 = '224.0.0.251'
 

Default IPv4 mDNS address

AddressV6 = 'ff02::fb'
 

Default IPv6 mDNS address

Addresses = [ [AddressV4, Port], [AddressV6, Port], ]
 

Default mDNS addresses

Class Public methods
new(config_info=nil)

Creates a new one-shot Multicast DNS (mDNS) resolver.

config_info can be:

nil

Uses the default mDNS addresses

Hash

Must contain :nameserver or :nameserver_port like Resolv::DNS#initialize.

# File lib/resolv.rb, line 2582
def initialize(config_info=nil)
  if config_info then
    super({ nameserver_port: Addresses }.merge(config_info))
  else
    super(nameserver_port: Addresses)
  end
end
Instance Public methods
each_address(name)

Iterates over all IP addresses for name retrieved from the mDNS resolver, provided name ends with “local”. If the name does not end in “local” no records will be returned.

name can be a Resolv::DNS::Name or a String. Retrieved addresses will be a Resolv::IPv4 or Resolv::IPv6

# File lib/resolv.rb, line 2598
def each_address(name)
  name = Resolv::DNS::Name.create(name)

  return unless name.to_a.last == 'local'

  super(name)
end