Skip to content

Commit

Permalink
microcloud/cmd: Detect if IPv6 is supported for mDNS in the setup
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Mougard <[email protected]>
  • Loading branch information
gabrielmougard committed Dec 6, 2023
1 parent df19969 commit 232acae
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion microcloud/cmd/microcloud/main_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ func lookupPeers(s *service.Handler, autoSetup bool, iface *net.Interface, subne
expectedSystemsMap[system] = true
}

ipv6Supported, err := mdns.CheckIPv6Status()
if err != nil {
return fmt.Errorf("Could not check IPv6 status: %v", err)
}

if !ipv6Supported {
fmt.Println("IPv6 is not supported on this system, disabling IPv6 mDNS")
}

fmt.Println("Scanning for eligible servers ...")
totalPeers := map[string]mdns.ServerInfo{}
done := false
Expand All @@ -214,7 +223,7 @@ func lookupPeers(s *service.Handler, autoSetup bool, iface *net.Interface, subne
break
}

peers, err := mdns.LookupPeers(context.Background(), iface, mdns.Version, s.Name)
peers, err := mdns.LookupPeers(context.Background(), iface, mdns.Version, s.Name, ipv6Supported)
if err != nil {
return err
}
Expand Down

0 comments on commit 232acae

Please sign in to comment.