github.com/pion/webrtc/v3@v3.2.24/dtlstransport_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  // DTLSTransport allows an application access to information about the DTLS
    12  // transport over which RTP and RTCP packets are sent and received by
    13  // RTPSender and RTPReceiver, as well other data such as SCTP packets sent
    14  // and received by data channels.
    15  type DTLSTransport struct {
    16  	// Pointer to the underlying JavaScript DTLSTransport object.
    17  	underlying js.Value
    18  }
    19  
    20  // ICETransport returns the currently-configured *ICETransport or nil
    21  // if one has not been configured
    22  func (r *DTLSTransport) ICETransport() *ICETransport {
    23  	underlying := r.underlying.Get("iceTransport")
    24  	if underlying.IsNull() || underlying.IsUndefined() {
    25  		return nil
    26  	}
    27  
    28  	return &ICETransport{
    29  		underlying: underlying,
    30  	}
    31  }