mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
cmd/ctrld: check for ipv6 listen local
Since when the machine may not have external ipv6 capability, but still can do ipv6 network on local network.
This commit is contained in:
committed by
Cuong Manh Le
parent
8b08cc8a6e
commit
262dcb1dff
@@ -57,14 +57,16 @@ func (p *prog) serveUDP(listenerNum string) error {
|
||||
|
||||
// On Windows, there's no easy way for disabling/removing IPv6 DNS resolver, so we check whether we can
|
||||
// listen on ::1, then spawn a listener for receiving DNS requests.
|
||||
if runtime.GOOS == "windows" && ctrldnet.SupportsIPv6() {
|
||||
if runtime.GOOS == "windows" && ctrldnet.SupportsIPv6ListenLocal() {
|
||||
go func() {
|
||||
s := &dns.Server{
|
||||
Addr: net.JoinHostPort("::1", strconv.Itoa(listenerConfig.Port)),
|
||||
Net: "udp",
|
||||
Handler: handler,
|
||||
}
|
||||
_ = s.ListenAndServe()
|
||||
if err := s.ListenAndServe(); err != nil {
|
||||
mainLog.Error().Err(err).Msg("could not serving on ::1")
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user