sctptransport_js.go 662 B

123456789101112131415161718192021222324252627
  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. // SCTPTransport provides details about the SCTP transport.
  8. type SCTPTransport struct {
  9. // Pointer to the underlying JavaScript SCTPTransport object.
  10. underlying js.Value
  11. }
  12. // Transport returns the DTLSTransport instance the SCTPTransport is sending over.
  13. func (r *SCTPTransport) Transport() *DTLSTransport {
  14. underlying := r.underlying.Get("transport")
  15. if underlying.IsNull() || underlying.IsUndefined() {
  16. return nil
  17. }
  18. return &DTLSTransport{
  19. underlying: underlying,
  20. }
  21. }