Skip to content

Commit 7e023bc

Browse files
committed
documentation
1 parent 38eb847 commit 7e023bc

File tree

3 files changed

+61
-26
lines changed

3 files changed

+61
-26
lines changed

webrtc/src/ice_transport/ice_server.rs

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,35 @@ use serde::{Deserialize, Serialize};
33
use crate::error::{Error, Result};
44
use crate::ice_transport::ice_credential_type::RTCIceCredentialType;
55

6-
/// ICEServer describes a single STUN and TURN server that can be used by
7-
/// the ICEAgent to establish a connection with a peer.
6+
/// Describes a single STUN or TURN server that can be used by
7+
/// the ICE Agent to establish a connection with a peer.
88
#[derive(Default, Debug, Clone, Serialize, Deserialize, Hash)]
99
pub struct RTCIceServer {
10+
/// A sequence of [STUN](https://www.rfc-editor.org/rfc/rfc5389)
11+
/// or [TURN](https://www.rfc-editor.org/rfc/rfc5928) URIs to be used by
12+
/// the ICE Agent to establish a connection with a peer.
13+
///
14+
/// STUN URIs (defined in [RFC7064](https://www.rfc-editor.org/rfc/rfc7064))
15+
/// allow for the discovery of server-reflexive candidates.
16+
///
17+
/// TURN URIs (defined in [RFC7065](https://www.rfc-editor.org/rfc/rfc7065))
18+
/// allow for the discovery of relayed candidates.
1019
pub urls: Vec<String>,
20+
21+
/// If this [`RTCIceServer`] object represents a TURN server, then this attribute
22+
/// specifies the username to use during the authentication process with the
23+
/// TURN server.
1124
pub username: String,
25+
26+
/// If this [`RTCIceServer`] object represents a TURN server, then this attribute
27+
/// specifies the credential to use during the authentication process with the
28+
/// TURN server. It represents a long-term authentication password, as described
29+
/// in [RFC5389](https://www.rfc-editor.org/rfc/rfc5389).
1230
pub credential: String,
31+
32+
/// **NOT IN SPEC:** If this [`RTCIceServer`] object represents a TURN server,
33+
/// then this attribute indicates the type of credential to use to connect
34+
/// to the TURN server.
1335
pub credential_type: RTCIceCredentialType,
1436
}
1537

webrtc/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
//!
4040
//! ### RTCConfiguration
4141
//!
42-
//! The `RTCConfiguration` struct defines the set of parameters that are used to configure
43-
//! how peer-to-peer communication via `RTCPeerConnection` is established or re-established.
42+
//! The [`RTCConfiguration`] struct defines the set of parameters that are used to configure
43+
//! how peer-to-peer communication via [`RTCPeerConnection`] is established or re-established.
4444
//! This includes the set of ICE servers to use, the ICE transport policy, the bundle policy,
4545
//! the RTCP mux policy, the peer identity, and the set of certificates to use.
4646
//!
@@ -49,7 +49,7 @@
4949
//!
5050
//! ### RTCPeerConnection
5151
//!
52-
//! The `RTCPeerConnection` is the primary entry point to the WebRTC API. It represents an
52+
//! The [`RTCPeerConnection`] is the primary entry point to the WebRTC API. It represents an
5353
//! individual connection between a local device and a remote peer.
5454
//!
5555
//! ### MediaStream
@@ -73,6 +73,9 @@
7373
//! This project is licensed under either of the following, at your option:
7474
//! - [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
7575
//! - [MIT License](https://opensource.org/license/mit/)
76+
//!
77+
//! [`RTCConfiguration`]: peer_connection::configuration::RTCConfiguration
78+
//! [`RTCPeerConnection`]: peer_connection::RTCPeerConnection
7679
7780
// re-export sub-crates
7881
pub use {data, dtls, ice, interceptor, mdns, media, rtcp, rtp, sctp, sdp, srtp, stun, turn, util};

webrtc/src/peer_connection/configuration.rs

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,58 @@ use crate::peer_connection::policy::bundle_policy::RTCBundlePolicy;
44
use crate::peer_connection::policy::ice_transport_policy::RTCIceTransportPolicy;
55
use crate::peer_connection::policy::rtcp_mux_policy::RTCRtcpMuxPolicy;
66

