提交 f8b61863 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

0.7.0: Breaking change: rename rtcListenIPv4/6 with rtpIPv4/6

上级 99bc2578
......@@ -14,10 +14,10 @@ const VALID_WORKER_PARAMETERS =
[
'logLevel',
'logTags',
'rtcListenIPv4',
'rtcListenIPv6',
'rtcAnnouncedListenIPv4',
'rtcAnnouncedListenIPv6',
'rtcIPv4',
'rtcIPv6',
'rtcAnnouncedIPv4',
'rtcAnnouncedIPv6',
'rtcMinPort',
'rtcMaxPort',
'dtlsCertificateFile',
......@@ -58,17 +58,17 @@ class Server extends EventEmitter
if (!check.array(options.logTags))
options.logTags = [];
if (options.rtcListenIPv4 === null || options.rtcListenIPv4 === undefined)
delete options.rtcListenIPv4;
if (options.rtcIPv4 === null || options.rtcIPv4 === undefined)
delete options.rtcIPv4;
if (options.rtcListenIPv6 === null || options.rtcListenIPv6 === undefined)
delete options.rtcListenIPv6;
if (options.rtcIPv6 === null || options.rtcIPv6 === undefined)
delete options.rtcIPv6;
if (!options.rtcAnnouncedListenIPv4 || options.rtcListenIPv4 === false)
delete options.rtcAnnouncedListenIPv4;
if (!options.rtcAnnouncedIPv4 || options.rtcIPv4 === false)
delete options.rtcAnnouncedIPv4;
if (!options.rtcAnnouncedListenIPv6 || options.rtcListenIPv6 === false)
delete options.rtcAnnouncedListenIPv6;
if (!options.rtcAnnouncedIPv6 || options.rtcIPv6 === false)
delete options.rtcAnnouncedIPv6;
if (!check.greaterOrEqual(options.rtcMinPort, 1024))
options.rtcMinPort = 10000;
......
......@@ -22,13 +22,13 @@ module.exports =
* @param {string} [options.logLevel='debug'] - Log level. Valid values are
* 'debug', 'warn', 'error'.
* @param {array} [options.logTags] - Log tags.
* @param {string|boolean} [options.rtcListenIPv4=true] - IPv4 for RTC. Valid
* @param {string|boolean} [options.rtcIPv4=true] - IPv4 for RTC. Valid
* values are a IPv4, `true` (auto-detect) and `false` (disabled).
* @param {string|boolean} [options.rtcListenIPv6=true] - IPv6 for RTC. Valid
* @param {string|boolean} [options.rtcIPv6=true] - IPv6 for RTC. Valid
* values are a IPv6, `true` (auto-detect) and `false` (disabled).
* @param {string} [options.rtcAnnouncedListenIPv4] - Announced IPv4 for RTC. Valid
* @param {string} [options.rtcAnnouncedIPv4] - Announced IPv4 for RTC. Valid
* value is a IPv4.
* @param {string} [options.rtcAnnouncedListenIPv6] - Announced IPv6 for RTC. Valid
* @param {string} [options.rtcAnnouncedIPv6] - Announced IPv6 for RTC. Valid
* value is a IPv6.
* @param {number} [options.rtcMinPort=10000] - Minimun RTC port.
* @param {number} [options.rtcMaxPort=59999] - Maximum RTC port.
......
{
"name": "mediasoup",
"version": "0.6.0",
"version": "0.7.0",
"description": "Powerful WebRTC SFU for Node.js",
"main": "lib/mediasoup.js",
"repository": {
......
......@@ -63,9 +63,9 @@ tap.test('mediasoup.Server() with wrong options must fail', { timeout: 2000 }, (
});
});
tap.test('mediasoup.Server() with non existing rtcListenIPv4 IP must fail', { timeout: 2000 }, (t) =>
tap.test('mediasoup.Server() with non existing rtcIPv4 IP must fail', { timeout: 2000 }, (t) =>
{
let server = mediasoup.Server({ rtcListenIPv4: '1.2.3.4' });
let server = mediasoup.Server({ rtcIPv4: '1.2.3.4' });
server.on('close', (error) =>
{
......
......@@ -26,21 +26,21 @@ public:
// Struct holding the configuration.
struct Configuration
{
LogLevel logLevel { LogLevel::LOG_DEBUG };
LogLevel logLevel { LogLevel::LOG_DEBUG };
struct LogTags logTags;
std::string rtcListenIPv4;
std::string rtcListenIPv6;
std::string rtcAnnouncedListenIPv4;
std::string rtcAnnouncedListenIPv6;
uint16_t rtcMinPort { 10000 };
uint16_t rtcMaxPort { 59999 };
std::string rtcIPv4;
std::string rtcIPv6;
std::string rtcAnnouncedIPv4;
std::string rtcAnnouncedIPv6;
uint16_t rtcMinPort { 10000 };
uint16_t rtcMaxPort { 59999 };
std::string dtlsCertificateFile;
std::string dtlsPrivateKeyFile;
// Private fields.
bool hasIPv4 { false };
bool hasIPv6 { false };
bool hasAnnouncedIPv4 { false };
bool hasAnnouncedIPv6 { false };
bool hasIPv4 { false };
bool hasIPv6 { false };
bool hasAnnouncedIPv4 { false };
bool hasAnnouncedIPv6 { false };
};
public:
......@@ -49,12 +49,12 @@ public:
static void HandleRequest(Channel::Request* request);
private:
static void SetDefaultRtcListenIP(int requested_family);
static void SetDefaultRtcIP(int requested_family);
static void SetLogLevel(std::string &level);
static void SetRtcListenIPv4(const std::string &ip);
static void SetRtcListenIPv6(const std::string &ip);
static void SetRtcAnnouncedListenIPv4(const std::string &ip);
static void SetRtcAnnouncedListenIPv6(const std::string &ip);
static void SetRtcIPv4(const std::string &ip);
static void SetRtcIPv6(const std::string &ip);
static void SetRtcAnnouncedIPv4(const std::string &ip);
static void SetRtcAnnouncedIPv6(const std::string &ip);
static void SetRtcPorts();
static void SetDtlsCertificateAndPrivateKeyFiles();
static void SetLogTags(std::vector<std::string>& tags);
......
......@@ -21,7 +21,7 @@ namespace RTC
case AF_INET:
{
if (Settings::configuration.hasAnnouncedIPv4)
this->ip = Settings::configuration.rtcAnnouncedListenIPv4;
this->ip = Settings::configuration.rtcAnnouncedIPv4;
else
this->ip = udpSocket->GetLocalIP();
......@@ -31,7 +31,7 @@ namespace RTC
case AF_INET6:
{
if (Settings::configuration.hasAnnouncedIPv6)
this->ip = Settings::configuration.rtcAnnouncedListenIPv6;
this->ip = Settings::configuration.rtcAnnouncedIPv6;
else
this->ip = udpSocket->GetLocalIP();
......@@ -54,7 +54,7 @@ namespace RTC
case AF_INET:
{
if (Settings::configuration.hasAnnouncedIPv4)
this->ip = Settings::configuration.rtcAnnouncedListenIPv4;
this->ip = Settings::configuration.rtcAnnouncedIPv4;
else
this->ip = tcpServer->GetLocalIP();
......@@ -64,7 +64,7 @@ namespace RTC
case AF_INET6:
{
if (Settings::configuration.hasAnnouncedIPv6)
this->ip = Settings::configuration.rtcAnnouncedListenIPv6;
this->ip = Settings::configuration.rtcAnnouncedIPv6;
else
this->ip = tcpServer->GetLocalIP();
......
......@@ -39,16 +39,16 @@ namespace RTC
int err;
if (!Settings::configuration.rtcListenIPv4.empty())
if (!Settings::configuration.rtcIPv4.empty())
{
err = uv_ip4_addr(Settings::configuration.rtcListenIPv4.c_str(), 0, (struct sockaddr_in*)&RTC::TcpServer::sockaddrStorageIPv4);
err = uv_ip4_addr(Settings::configuration.rtcIPv4.c_str(), 0, (struct sockaddr_in*)&RTC::TcpServer::sockaddrStorageIPv4);
if (err)
MS_THROW_ERROR("uv_ipv4_addr() failed: %s", uv_strerror(err));
}
if (!Settings::configuration.rtcListenIPv6.empty())
if (!Settings::configuration.rtcIPv6.empty())
{
err = uv_ip6_addr(Settings::configuration.rtcListenIPv6.c_str(), 0, (struct sockaddr_in6*)&RTC::TcpServer::sockaddrStorageIPv6);
err = uv_ip6_addr(Settings::configuration.rtcIPv6.c_str(), 0, (struct sockaddr_in6*)&RTC::TcpServer::sockaddrStorageIPv6);
if (err)
MS_THROW_ERROR("uv_ipv6_addr() failed: %s", uv_strerror(err));
}
......@@ -90,13 +90,13 @@ namespace RTC
case AF_INET:
available_ports = &RTC::TcpServer::availableIPv4Ports;
bind_addr = RTC::TcpServer::sockaddrStorageIPv4;
listen_ip = Settings::configuration.rtcListenIPv4.c_str();
listen_ip = Settings::configuration.rtcIPv4.c_str();
break;
case AF_INET6:
available_ports = &RTC::TcpServer::availableIPv6Ports;
bind_addr = RTC::TcpServer::sockaddrStorageIPv6;
listen_ip = Settings::configuration.rtcListenIPv6.c_str();
listen_ip = Settings::configuration.rtcIPv6.c_str();
// Don't also bind into IPv4 when listening in IPv6.
flags |= UV_TCP_IPV6ONLY;
break;
......
......@@ -40,14 +40,14 @@ namespace RTC
if (Settings::configuration.hasIPv4)
{
err = uv_ip4_addr(Settings::configuration.rtcListenIPv4.c_str(), 0, (struct sockaddr_in*)&RTC::UdpSocket::sockaddrStorageIPv4);
err = uv_ip4_addr(Settings::configuration.rtcIPv4.c_str(), 0, (struct sockaddr_in*)&RTC::UdpSocket::sockaddrStorageIPv4);
if (err)
MS_THROW_ERROR("uv_ipv4_addr() failed: %s", uv_strerror(err));
}
if (Settings::configuration.hasIPv6)
{
err = uv_ip6_addr(Settings::configuration.rtcListenIPv6.c_str(), 0, (struct sockaddr_in6*)&RTC::UdpSocket::sockaddrStorageIPv6);
err = uv_ip6_addr(Settings::configuration.rtcIPv6.c_str(), 0, (struct sockaddr_in6*)&RTC::UdpSocket::sockaddrStorageIPv6);
if (err)
MS_THROW_ERROR("uv_ipv6_addr() failed: %s", uv_strerror(err));
}
......@@ -89,13 +89,13 @@ namespace RTC
case AF_INET:
available_ports = &RTC::UdpSocket::availableIPv4Ports;
bind_addr = RTC::UdpSocket::sockaddrStorageIPv4;
listen_ip = Settings::configuration.rtcListenIPv4.c_str();
listen_ip = Settings::configuration.rtcIPv4.c_str();
break;
case AF_INET6:
available_ports = &RTC::UdpSocket::availableIPv6Ports;
bind_addr = RTC::UdpSocket::sockaddrStorageIPv6;
listen_ip = Settings::configuration.rtcListenIPv6.c_str();
listen_ip = Settings::configuration.rtcIPv6.c_str();
// Don't also bind into IPv4 when listening in IPv6.
flags |= UV_UDP_IPV6ONLY;
break;
......
差异被折叠。
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论