do not listen on IPv6 when host is 0.0.0.0 (#240)

(https://github.com/aler9/mediamtx/issues/1665)
This commit is contained in:
Alessandro Ros
2023-04-10 22:42:19 +02:00
committed by GitHub
parent 9ca5e130fe
commit c56eee37f8
7 changed files with 34 additions and 16 deletions

View File

@@ -60,7 +60,7 @@ func newServerUDPListenerMulticastPair(
listenPacket,
writeTimeout,
true,
ip.String()+":"+strconv.FormatInt(int64(multicastRTPPort), 10),
net.JoinHostPort(ip.String(), strconv.FormatInt(int64(multicastRTPPort), 10)),
true,
)
if err != nil {
@@ -71,7 +71,7 @@ func newServerUDPListenerMulticastPair(
listenPacket,
writeTimeout,
true,
ip.String()+":"+strconv.FormatInt(int64(multicastRTCPPort), 10),
net.JoinHostPort(ip.String(), strconv.FormatInt(int64(multicastRTCPPort), 10)),
false,
)
if err != nil {
@@ -97,7 +97,7 @@ func newServerUDPListener(
return nil, err
}
tmp, err := listenPacket("udp", "224.0.0.0:"+port)
tmp, err := listenPacket(restrictNetwork("udp", "224.0.0.0:"+port))
if err != nil {
return nil, err
}
@@ -127,7 +127,7 @@ func newServerUDPListener(
pc = tmp.(*net.UDPConn)
} else {
tmp, err := listenPacket("udp", address)
tmp, err := listenPacket(restrictNetwork("udp", address))
if err != nil {
return nil, err
}