Module: Win32::Resolv
| Relationships & Source Files | |
| Namespace Children | |
|
Exceptions:
| |
| Defined in: | ext/win32/resolv/resolv.c, ext/win32/lib/win32/resolv.rb |
Class Method Summary
- .get_hosts_path
- .get_resolv_info
- .get_hosts_dir private
- .get_info private
Class Method Details
.get_hosts_dir (private)
[ GitHub ]# File 'ext/win32/lib/win32/resolv.rb', line 50
def get_hosts_dir tcpip_params do |params| params.value('DataBasePath') end end
.get_hosts_path
[ GitHub ]# File 'ext/win32/lib/win32/resolv.rb', line 24
def self.get_hosts_path path = get_hosts_dir path = File.('hosts', path) File.exist?(path) ? path : nil end
.get_info (private)
[ GitHub ]# File 'ext/win32/lib/win32/resolv.rb', line 56
def get_info search = nil nameserver = get_dns_server_list tcpip_params do |params| slist = params.value('SearchList') search = slist.split(/,\s*/) if slist and !slist.empty? if add_search = search.nil? search = [] domain = params.value('Domain') if domain and !domain.empty? search = [ domain ] udmnd = params.value('UseDomainNameDevolution') if udmnd&.nonzero? if /^\w+\./ =~ domain devo = $' end end end end params.open('Interfaces') do |reg| reg.each_key do |iface| next unless ns = %w[NameServer DhcpNameServer].find do |key| ns = iface.value(key) break ns.split(/[,\s]\s*/) if ns and !ns.empty? end next if (nameserver & ns).empty? if add_search [ 'Domain', 'DhcpDomain' ].each do |key| dom = iface.value(key) if dom and !dom.empty? search.concat(dom.split(/,\s*/)) break end end end end end search << devo if add_search and devo end [ search.uniq, nameserver.uniq ] end
.get_resolv_info
[ GitHub ]# File 'ext/win32/lib/win32/resolv.rb', line 30
def self.get_resolv_info search, nameserver = get_info if search.empty? search = nil else search.delete("") search.uniq! end if nameserver.empty? nameserver = nil else nameserver.delete("") nameserver.delete("0.0.0.0") nameserver.uniq! end [ search, nameserver ] end