From 99a8bb12aef33c83535d220b42ecab3f43006ffa Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 5 Jun 2024 13:26:45 +0100 Subject: [PATCH] Allow overriding ICE ufrag and pwd fields Adds two new optional config keys - `iceUfrag` and `icePwd` which are passed to libjuice. Depends on: https://github.com/paullouisageneau/libjuice/pull/249 Refs: https://github.com/paullouisageneau/libdatachannel/issues/1166 --- .vscode/settings.json | 5 +++++ include/rtc/configuration.hpp | 4 ++++ src/impl/icetransport.cpp | 8 ++++++++ 3 files changed, 17 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..01d7773d2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "optional": "cpp" + } +} \ No newline at end of file diff --git a/include/rtc/configuration.hpp b/include/rtc/configuration.hpp index 4ec95a0bf..9212e13fc 100644 --- a/include/rtc/configuration.hpp +++ b/include/rtc/configuration.hpp @@ -93,6 +93,10 @@ struct RTC_CPP_EXPORT Configuration { optional certificatePemFile; optional keyPemFile; optional keyPemPass; + + // Overriding ICE ufrag/pwd + optional iceUfrag; + optional icePwd; }; #ifdef RTC_ENABLE_WEBSOCKET diff --git a/src/impl/icetransport.cpp b/src/impl/icetransport.cpp index a27a2ed32..a636c42f4 100644 --- a/src/impl/icetransport.cpp +++ b/src/impl/icetransport.cpp @@ -90,6 +90,14 @@ IceTransport::IceTransport(const Configuration &config, candidate_callback candi jconfig.cb_recv = IceTransport::RecvCallback; jconfig.user_ptr = this; + if (config.iceUfrag) { + jconfig.ice_ufrag = config.iceUfrag->c_str(); + } + + if (config.icePwd) { + jconfig.ice_pwd = config.icePwd->c_str(); + } + if (config.enableIceTcp) { PLOG_WARNING << "ICE-TCP is not supported with libjuice"; }