mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 18:23:13 -04:00 
			
		
		
		
	Stop the caddy message and start our own init notifications. Log the version of CoreDNS when starting up. Fix all middleware's setup functions so that return the error prefixed with *which* middleware was failing; leads to better debuggable errors when starting up.
		
			
				
	
	
		
			25 lines
		
	
	
		
			489 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			489 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package bind
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 	"net"
 | |
| 
 | |
| 	"github.com/miekg/coredns/core/dnsserver"
 | |
| 	"github.com/miekg/coredns/middleware"
 | |
| 
 | |
| 	"github.com/mholt/caddy"
 | |
| )
 | |
| 
 | |
| func setupBind(c *caddy.Controller) error {
 | |
| 	config := dnsserver.GetConfig(c)
 | |
| 	for c.Next() {
 | |
| 		if !c.Args(&config.ListenHost) {
 | |
| 			return middleware.Error("bind", c.ArgErr())
 | |
| 		}
 | |
| 	}
 | |
| 	if net.ParseIP(config.ListenHost) == nil {
 | |
| 		return middleware.Error("bind", fmt.Errorf("not a valid IP address: %s", config.ListenHost))
 | |
| 	}
 | |
| 	return nil
 | |
| }
 |