Sha256: 00d27766c9a558cc79c78387f4f2022a5712a931be99e34a976e916d0222de89
Contents?: true
Size: 1.07 KB
Versions: 43
Compression:
Stored size: 1.07 KB
Contents
require 'middleman-core/dns_resolver/basic_network_resolver' module Middleman class DnsResolver # Use network name server to resolve ips and names class NetworkResolver < BasicNetworkResolver def initialize(opts={}) super @resolver = opts.fetch(:resolver, Resolv::DNS.new(nameserver_config)) self.timeouts = timeouts end private # Hosts + Ports for MDNS resolver # # This looks for MM_MDNSRC in your environment. If you are going to use # IPv6-addresses: Make sure you do not forget to add the port at the end. # # MM_MDNSRC=ip:port ip:port # # @return [Hash] # Returns the configuration for the nameserver # # @example # export MM_MDNSRC="224.0.0.251:5353 ff02::fb:5353" # def nameserver_config return unless ENV.key?('MM_DNSRC') && ENV['MM_DNSRC'] address, port = ENV['MM_DNSRC'].split(/:/) { nameserver_port: [[address, port.to_i]] } rescue StandardError {} end end end end
Version data entries
43 entries across 43 versions & 3 rubygems