Home | History | Annotate | Download | only in net

Lines Matching refs:conf

247 	// time to recheck resolv.conf.
249 lastChecked time.Time // last time resolv.conf was checked
252 dnsConfig *dnsConfig // parsed resolv.conf structure used in lookups
257 // init initializes conf and is only called via conf.initOnce.
258 func (conf *resolverConfig) init() {
260 // resolv.conf twice the first time.
261 conf.dnsConfig = systemConf().resolv
262 if conf.dnsConfig == nil {
263 conf.dnsConfig = dnsReadConfig("/etc/resolv.conf")
265 conf.lastChecked = time.Now()
269 conf.ch = make(chan struct{}, 1)
272 // tryUpdate tries to update conf with the named resolv.conf file.
274 // "/etc/resolv.conf".
275 func (conf *resolverConfig) tryUpdate(name string) {
276 conf.initOnce.Do(conf.init)
278 // Ensure only one update at a time checks resolv.conf.
279 if !conf.tryAcquireSema() {
282 defer conf.releaseSema()
285 if conf.lastChecked.After(now.Add(-5 * time.Second)) {
288 conf.lastChecked = now
294 if mtime.Equal(conf.dnsConfig.mtime) {
299 conf.mu.Lock()
300 conf.dnsConfig = dnsConf
301 conf.mu.Unlock()
304 func (conf *resolverConfig) tryAcquireSema() bool {
306 case conf.ch <- struct{}{}:
313 func (conf *resolverConfig) releaseSema() {
314 <-conf.ch
326 resolvConf.tryUpdate("/etc/resolv.conf")
328 conf := resolvConf.dnsConfig
330 for _, fqdn := range conf.nameList(name) {
331 cname, rrs, err = tryOneName(ctx, conf, fqdn, qtype)
360 func (conf *dnsConfig) nameList(name string) []string {
377 hasNdots := count(name, '.') >= conf.ndots
382 names := make([]string, 0, 1+len(conf.search))
388 for _, suffix := range conf.search {
401 // It is basically a simplified representation of nsswitch.conf.
490 resolvConf.tryUpdate("/etc/resolv.conf")
492 conf := resolvConf.dnsConfig
502 for _, fqdn := range conf.nameList(name) {
505 cname, rrs, err := tryOneName(ctx, conf, fqdn, qtype)