Software /
code /
prosody
Comparison
net/dns.lua @ 1713:252afc358000
net.dns: Automatically add nameserver 127.0.0.1 if /etc/resolv.conf missing or empty on a non-Windows system (thanks Louis Mamakos)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 18 Aug 2009 13:47:21 +0100 |
parent | 1523:841d61be198f |
child | 1729:2876a0ecceab |
comparison
equal
deleted
inserted
replaced
1712:45a81d6d8777 | 1713:252afc358000 |
---|---|
507 if resolv_conf then | 507 if resolv_conf then |
508 for line in resolv_conf:lines() do | 508 for line in resolv_conf:lines() do |
509 local address = string.match (line, 'nameserver%s+(%d+%.%d+%.%d+%.%d+)') | 509 local address = string.match (line, 'nameserver%s+(%d+%.%d+%.%d+%.%d+)') |
510 if address then self:addnameserver (address) end | 510 if address then self:addnameserver (address) end |
511 end | 511 end |
512 else -- FIXME correct for windows, using opendns nameservers for now | 512 elseif os.getenv("WINDIR") then |
513 self:addnameserver ("208.67.222.222") | 513 self:addnameserver ("208.67.222.222") |
514 self:addnameserver ("208.67.220.220") | 514 self:addnameserver ("208.67.220.220") |
515 end | |
516 if not self.server or #self.server == 0 then | |
517 self:addnameserver("127.0.0.1"); | |
515 end | 518 end |
516 end | 519 end |
517 | 520 |
518 | 521 |
519 function resolver:getsocket (servernum) -- - - - - - - - - - - - - getsocket | 522 function resolver:getsocket (servernum) -- - - - - - - - - - - - - getsocket |