Files
rtsp-simple-server/internal/core/restrict_network.go
Alessandro Ros 34757620b8
Some checks failed
apidocs
code
mod-tidy
test32
test64
test_highlevel
do not listen on IPv6 when host is 0.0.0.0 (#1665) (#1678)
2023-04-10 22:48:33 +02:00

18 lines
309 B
Go

package core
import (
"net"
)
// do not listen on IPv6 when address is 0.0.0.0.
func restrictNetwork(network string, address string) (string, string) {
host, _, err := net.SplitHostPort(address)
if err == nil {
if host == "0.0.0.0" {
return network + "4", address
}
}
return network, address
}