icemux.go 854 B

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