Skip to content

Commit

Permalink
WIP: Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc committed Oct 19, 2023
1 parent 51a6c62 commit 93bef3d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
6 changes: 1 addition & 5 deletions node/src/WebRtcTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,21 @@ export type WebRtcTransportOptionsBase<WebRtcTransportAppData> =
{
/**
* Listen in UDP. Default true.
* @deprecated
*/
enableUdp?: boolean;

/**
* Listen in TCP. Default false.
* @deprecated
* Listen in TCP. Default true if webrtcServer is given, false otherwise.
*/
enableTcp?: boolean;

/**
* Prefer UDP. Default false.
* @deprecated
*/
preferUdp?: boolean;

/**
* Prefer TCP. Default false.
* @deprecated
*/
preferTcp?: boolean;

Expand Down
22 changes: 21 additions & 1 deletion rust/src/router/webrtc_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ pub struct WebRtcTransportOptions {
/// Initial available outgoing bitrate (in bps).
/// Default 600000.
pub initial_available_outgoing_bitrate: u32,
/// Enable UDP.
/// Default true.
pub enable_udp: bool,
/// Enable TCP.
/// Default true if webrtc_server is given, false otherwise.
pub enable_tcp: bool,
/// Prefer UDP.
/// Default false.
pub prefer_udp: bool,
/// Prefer TCP.
/// Default false.
pub prefer_tcp: bool,
/// Create a SCTP association.
/// Default false.
pub enable_sctp: bool,
Expand All @@ -133,12 +145,16 @@ pub struct WebRtcTransportOptions {
}

impl WebRtcTransportOptions {
/// Create [`WebRtcTransport`] options with given listen IPs.
/// Create [`WebRtcTransport`] options with given listen infos.
#[must_use]
pub fn new(listen_infos: WebRtcTransportListenInfos) -> Self {
Self {
listen: WebRtcTransportListen::Individual { listen_infos },
initial_available_outgoing_bitrate: 600_000,
enable_udp: true,
enable_tcp: false,
prefer_udp: false,
prefer_tcp: false,
enable_sctp: false,
num_sctp_streams: NumSctpStreams::default(),
max_sctp_message_size: 262_144,
Expand All @@ -152,6 +168,10 @@ impl WebRtcTransportOptions {
Self {
listen: WebRtcTransportListen::Server { webrtc_server },
initial_available_outgoing_bitrate: 600_000,
enable_udp: true,
enable_tcp: true,
prefer_udp: false,
prefer_tcp: false,
enable_sctp: false,
num_sctp_streams: NumSctpStreams::default(),
max_sctp_message_size: 262_144,
Expand Down

0 comments on commit 93bef3d

Please sign in to comment.