golanggohlsrtmpwebrtcmedia-serverobs-studiortcprtmp-proxyrtmp-serverrtprtsprtsp-proxyrtsp-relayrtsp-serversrtstreamingwebrtc-proxy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
373 B
18 lines
373 B
// Package restrictnetwork contains Restrict(). |
|
package restrictnetwork |
|
|
|
import ( |
|
"net" |
|
) |
|
|
|
// Restrict avoids listening on IPv6 when address is 0.0.0.0. |
|
func Restrict(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 |
|
}
|
|
|