mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-08-10 13:20:33 +02:00
cmd/ctrld: force 127.0.0.1:53 for listener.0 only
This commit is contained in:
@@ -88,7 +88,7 @@ func (p *prog) serveDNS(listenerNum string) error {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
s, errCh := runDNSServer(dnsListenAddress(listenerConfig), proto, handler)
|
s, errCh := runDNSServer(dnsListenAddress(listenerNum, listenerConfig), proto, handler)
|
||||||
defer s.Shutdown()
|
defer s.Shutdown()
|
||||||
if listenerConfig.Port == 0 {
|
if listenerConfig.Port == 0 {
|
||||||
switch s.Net {
|
switch s.Net {
|
||||||
@@ -397,8 +397,8 @@ func needLocalIPv6Listener() bool {
|
|||||||
return ctrldnet.SupportsIPv6ListenLocal() && runtime.GOOS == "windows"
|
return ctrldnet.SupportsIPv6ListenLocal() && runtime.GOOS == "windows"
|
||||||
}
|
}
|
||||||
|
|
||||||
func dnsListenAddress(lc *ctrld.ListenerConfig) string {
|
func dnsListenAddress(lcNum string, lc *ctrld.ListenerConfig) string {
|
||||||
if addr := router.ListenAddress(); addr != "" {
|
if addr := router.ListenAddress(); addr != "" && lcNum == "0" {
|
||||||
return addr
|
return addr
|
||||||
}
|
}
|
||||||
return net.JoinHostPort(lc.IP, strconv.Itoa(lc.Port))
|
return net.JoinHostPort(lc.IP, strconv.Itoa(lc.Port))
|
||||||
|
|||||||
Reference in New Issue
Block a user