mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 15:15:28 +00:00
Added bindAddress configuration setting
This commit is contained in:
@ -74,6 +74,7 @@ struct RTC_CPP_EXPORT Configuration {
|
|||||||
// ICE settings
|
// ICE settings
|
||||||
std::vector<IceServer> iceServers;
|
std::vector<IceServer> iceServers;
|
||||||
optional<ProxyServer> proxyServer; // libnice only
|
optional<ProxyServer> proxyServer; // libnice only
|
||||||
|
optional<string> bindAddress; // libjuice only, default any
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
CertificateType certificateType = CertificateType::Default;
|
CertificateType certificateType = CertificateType::Default;
|
||||||
|
@ -150,13 +150,14 @@ RTC_EXPORT void *rtcGetUserPointer(int i);
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
const char **iceServers;
|
const char **iceServers;
|
||||||
int iceServersCount;
|
int iceServersCount;
|
||||||
|
const char *bindAddress; // libjuice only, NULL means any
|
||||||
rtcCertificateType certificateType;
|
rtcCertificateType certificateType;
|
||||||
bool enableIceTcp;
|
bool enableIceTcp;
|
||||||
bool disableAutoNegotiation;
|
bool disableAutoNegotiation;
|
||||||
uint16_t portRangeBegin;
|
uint16_t portRangeBegin; // 0 means automatic
|
||||||
uint16_t portRangeEnd;
|
uint16_t portRangeEnd; // 0 means automatic
|
||||||
int mtu; // <= 0 means automatic
|
int mtu; // <= 0 means automatic
|
||||||
int maxMessageSize; // <= 0 means default
|
int maxMessageSize; // <= 0 means default
|
||||||
} rtcConfiguration;
|
} rtcConfiguration;
|
||||||
|
|
||||||
RTC_EXPORT int rtcCreatePeerConnection(const rtcConfiguration *config); // returns pc id
|
RTC_EXPORT int rtcCreatePeerConnection(const rtcConfiguration *config); // returns pc id
|
||||||
|
@ -290,15 +290,18 @@ int rtcCreatePeerConnection(const rtcConfiguration *config) {
|
|||||||
for (int i = 0; i < config->iceServersCount; ++i)
|
for (int i = 0; i < config->iceServersCount; ++i)
|
||||||
c.iceServers.emplace_back(string(config->iceServers[i]));
|
c.iceServers.emplace_back(string(config->iceServers[i]));
|
||||||
|
|
||||||
c.certificateType = static_cast<CertificateType>(config->certificateType);
|
if (config->bindAddress)
|
||||||
c.enableIceTcp = config->enableIceTcp;
|
c.bindAddress = string(config->bindAddress);
|
||||||
c.disableAutoNegotiation = config->disableAutoNegotiation;
|
|
||||||
|
|
||||||
if (config->portRangeBegin > 0 || config->portRangeEnd > 0) {
|
if (config->portRangeBegin > 0 || config->portRangeEnd > 0) {
|
||||||
c.portRangeBegin = config->portRangeBegin;
|
c.portRangeBegin = config->portRangeBegin;
|
||||||
c.portRangeEnd = config->portRangeEnd;
|
c.portRangeEnd = config->portRangeEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.certificateType = static_cast<CertificateType>(config->certificateType);
|
||||||
|
c.enableIceTcp = config->enableIceTcp;
|
||||||
|
c.disableAutoNegotiation = config->disableAutoNegotiation;
|
||||||
|
|
||||||
if (config->mtu > 0)
|
if (config->mtu > 0)
|
||||||
c.mtu = size_t(config->mtu);
|
c.mtu = size_t(config->mtu);
|
||||||
|
|
||||||
|
@ -131,6 +131,11 @@ IceTransport::IceTransport(const Configuration &config, candidate_callback candi
|
|||||||
jconfig.turn_servers = k > 0 ? turn_servers : nullptr;
|
jconfig.turn_servers = k > 0 ? turn_servers : nullptr;
|
||||||
jconfig.turn_servers_count = k;
|
jconfig.turn_servers_count = k;
|
||||||
|
|
||||||
|
// Bind address
|
||||||
|
if (config.bindAddress) {
|
||||||
|
jconfig.bind_address = config.bindAddress->c_str();
|
||||||
|
}
|
||||||
|
|
||||||
// Port range
|
// Port range
|
||||||
if (config.portRangeBegin > 1024 ||
|
if (config.portRangeBegin > 1024 ||
|
||||||
(config.portRangeEnd != 0 && config.portRangeEnd != 65535)) {
|
(config.portRangeEnd != 0 && config.portRangeEnd != 65535)) {
|
||||||
|
Reference in New Issue
Block a user