Remove all listeners from IPv6 interface

This commit is contained in:
Alexey Khit
2023-07-17 12:53:34 +03:00
parent 14ed1cdee8
commit e4b68518e5
5 changed files with 8 additions and 8 deletions

View File

@@ -50,13 +50,13 @@ func NewAPI(address string) (*webrtc.API, error) {
if address != "" {
address, network, _ := strings.Cut(address, "/")
if network == "" || network == "udp" {
if ln, err := net.ListenPacket("udp", address); err == nil {
if ln, err := net.ListenPacket("udp4", address); err == nil {
udpMux := webrtc.NewICEUDPMux(nil, ln)
s.SetICEUDPMux(udpMux)
}
}
if network == "" || network == "tcp" {
if ln, err := net.Listen("tcp", address); err == nil {
if ln, err := net.Listen("tcp4", address); err == nil {
tcpMux := webrtc.NewICETCPMux(nil, ln, 8)
s.SetICETCPMux(tcpMux)
}