github.com/pion/webrtc/v3@v3.2.24/icemux.go (about)

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  package webrtc
     5  
     6  import (
     7  	"net"
     8  
     9  	"github.com/pion/ice/v2"
    10  	"github.com/pion/logging"
    11  )
    12  
    13  // NewICETCPMux creates a new instance of ice.TCPMuxDefault. It enables use of
    14  // passive ICE TCP candidates.
    15  func NewICETCPMux(logger logging.LeveledLogger, listener net.Listener, readBufferSize int) ice.TCPMux {
    16  	return ice.NewTCPMuxDefault(ice.TCPMuxParams{
    17  		Listener:       listener,
    18  		Logger:         logger,
    19  		ReadBufferSize: readBufferSize,
    20  	})
    21  }
    22  
    23  // NewICEUDPMux creates a new instance of ice.UDPMuxDefault. It allows many PeerConnections to be served
    24  // by a single UDP Port.
    25  func NewICEUDPMux(logger logging.LeveledLogger, udpConn net.PacketConn) ice.UDPMux {
    26  	return ice.NewUDPMuxDefault(ice.UDPMuxParams{
    27  		UDPConn: udpConn,
    28  		Logger:  logger,
    29  	})
    30  }