Home | History | Annotate | Download | only in net

Lines Matching refs:conf

220 	// time to recheck resolv.conf.
222 lastChecked time.Time // last time resolv.conf was checked
223 modTime time.Time // time of resolv.conf modification
226 dnsConfig *dnsConfig // parsed resolv.conf structure used in lookups
231 // init initializes conf and is only called via conf.initOnce.
232 func (conf *resolverConfig) init() {
234 // resolv.conf twice the first time.
235 conf.dnsConfig = systemConf().resolv
236 if conf.dnsConfig == nil {
237 conf.dnsConfig = dnsReadConfig("/etc/resolv.conf")
240 if fi, err := os.Stat("/etc/resolv.conf"); err == nil {
241 conf.modTime = fi.ModTime()
243 conf.lastChecked = time.Now()
247 conf.ch = make(chan struct{}, 1)
250 // tryUpdate tries to update conf with the named resolv.conf file.
252 // "/etc/resolv.conf".
253 func (conf *resolverConfig) tryUpdate(name string) {
254 conf.initOnce.Do(conf.init)
256 // Ensure only one update at a time checks resolv.conf.
257 if !conf.tryAcquireSema() {
260 defer conf.releaseSema()
263 if conf.lastChecked.After(now.Add(-5 * time.Second)) {
266 conf.lastChecked = now
269 if fi.ModTime().Equal(conf.modTime) {
272 conf.modTime = fi.ModTime()
275 if conf.modTime.IsZero() {
278 conf.modTime = time.Time{}
282 conf.mu.Lock()
283 conf.dnsConfig = dnsConf
284 conf.mu.Unlock()
287 func (conf *resolverConfig) tryAcquireSema() bool {
289 case conf.ch <- struct{}{}:
296 func (conf *resolverConfig) releaseSema() {
297 <-conf.ch
304 resolvConf.tryUpdate("/etc/resolv.conf")
306 conf := resolvConf.dnsConfig
308 for _, fqdn := range conf.nameList(name) {
309 cname, rrs, err = tryOneName(conf, fqdn, qtype)
324 func (conf *dnsConfig) nameList(name string) []string {
331 names := make([]string, 0, 1+len(conf.search))
333 if count(name, '.') >= conf.ndots {
337 for _, suffix := range conf.search {
345 if count(name, '.') < conf.ndots {
352 // It is basically a simplified representation of nsswitch.conf.
438 resolvConf.tryUpdate("/etc/resolv.conf")
440 conf := resolvConf.dnsConfig
449 for _, fqdn := range conf.nameList(name) {
452 _, rrs, err := tryOneName(conf, fqdn, qtype)