7-
/// A Configuration defines how peer-to-peer communication via PeerConnection
8-
/// is established or re-established.
9-
/// Configurations may be set up once and reused across multiple connections.
10-
/// Configurations are treated as readonly. As long as they are unmodified,
11-
/// they are safe for concurrent use.
7+
/// Defines a set of parameters to configure how the peer-to-peer communication via
8+
/// [`RTCPeerConnection`] is established or re-established. These may be set up once
9+
/// and reused across multiple connections, and are treated as readonly. As long as
10+
/// they are unmodified, they are safe for concurrent use.
11+
///
12+
/// [`RTCPeerConnection`]: crate::peer_connection::RTCPeerConnection
1213
#[derive(Default, Clone)]
1314
pub struct RTCConfiguration {
14-
/// iceservers defines a slice describing servers available to be used by
15+
/// Defines a slice describing servers available to be used by
1516
/// ICE, such as STUN and TURN servers.
1617
pub ice_servers: Vec<RTCIceServer>,
1718

18-
/// icetransport_policy indicates which candidates the ICEAgent is allowed
19+
/// Indicates which candidates the ICE Agent is allowed
1920
/// to use.
2021
pub ice_transport_policy: RTCIceTransportPolicy,
2122

22-
/// bundle_policy indicates which media-bundling policy to use when gathering
23+
/// Indicates which media-bundling policy to use when gathering
2324
/// ICE candidates.
2425
pub bundle_policy: RTCBundlePolicy,
2526

26-
/// rtcp_mux_policy indicates which rtcp-mux policy to use when gathering ICE
27+
/// Indicates which rtcp-mux policy to use when gathering ICE
2728
/// candidates.
2829
pub rtcp_mux_policy: RTCRtcpMuxPolicy,
2930

30-
/// peer_identity sets the target peer identity for the PeerConnection.
31+
/// **UNIMPLEMENTED:** Sets the target peer identity for the [`RTCPeerConnection`].
3132
/// The PeerConnection will not establish a connection to a remote peer
3233
/// unless it can be successfully authenticated with the provided name.
34+
///
35+
/// [`RTCPeerConnection`]: crate::peer_connection::RTCPeerConnection
3336
pub peer_identity: String,
3437

35-
/// Certificates describes a set of certificates that the PeerConnection
36-
/// uses to authenticate. Valid values for this parameter are created
37-
/// through calls to the generate_certificate function. Although any given
38-
/// DTLS connection will use only one certificate, this attribute allows the
39-
/// caller to provide multiple certificates that support different
40-
/// algorithms. The final certificate will be selected based on the DTLS
41-
/// handshake, which establishes which certificates are allowed. The
42-
/// PeerConnection implementation selects which of the certificates is
38+
/// A set of certificates that the [`RTCPeerConnection`] uses to authenticate.
39+
///
40+
/// Valid values for this parameter are created through calls to the
41+
/// generate_certificate function.
42+
///
43+
/// Although any given DTLS connection will use only one certificate, this
44+
/// attribute allows the caller to provide multiple certificates that support
45+
/// different algorithms. The final certificate will be selected based on the
46+
/// DTLS handshake, which establishes which certificates are allowed. The
47+
/// [`RTCPeerConnection`] implementation selects which of the certificates is
4348
/// used for a given connection; how certificates are selected is outside
44-
/// the scope of this specification. If this value is absent, then a default
45-
/// set of certificates is generated for each PeerConnection instance.
49+
/// the scope of this specification.
50+
///
51+
/// If this value is absent, then a default set of certificates is generated
52+
/// for each [`RTCPeerConnection`] instance.
53+
///
54+
/// [`RTCPeerConnection`]: crate::peer_connection::RTCPeerConnection
4655
pub certificates: Vec<RTCCertificate>,
4756

48-
/// icecandidate_pool_size describes the size of the prefetched ICE pool.
57+
/// **UNIMPLEMENTED:** The size of the prefetched ICE pool, as defined in
58+
/// [RFC8829](https://www.rfc-editor.org/rfc/rfc8829).
4959
pub ice_candidate_pool_size: u8,
5060
}
5161

0 commit comments

Comments
 (0)