github.com/pion/webrtc/v4@v4.0.1/sctptransport_js.go (about)

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  //go:build js && wasm
     5  // +build js,wasm
     6  
     7  package webrtc
     8  
     9  import "syscall/js"
    10  
    11  // SCTPTransport provides details about the SCTP transport.
    12  type SCTPTransport struct {
    13  	// Pointer to the underlying JavaScript SCTPTransport object.
    14  	underlying js.Value
    15  }
    16  
    17  // Transport returns the DTLSTransport instance the SCTPTransport is sending over.
    18  func (r *SCTPTransport) Transport() *DTLSTransport {
    19  	underlying := r.underlying.Get("transport")
    20  	if underlying.IsNull() || underlying.IsUndefined() {
    21  		return nil
    22  	}
    23  
    24  	return &DTLSTransport{
    25  		underlying: underlying,
    26  	}
    27  }