dtlstransport_js.go 882 B

12345678910111213141516171819202122232425262728293031
  1. // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
  2. // SPDX-License-Identifier: MIT
  3. //go:build js && wasm
  4. // +build js,wasm
  5. package webrtc
  6. import "syscall/js"
  7. // DTLSTransport allows an application access to information about the DTLS
  8. // transport over which RTP and RTCP packets are sent and received by
  9. // RTPSender and RTPReceiver, as well other data such as SCTP packets sent
  10. // and received by data channels.
  11. type DTLSTransport struct {
  12. // Pointer to the underlying JavaScript DTLSTransport object.
  13. underlying js.Value
  14. }
  15. // ICETransport returns the currently-configured *ICETransport or nil
  16. // if one has not been configured
  17. func (r *DTLSTransport) ICETransport() *ICETransport {
  18. underlying := r.underlying.Get("iceTransport")
  19. if underlying.IsNull() || underlying.IsUndefined() {
  20. return nil
  21. }
  22. return &ICETransport{
  23. underlying: underlying,
  24. }
  25. }