Made the weave-local domain "weave" a constant

Plus some logging on startup
This commit is contained in:
Michael Bridgen committed 2014-10-07 12:46:59 +01:00
1 parent 2cab8415f2
commit e7ac6dafb3
1 file changed
+10 -2
+10 -2
View File
@@ -10,6 +10,10 @@ import (
"time"
)
const (
LOCAL_DOMAIN = "weave"
)
var zone = new(weavedns.ZoneDb)
func makeDNSReply(r *dns.Msg, name string, addr net.IP) *dns.Msg {
@@ -117,11 +121,11 @@ func main() {
}
LocalServeMux := dns.NewServeMux()
LocalServeMux.HandleFunc("local", handleLocal)
LocalServeMux.HandleFunc(LOCAL_DOMAIN, handleLocal)
go weavedns.ListenHttp(zone)
MDNSServeMux := dns.NewServeMux()
MDNSServeMux.HandleFunc("local", handleMDNS)
MDNSServeMux.HandleFunc(LOCAL_DOMAIN, handleMDNS)
conn, err := weavedns.LinkLocalMulticastListener(iface)
if err != nil {
@@ -130,6 +134,8 @@ func main() {
mdnsClient, err = weavedns.NewMDNSClient()
if err != nil {
log.Fatal(err)
} else {
log.Printf("Using mDNS on %s", ifaceName)
}
mdnsClient.Start()
@@ -139,5 +145,7 @@ func main() {
err = dns.ListenAndServe(address, "udp", LocalServeMux)
if err != nil {
log.Fatal(err)
} else {
log.Printf("Listening for DNS on %s", address)
}
}