提交 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 = ...@@ -14,10 +14,10 @@ const VALID_WORKER_PARAMETERS =
[ [
'logLevel', 'logLevel',
'logTags', 'logTags',
'rtcListenIPv4', 'rtcIPv4',
'rtcListenIPv6', 'rtcIPv6',
'rtcAnnouncedListenIPv4', 'rtcAnnouncedIPv4',
'rtcAnnouncedListenIPv6', 'rtcAnnouncedIPv6',
'rtcMinPort', 'rtcMinPort',
'rtcMaxPort', 'rtcMaxPort',
'dtlsCertificateFile', 'dtlsCertificateFile',
...@@ -58,17 +58,17 @@ class Server extends EventEmitter ...@@ -58,17 +58,17 @@ class Server extends EventEmitter
if (!check.array(options.logTags)) if (!check.array(options.logTags))
options.logTags = []; options.logTags = [];
if (options.rtcListenIPv4 === null || options.rtcListenIPv4 === undefined) if (options.rtcIPv4 === null || options.rtcIPv4 === undefined)
delete options.rtcListenIPv4; delete options.rtcIPv4;
if (options.rtcListenIPv6 === null || options.rtcListenIPv6 === undefined) if (options.rtcIPv6 === null || options.rtcIPv6 === undefined)
delete options.rtcListenIPv6; delete options.rtcIPv6;
if (!options.rtcAnnouncedListenIPv4 || options.rtcListenIPv4 === false) if (!options.rtcAnnouncedIPv4 || options.rtcIPv4 === false)
delete options.rtcAnnouncedListenIPv4; delete options.rtcAnnouncedIPv4;
if (!options.rtcAnnouncedListenIPv6 || options.rtcListenIPv6 === false) if (!options.rtcAnnouncedIPv6 || options.rtcIPv6 === false)
delete options.rtcAnnouncedListenIPv6; delete options.rtcAnnouncedIPv6;
if (!check.greaterOrEqual(options.rtcMinPort, 1024)) if (!check.greaterOrEqual(options.rtcMinPort, 1024))
options.rtcMinPort = 10000; options.rtcMinPort = 10000;
......
...@@ -22,13 +22,13 @@ module.exports = ...@@ -22,13 +22,13 @@ module.exports =
* @param {string} [options.logLevel='debug'] - Log level. Valid values are * @param {string} [options.logLevel='debug'] - Log level. Valid values are
* 'debug', 'warn', 'error'. * 'debug', 'warn', 'error'.
* @param {array} [options.logTags] - Log tags. * @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). * 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). * 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. * 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. * value is a IPv6.
* @param {number} [options.rtcMinPort=10000] - Minimun RTC port. * @param {number} [options.rtcMinPort=10000] - Minimun RTC port.
* @param {number} [options.rtcMaxPort=59999] - Maximum RTC port. * @param {number} [options.rtcMaxPort=59999] - Maximum RTC port.
......
{ {
"name": "mediasoup", "name": "mediasoup",
"version": "0.6.0", "version": "0.7.0",
"description": "Powerful WebRTC SFU for Node.js", "description": "Powerful WebRTC SFU for Node.js",
"main": "lib/mediasoup.js", "main": "lib/mediasoup.js",
"repository": { "repository": {
......
...@@ -63,9 +63,9 @@ tap.test('mediasoup.Server() with wrong options must fail', { timeout: 2000 }, ( ...@@ -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) => server.on('close', (error) =>
{ {
......
...@@ -28,10 +28,10 @@ public: ...@@ -28,10 +28,10 @@ public:
{ {
LogLevel logLevel { LogLevel::LOG_DEBUG }; LogLevel logLevel { LogLevel::LOG_DEBUG };
struct LogTags logTags; struct LogTags logTags;
std::string rtcListenIPv4; std::string rtcIPv4;
std::string rtcListenIPv6; std::string rtcIPv6;
std::string rtcAnnouncedListenIPv4; std::string rtcAnnouncedIPv4;
std::string rtcAnnouncedListenIPv6; std::string rtcAnnouncedIPv6;
uint16_t rtcMinPort { 10000 }; uint16_t rtcMinPort { 10000 };
uint16_t rtcMaxPort { 59999 }; uint16_t rtcMaxPort { 59999 };
std::string dtlsCertificateFile; std::string dtlsCertificateFile;
...@@ -49,12 +49,12 @@ public: ...@@ -49,12 +49,12 @@ public:
static void HandleRequest(Channel::Request* request); static void HandleRequest(Channel::Request* request);
private: private:
static void SetDefaultRtcListenIP(int requested_family); static void SetDefaultRtcIP(int requested_family);
static void SetLogLevel(std::string &level); static void SetLogLevel(std::string &level);
static void SetRtcListenIPv4(const std::string &ip); static void SetRtcIPv4(const std::string &ip);
static void SetRtcListenIPv6(const std::string &ip); static void SetRtcIPv6(const std::string &ip);
static void SetRtcAnnouncedListenIPv4(const std::string &ip); static void SetRtcAnnouncedIPv4(const std::string &ip);
static void SetRtcAnnouncedListenIPv6(const std::string &ip); static void SetRtcAnnouncedIPv6(const std::string &ip);
static void SetRtcPorts(); static void SetRtcPorts();
static void SetDtlsCertificateAndPrivateKeyFiles(); static void SetDtlsCertificateAndPrivateKeyFiles();
static void SetLogTags(std::vector<std::string>& tags); static void SetLogTags(std::vector<std::string>& tags);
......
...@@ -21,7 +21,7 @@ namespace RTC ...@@ -21,7 +21,7 @@ namespace RTC
case AF_INET: case AF_INET:
{ {
if (Settings::configuration.hasAnnouncedIPv4) if (Settings::configuration.hasAnnouncedIPv4)
this->ip = Settings::configuration.rtcAnnouncedListenIPv4; this->ip = Settings::configuration.rtcAnnouncedIPv4;
else else
this->ip = udpSocket->GetLocalIP(); this->ip = udpSocket->GetLocalIP();
...@@ -31,7 +31,7 @@ namespace RTC ...@@ -31,7 +31,7 @@ namespace RTC
case AF_INET6: case AF_INET6:
{ {
if (Settings::configuration.hasAnnouncedIPv6) if (Settings::configuration.hasAnnouncedIPv6)
this->ip = Settings::configuration.rtcAnnouncedListenIPv6; this->ip = Settings::configuration.rtcAnnouncedIPv6;
else else
this->ip = udpSocket->GetLocalIP(); this->ip = udpSocket->GetLocalIP();
...@@ -54,7 +54,7 @@ namespace RTC ...@@ -54,7 +54,7 @@ namespace RTC
case AF_INET: case AF_INET:
{ {
if (Settings::configuration.hasAnnouncedIPv4) if (Settings::configuration.hasAnnouncedIPv4)
this->ip = Settings::configuration.rtcAnnouncedListenIPv4; this->ip = Settings::configuration.rtcAnnouncedIPv4;
else else
this->ip = tcpServer->GetLocalIP(); this->ip = tcpServer->GetLocalIP();
...@@ -64,7 +64,7 @@ namespace RTC ...@@ -64,7 +64,7 @@ namespace RTC
case AF_INET6: case AF_INET6:
{ {
if (Settings::configuration.hasAnnouncedIPv6) if (Settings::configuration.hasAnnouncedIPv6)
this->ip = Settings::configuration.rtcAnnouncedListenIPv6; this->ip = Settings::configuration.rtcAnnouncedIPv6;
else else
this->ip = tcpServer->GetLocalIP(); this->ip = tcpServer->GetLocalIP();
......
...@@ -39,16 +39,16 @@ namespace RTC ...@@ -39,16 +39,16 @@ namespace RTC
int err; 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) if (err)
MS_THROW_ERROR("uv_ipv4_addr() failed: %s", uv_strerror(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) if (err)
MS_THROW_ERROR("uv_ipv6_addr() failed: %s", uv_strerror(err)); MS_THROW_ERROR("uv_ipv6_addr() failed: %s", uv_strerror(err));
} }
...@@ -90,13 +90,13 @@ namespace RTC ...@@ -90,13 +90,13 @@ namespace RTC
case AF_INET: case AF_INET:
available_ports = &RTC::TcpServer::availableIPv4Ports; available_ports = &RTC::TcpServer::availableIPv4Ports;
bind_addr = RTC::TcpServer::sockaddrStorageIPv4; bind_addr = RTC::TcpServer::sockaddrStorageIPv4;
listen_ip = Settings::configuration.rtcListenIPv4.c_str(); listen_ip = Settings::configuration.rtcIPv4.c_str();
break; break;
case AF_INET6: case AF_INET6:
available_ports = &RTC::TcpServer::availableIPv6Ports; available_ports = &RTC::TcpServer::availableIPv6Ports;
bind_addr = RTC::TcpServer::sockaddrStorageIPv6; 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. // Don't also bind into IPv4 when listening in IPv6.
flags |= UV_TCP_IPV6ONLY; flags |= UV_TCP_IPV6ONLY;
break; break;
......
...@@ -40,14 +40,14 @@ namespace RTC ...@@ -40,14 +40,14 @@ namespace RTC
if (Settings::configuration.hasIPv4) 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) if (err)
MS_THROW_ERROR("uv_ipv4_addr() failed: %s", uv_strerror(err)); MS_THROW_ERROR("uv_ipv4_addr() failed: %s", uv_strerror(err));
} }
if (Settings::configuration.hasIPv6) 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) if (err)
MS_THROW_ERROR("uv_ipv6_addr() failed: %s", uv_strerror(err)); MS_THROW_ERROR("uv_ipv6_addr() failed: %s", uv_strerror(err));
} }
...@@ -89,13 +89,13 @@ namespace RTC ...@@ -89,13 +89,13 @@ namespace RTC
case AF_INET: case AF_INET:
available_ports = &RTC::UdpSocket::availableIPv4Ports; available_ports = &RTC::UdpSocket::availableIPv4Ports;
bind_addr = RTC::UdpSocket::sockaddrStorageIPv4; bind_addr = RTC::UdpSocket::sockaddrStorageIPv4;
listen_ip = Settings::configuration.rtcListenIPv4.c_str(); listen_ip = Settings::configuration.rtcIPv4.c_str();
break; break;
case AF_INET6: case AF_INET6:
available_ports = &RTC::UdpSocket::availableIPv6Ports; available_ports = &RTC::UdpSocket::availableIPv6Ports;
bind_addr = RTC::UdpSocket::sockaddrStorageIPv6; 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. // Don't also bind into IPv4 when listening in IPv6.
flags |= UV_UDP_IPV6ONLY; flags |= UV_UDP_IPV6ONLY;
break; break;
......
...@@ -43,8 +43,8 @@ void Settings::SetConfiguration(int argc, char* argv[]) ...@@ -43,8 +43,8 @@ void Settings::SetConfiguration(int argc, char* argv[])
/* Set default configuration. */ /* Set default configuration. */
SetDefaultRtcListenIP(AF_INET); SetDefaultRtcIP(AF_INET);
SetDefaultRtcListenIP(AF_INET6); SetDefaultRtcIP(AF_INET6);
/* Variables for getopt. */ /* Variables for getopt. */
...@@ -59,10 +59,10 @@ void Settings::SetConfiguration(int argc, char* argv[]) ...@@ -59,10 +59,10 @@ void Settings::SetConfiguration(int argc, char* argv[])
{ {
{ "logLevel", optional_argument, nullptr, 'l' }, { "logLevel", optional_argument, nullptr, 'l' },
{ "logTag", optional_argument, nullptr, 't' }, { "logTag", optional_argument, nullptr, 't' },
{ "rtcListenIPv4", optional_argument, nullptr, '4' }, { "rtcIPv4", optional_argument, nullptr, '4' },
{ "rtcListenIPv6", optional_argument, nullptr, '6' }, { "rtcIPv6", optional_argument, nullptr, '6' },
{ "rtcAnnouncedListenIPv4", optional_argument, nullptr, '5' }, { "rtcAnnouncedIPv4", optional_argument, nullptr, '5' },
{ "rtcAnnouncedListenIPv6", optional_argument, nullptr, '7' }, { "rtcAnnouncedIPv6", optional_argument, nullptr, '7' },
{ "rtcMinPort", optional_argument, nullptr, 'm' }, { "rtcMinPort", optional_argument, nullptr, 'm' },
{ "rtcMaxPort", optional_argument, nullptr, 'M' }, { "rtcMaxPort", optional_argument, nullptr, 'M' },
{ "dtlsCertificateFile", optional_argument, nullptr, 'c' }, { "dtlsCertificateFile", optional_argument, nullptr, 'c' },
...@@ -92,22 +92,22 @@ void Settings::SetConfiguration(int argc, char* argv[]) ...@@ -92,22 +92,22 @@ void Settings::SetConfiguration(int argc, char* argv[])
case '4': case '4':
value_string = std::string(optarg); value_string = std::string(optarg);
SetRtcListenIPv4(value_string); SetRtcIPv4(value_string);
break; break;
case '6': case '6':
value_string = std::string(optarg); value_string = std::string(optarg);
SetRtcListenIPv6(value_string); SetRtcIPv6(value_string);
break; break;
case '5': case '5':
value_string = std::string(optarg); value_string = std::string(optarg);
SetRtcAnnouncedListenIPv4(value_string); SetRtcAnnouncedIPv4(value_string);
break; break;
case '7': case '7':
value_string = std::string(optarg); value_string = std::string(optarg);
SetRtcAnnouncedListenIPv6(value_string); SetRtcAnnouncedIPv6(value_string);
break; break;
case 'm': case 'm':
...@@ -151,19 +151,19 @@ void Settings::SetConfiguration(int argc, char* argv[]) ...@@ -151,19 +151,19 @@ void Settings::SetConfiguration(int argc, char* argv[])
if (!log_tags.empty()) if (!log_tags.empty())
Settings::SetLogTags(log_tags); Settings::SetLogTags(log_tags);
// RTC must have at least 'listenIPv4' or 'listenIPv6'. // RTC must have at least 'IPv4' or 'IPv6'.
if (!Settings::configuration.hasIPv4 && !Settings::configuration.hasIPv6) if (!Settings::configuration.hasIPv4 && !Settings::configuration.hasIPv6)
MS_THROW_ERROR("at least rtcListenIPv4 or rtcListenIPv6 must be enabled"); MS_THROW_ERROR("at least rtcIPv4 or rtcIPv6 must be enabled");
// Clean RTP announced IPs if not available. // Clean RTP announced IPs if not available.
if (!Settings::configuration.hasIPv4) if (!Settings::configuration.hasIPv4)
{ {
Settings::configuration.rtcAnnouncedListenIPv4 = ""; Settings::configuration.rtcAnnouncedIPv4 = "";
Settings::configuration.hasAnnouncedIPv4 = false; Settings::configuration.hasAnnouncedIPv4 = false;
} }
if (!Settings::configuration.hasIPv6) if (!Settings::configuration.hasIPv6)
{ {
Settings::configuration.rtcAnnouncedListenIPv6 = ""; Settings::configuration.rtcAnnouncedIPv6 = "";
Settings::configuration.hasAnnouncedIPv6 = false; Settings::configuration.hasAnnouncedIPv6 = false;
} }
...@@ -201,21 +201,21 @@ void Settings::PrintConfiguration() ...@@ -201,21 +201,21 @@ void Settings::PrintConfiguration()
MS_DEBUG_TAG(info, " logTag : \"%s\"", tag.c_str()); MS_DEBUG_TAG(info, " logTag : \"%s\"", tag.c_str());
} }
if (Settings::configuration.hasIPv4) if (Settings::configuration.hasIPv4)
MS_DEBUG_TAG(info, " rtcListenIPv4 : \"%s\"", Settings::configuration.rtcListenIPv4.c_str()); MS_DEBUG_TAG(info, " rtcIPv4 : \"%s\"", Settings::configuration.rtcIPv4.c_str());
else else
MS_DEBUG_TAG(info, " rtcListenIPv4 : (unavailable)"); MS_DEBUG_TAG(info, " rtcIPv4 : (unavailable)");
if (Settings::configuration.hasIPv6) if (Settings::configuration.hasIPv6)
MS_DEBUG_TAG(info, " rtcListenIPv6 : \"%s\"", Settings::configuration.rtcListenIPv6.c_str()); MS_DEBUG_TAG(info, " rtcIPv6 : \"%s\"", Settings::configuration.rtcIPv6.c_str());
else else
MS_DEBUG_TAG(info, " rtcListenIPv6 : (unavailable)"); MS_DEBUG_TAG(info, " rtcIPv6 : (unavailable)");
if (Settings::configuration.hasAnnouncedIPv4) if (Settings::configuration.hasAnnouncedIPv4)
MS_DEBUG_TAG(info, " rtcAnnouncedListenIPv4 : \"%s\"", Settings::configuration.rtcAnnouncedListenIPv4.c_str()); MS_DEBUG_TAG(info, " rtcAnnouncedIPv4 : \"%s\"", Settings::configuration.rtcAnnouncedIPv4.c_str());
else else
MS_DEBUG_TAG(info, " rtcAnnouncedListenIPv4 : (unset)"); MS_DEBUG_TAG(info, " rtcAnnouncedIPv4 : (unset)");
if (Settings::configuration.hasAnnouncedIPv6) if (Settings::configuration.hasAnnouncedIPv6)
MS_DEBUG_TAG(info, " rtcAnnouncedListenIPv6 : \"%s\"", Settings::configuration.rtcAnnouncedListenIPv6.c_str()); MS_DEBUG_TAG(info, " rtcAnnouncedIPv6 : \"%s\"", Settings::configuration.rtcAnnouncedIPv6.c_str());
else else
MS_DEBUG_TAG(info, " rtcAnnouncedListenIPv6 : (unset)"); MS_DEBUG_TAG(info, " rtcAnnouncedIPv6 : (unset)");
MS_DEBUG_TAG(info, " rtcMinPort : %" PRIu16, Settings::configuration.rtcMinPort); MS_DEBUG_TAG(info, " rtcMinPort : %" PRIu16, Settings::configuration.rtcMinPort);
MS_DEBUG_TAG(info, " rtcMaxPort : %" PRIu16, Settings::configuration.rtcMaxPort); MS_DEBUG_TAG(info, " rtcMaxPort : %" PRIu16, Settings::configuration.rtcMaxPort);
if (!Settings::configuration.dtlsCertificateFile.empty()) if (!Settings::configuration.dtlsCertificateFile.empty())
...@@ -280,7 +280,7 @@ void Settings::HandleRequest(Channel::Request* request) ...@@ -280,7 +280,7 @@ void Settings::HandleRequest(Channel::Request* request)
} }
} }
void Settings::SetDefaultRtcListenIP(int requested_family) void Settings::SetDefaultRtcIP(int requested_family)
{ {
MS_TRACE(); MS_TRACE();
...@@ -341,13 +341,13 @@ void Settings::SetDefaultRtcListenIP(int requested_family) ...@@ -341,13 +341,13 @@ void Settings::SetDefaultRtcListenIP(int requested_family)
if (!ipv4.empty()) if (!ipv4.empty())
{ {
Settings::configuration.rtcListenIPv4 = ipv4; Settings::configuration.rtcIPv4 = ipv4;
Settings::configuration.hasIPv4 = true; Settings::configuration.hasIPv4 = true;
} }
if (!ipv6.empty()) if (!ipv6.empty())
{ {
Settings::configuration.rtcListenIPv6 = ipv6; Settings::configuration.rtcIPv6 = ipv6;
Settings::configuration.hasIPv6 = true; Settings::configuration.hasIPv6 = true;
} }
...@@ -367,7 +367,7 @@ void Settings::SetLogLevel(std::string &level) ...@@ -367,7 +367,7 @@ void Settings::SetLogLevel(std::string &level)
Settings::configuration.logLevel = Settings::string2LogLevel[level]; Settings::configuration.logLevel = Settings::string2LogLevel[level];
} }
void Settings::SetRtcListenIPv4(const std::string &ip) void Settings::SetRtcIPv4(const std::string &ip)
{ {
MS_TRACE(); MS_TRACE();
...@@ -376,7 +376,7 @@ void Settings::SetRtcListenIPv4(const std::string &ip) ...@@ -376,7 +376,7 @@ void Settings::SetRtcListenIPv4(const std::string &ip)
if (ip.empty() || ip.compare("false") == 0) if (ip.empty() || ip.compare("false") == 0)
{ {
Settings::configuration.rtcListenIPv4.clear(); Settings::configuration.rtcIPv4.clear();
Settings::configuration.hasIPv4 = false; Settings::configuration.hasIPv4 = false;
return; return;
} }
...@@ -385,22 +385,22 @@ void Settings::SetRtcListenIPv4(const std::string &ip) ...@@ -385,22 +385,22 @@ void Settings::SetRtcListenIPv4(const std::string &ip)
{ {
case AF_INET: case AF_INET:
if (ip == "0.0.0.0") if (ip == "0.0.0.0")
MS_THROW_ERROR("rtcListenIPv4 cannot be '0.0.0.0'"); MS_THROW_ERROR("rtcIPv4 cannot be '0.0.0.0'");
Settings::configuration.rtcListenIPv4 = ip; Settings::configuration.rtcIPv4 = ip;
Settings::configuration.hasIPv4 = true; Settings::configuration.hasIPv4 = true;
break; break;
case AF_INET6: case AF_INET6:
MS_THROW_ERROR("invalid IPv6 '%s' for rtcListenIPv4", ip.c_str()); MS_THROW_ERROR("invalid IPv6 '%s' for rtcIPv4", ip.c_str());
default: default:
MS_THROW_ERROR("invalid value '%s' for rtcListenIPv4", ip.c_str()); MS_THROW_ERROR("invalid value '%s' for rtcIPv4", ip.c_str());
} }
int bind_errno; int bind_errno;
if (!IsBindableIP(ip, AF_INET, &bind_errno)) if (!IsBindableIP(ip, AF_INET, &bind_errno))
MS_THROW_ERROR("cannot bind on '%s' for rtcListenIPv4: %s", ip.c_str(), std::strerror(bind_errno)); MS_THROW_ERROR("cannot bind on '%s' for rtcIPv4: %s", ip.c_str(), std::strerror(bind_errno));
} }
void Settings::SetRtcListenIPv6(const std::string &ip) void Settings::SetRtcIPv6(const std::string &ip)
{ {
MS_TRACE(); MS_TRACE();
...@@ -409,7 +409,7 @@ void Settings::SetRtcListenIPv6(const std::string &ip) ...@@ -409,7 +409,7 @@ void Settings::SetRtcListenIPv6(const std::string &ip)
if (ip.empty() || ip.compare("false") == 0) if (ip.empty() || ip.compare("false") == 0)
{ {
Settings::configuration.rtcListenIPv6.clear(); Settings::configuration.rtcIPv6.clear();
Settings::configuration.hasIPv6 = false; Settings::configuration.hasIPv6 = false;
return; return;
} }
...@@ -418,22 +418,22 @@ void Settings::SetRtcListenIPv6(const std::string &ip) ...@@ -418,22 +418,22 @@ void Settings::SetRtcListenIPv6(const std::string &ip)
{ {
case AF_INET6: case AF_INET6:
if (ip == "::") if (ip == "::")
MS_THROW_ERROR("rtcListenIPv6 cannot be '::'"); MS_THROW_ERROR("rtcIPv6 cannot be '::'");
Settings::configuration.rtcListenIPv6 = ip; Settings::configuration.rtcIPv6 = ip;
Settings::configuration.hasIPv6 = true; Settings::configuration.hasIPv6 = true;
break; break;
case AF_INET: case AF_INET:
MS_THROW_ERROR("invalid IPv4 '%s' for rtcListenIPv6", ip.c_str()); MS_THROW_ERROR("invalid IPv4 '%s' for rtcIPv6", ip.c_str());
default: default:
MS_THROW_ERROR("invalid value '%s' for rtcListenIPv6", ip.c_str()); MS_THROW_ERROR("invalid value '%s' for rtcIPv6", ip.c_str());
} }
int bind_errno; int bind_errno;
if (!IsBindableIP(ip, AF_INET6, &bind_errno)) if (!IsBindableIP(ip, AF_INET6, &bind_errno))
MS_THROW_ERROR("cannot bind on '%s' for rtcListenIPv6: %s", ip.c_str(), std::strerror(bind_errno)); MS_THROW_ERROR("cannot bind on '%s' for rtcIPv6: %s", ip.c_str(), std::strerror(bind_errno));
} }
void Settings::SetRtcAnnouncedListenIPv4(const std::string &ip) void Settings::SetRtcAnnouncedIPv4(const std::string &ip)
{ {
MS_TRACE(); MS_TRACE();
...@@ -441,18 +441,18 @@ void Settings::SetRtcAnnouncedListenIPv4(const std::string &ip) ...@@ -441,18 +441,18 @@ void Settings::SetRtcAnnouncedListenIPv4(const std::string &ip)
{ {
case AF_INET: case AF_INET:
if (ip == "0.0.0.0") if (ip == "0.0.0.0")
MS_THROW_ERROR("rtcAnnouncedListenIPv4 cannot be '0.0.0.0'"); MS_THROW_ERROR("rtcAnnouncedIPv4 cannot be '0.0.0.0'");
Settings::configuration.rtcAnnouncedListenIPv4 = ip; Settings::configuration.rtcAnnouncedIPv4 = ip;
Settings::configuration.hasAnnouncedIPv4 = true; Settings::configuration.hasAnnouncedIPv4 = true;
break; break;
case AF_INET6: case AF_INET6:
MS_THROW_ERROR("invalid IPv6 '%s' for rtcAnnouncedListenIPv4", ip.c_str()); MS_THROW_ERROR("invalid IPv6 '%s' for rtcAnnouncedIPv4", ip.c_str());
default: default:
MS_THROW_ERROR("invalid value '%s' for rtcAnnouncedListenIPv4", ip.c_str()); MS_THROW_ERROR("invalid value '%s' for rtcAnnouncedIPv4", ip.c_str());
} }
} }
void Settings::SetRtcAnnouncedListenIPv6(const std::string &ip) void Settings::SetRtcAnnouncedIPv6(const std::string &ip)
{ {
MS_TRACE(); MS_TRACE();
...@@ -460,14 +460,14 @@ void Settings::SetRtcAnnouncedListenIPv6(const std::string &ip) ...@@ -460,14 +460,14 @@ void Settings::SetRtcAnnouncedListenIPv6(const std::string &ip)
{ {
case AF_INET6: case AF_INET6:
if (ip == "::") if (ip == "::")
MS_THROW_ERROR("rtcAnnouncedListenIPv6 cannot be '::'"); MS_THROW_ERROR("rtcAnnouncedIPv6 cannot be '::'");
Settings::configuration.rtcAnnouncedListenIPv6 = ip; Settings::configuration.rtcAnnouncedIPv6 = ip;
Settings::configuration.hasAnnouncedIPv6 = true; Settings::configuration.hasAnnouncedIPv6 = true;
break; break;
case AF_INET: case AF_INET:
MS_THROW_ERROR("invalid IPv4 '%s' for rtcAnnouncedListenIPv6", ip.c_str()); MS_THROW_ERROR("invalid IPv4 '%s' for rtcAnnouncedIPv6", ip.c_str());
default: default:
MS_THROW_ERROR("invalid value '%s' for rtcAnnouncedListenIPv6", ip.c_str()); MS_THROW_ERROR("invalid value '%s' for rtcAnnouncedIPv6", ip.c_str());
} }
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论