dtlstransport_js.go 780 B

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