Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
f8b61863
提交
f8b61863
authored
3月 16, 2017
作者:
Iñaki Baz Castillo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
0.7.0: Breaking change: rename rtcListenIPv4/6 with rtpIPv4/6
上级
99bc2578
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
91 行增加
和
91 行删除
+91
-91
Server.js
lib/Server.js
+12
-12
mediasoup.js
lib/mediasoup.js
+4
-4
package.json
package.json
+1
-1
test_mediasoup.js
test/test_mediasoup.js
+2
-2
Settings.hpp
worker/include/Settings.hpp
+9
-9
IceCandidate.cpp
worker/src/RTC/IceCandidate.cpp
+4
-4
TcpServer.cpp
worker/src/RTC/TcpServer.cpp
+6
-6
UdpSocket.cpp
worker/src/RTC/UdpSocket.cpp
+4
-4
Settings.cpp
worker/src/Settings.cpp
+49
-49
没有找到文件。
lib/Server.js
浏览文件 @
f8b61863
...
@@ -14,10 +14,10 @@ const VALID_WORKER_PARAMETERS =
...
@@ -14,10 +14,10 @@ const VALID_WORKER_PARAMETERS =
[
[
'logLevel'
,
'logLevel'
,
'logTags'
,
'logTags'
,
'rtc
Listen
IPv4'
,
'rtcIPv4'
,
'rtc
Listen
IPv6'
,
'rtcIPv6'
,
'rtcAnnounced
Listen
IPv4'
,
'rtcAnnouncedIPv4'
,
'rtcAnnounced
Listen
IPv6'
,
'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
.
rtc
ListenIPv4
===
null
||
options
.
rtcListen
IPv4
===
undefined
)
if
(
options
.
rtc
IPv4
===
null
||
options
.
rtc
IPv4
===
undefined
)
delete
options
.
rtc
Listen
IPv4
;
delete
options
.
rtcIPv4
;
if
(
options
.
rtc
ListenIPv6
===
null
||
options
.
rtcListen
IPv6
===
undefined
)
if
(
options
.
rtc
IPv6
===
null
||
options
.
rtc
IPv6
===
undefined
)
delete
options
.
rtc
Listen
IPv6
;
delete
options
.
rtcIPv6
;
if
(
!
options
.
rtcAnnounced
ListenIPv4
||
options
.
rtcListen
IPv4
===
false
)
if
(
!
options
.
rtcAnnounced
IPv4
||
options
.
rtc
IPv4
===
false
)
delete
options
.
rtcAnnounced
Listen
IPv4
;
delete
options
.
rtcAnnouncedIPv4
;
if
(
!
options
.
rtcAnnounced
ListenIPv6
||
options
.
rtcListen
IPv6
===
false
)
if
(
!
options
.
rtcAnnounced
IPv6
||
options
.
rtc
IPv6
===
false
)
delete
options
.
rtcAnnounced
Listen
IPv6
;
delete
options
.
rtcAnnouncedIPv6
;
if
(
!
check
.
greaterOrEqual
(
options
.
rtcMinPort
,
1024
))
if
(
!
check
.
greaterOrEqual
(
options
.
rtcMinPort
,
1024
))
options
.
rtcMinPort
=
10000
;
options
.
rtcMinPort
=
10000
;
...
...
lib/mediasoup.js
浏览文件 @
f8b61863
...
@@ -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.rtc
Listen
IPv4=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.rtc
Listen
IPv6=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.rtcAnnounced
Listen
IPv4] - 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.rtcAnnounced
Listen
IPv6] - 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.
...
...
package.json
浏览文件 @
f8b61863
{
{
"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"
:
{
...
...
test/test_mediasoup.js
浏览文件 @
f8b61863
...
@@ -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 rtc
Listen
IPv4 IP must fail'
,
{
timeout
:
2000
},
(
t
)
=>
tap
.
test
(
'mediasoup.Server() with non existing rtcIPv4 IP must fail'
,
{
timeout
:
2000
},
(
t
)
=>
{
{
let
server
=
mediasoup
.
Server
({
rtc
Listen
IPv4
:
'1.2.3.4'
});
let
server
=
mediasoup
.
Server
({
rtcIPv4
:
'1.2.3.4'
});
server
.
on
(
'close'
,
(
error
)
=>
server
.
on
(
'close'
,
(
error
)
=>
{
{
...
...
worker/include/Settings.hpp
浏览文件 @
f8b61863
...
@@ -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
rtc
Listen
IPv4
;
std
::
string
rtcIPv4
;
std
::
string
rtc
Listen
IPv6
;
std
::
string
rtcIPv6
;
std
::
string
rtcAnnounced
Listen
IPv4
;
std
::
string
rtcAnnouncedIPv4
;
std
::
string
rtcAnnounced
Listen
IPv6
;
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
SetDefaultRtc
Listen
IP
(
int
requested_family
);
static
void
SetDefaultRtcIP
(
int
requested_family
);
static
void
SetLogLevel
(
std
::
string
&
level
);
static
void
SetLogLevel
(
std
::
string
&
level
);
static
void
SetRtc
Listen
IPv4
(
const
std
::
string
&
ip
);
static
void
SetRtcIPv4
(
const
std
::
string
&
ip
);
static
void
SetRtc
Listen
IPv6
(
const
std
::
string
&
ip
);
static
void
SetRtcIPv6
(
const
std
::
string
&
ip
);
static
void
SetRtcAnnounced
Listen
IPv4
(
const
std
::
string
&
ip
);
static
void
SetRtcAnnouncedIPv4
(
const
std
::
string
&
ip
);
static
void
SetRtcAnnounced
Listen
IPv6
(
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
);
...
...
worker/src/RTC/IceCandidate.cpp
浏览文件 @
f8b61863
...
@@ -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
.
rtcAnnounced
Listen
IPv4
;
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
.
rtcAnnounced
Listen
IPv6
;
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
.
rtcAnnounced
Listen
IPv4
;
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
.
rtcAnnounced
Listen
IPv6
;
this
->
ip
=
Settings
::
configuration
.
rtcAnnouncedIPv6
;
else
else
this
->
ip
=
tcpServer
->
GetLocalIP
();
this
->
ip
=
tcpServer
->
GetLocalIP
();
...
...
worker/src/RTC/TcpServer.cpp
浏览文件 @
f8b61863
...
@@ -39,16 +39,16 @@ namespace RTC
...
@@ -39,16 +39,16 @@ namespace RTC
int
err
;
int
err
;
if
(
!
Settings
::
configuration
.
rtc
Listen
IPv4
.
empty
())
if
(
!
Settings
::
configuration
.
rtcIPv4
.
empty
())
{
{
err
=
uv_ip4_addr
(
Settings
::
configuration
.
rtc
Listen
IPv4
.
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
.
rtc
Listen
IPv6
.
empty
())
if
(
!
Settings
::
configuration
.
rtcIPv6
.
empty
())
{
{
err
=
uv_ip6_addr
(
Settings
::
configuration
.
rtc
Listen
IPv6
.
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
.
rtc
Listen
IPv4
.
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
.
rtc
Listen
IPv6
.
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
;
...
...
worker/src/RTC/UdpSocket.cpp
浏览文件 @
f8b61863
...
@@ -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
.
rtc
Listen
IPv4
.
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
.
rtc
Listen
IPv6
.
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
.
rtc
Listen
IPv4
.
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
.
rtc
Listen
IPv6
.
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
;
...
...
worker/src/Settings.cpp
浏览文件 @
f8b61863
...
@@ -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. */
SetDefaultRtc
Listen
IP
(
AF_INET
);
SetDefaultRtcIP
(
AF_INET
);
SetDefaultRtc
Listen
IP
(
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'
},
{
"rtc
ListenIPv4"
,
optional_argument
,
nullptr
,
'4'
},
{
"rtc
IPv4"
,
optional_argument
,
nullptr
,
'4'
},
{
"rtc
ListenIPv6"
,
optional_argument
,
nullptr
,
'6'
},
{
"rtc
IPv6"
,
optional_argument
,
nullptr
,
'6'
},
{
"rtcAnnounced
ListenIPv4"
,
optional_argument
,
nullptr
,
'5'
},
{
"rtcAnnounced
IPv4"
,
optional_argument
,
nullptr
,
'5'
},
{
"rtcAnnounced
ListenIPv6"
,
optional_argument
,
nullptr
,
'7'
},
{
"rtcAnnounced
IPv6"
,
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
);
SetRtc
Listen
IPv4
(
value_string
);
SetRtcIPv4
(
value_string
);
break
;
break
;
case
'6'
:
case
'6'
:
value_string
=
std
::
string
(
optarg
);
value_string
=
std
::
string
(
optarg
);
SetRtc
Listen
IPv6
(
value_string
);
SetRtcIPv6
(
value_string
);
break
;
break
;
case
'5'
:
case
'5'
:
value_string
=
std
::
string
(
optarg
);
value_string
=
std
::
string
(
optarg
);
SetRtcAnnounced
Listen
IPv4
(
value_string
);
SetRtcAnnouncedIPv4
(
value_string
);
break
;
break
;
case
'7'
:
case
'7'
:
value_string
=
std
::
string
(
optarg
);
value_string
=
std
::
string
(
optarg
);
SetRtcAnnounced
Listen
IPv6
(
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 'listen
IPv6'.
// 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 rtc
ListenIPv4 or rtcListen
IPv6 must be enabled"
);
MS_THROW_ERROR
(
"at least rtc
IPv4 or rtc
IPv6 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
.
rtcAnnounced
Listen
IPv4
=
""
;
Settings
::
configuration
.
rtcAnnouncedIPv4
=
""
;
Settings
::
configuration
.
hasAnnouncedIPv4
=
false
;
Settings
::
configuration
.
hasAnnouncedIPv4
=
false
;
}
}
if
(
!
Settings
::
configuration
.
hasIPv6
)
if
(
!
Settings
::
configuration
.
hasIPv6
)
{
{
Settings
::
configuration
.
rtcAnnounced
Listen
IPv6
=
""
;
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
,
" rtc
ListenIPv4 :
\"
%s
\"
"
,
Settings
::
configuration
.
rtcListen
IPv4
.
c_str
());
MS_DEBUG_TAG
(
info
,
" rtc
IPv4 :
\"
%s
\"
"
,
Settings
::
configuration
.
rtc
IPv4
.
c_str
());
else
else
MS_DEBUG_TAG
(
info
,
" rtc
ListenIPv4
: (unavailable)"
);
MS_DEBUG_TAG
(
info
,
" rtc
IPv4
: (unavailable)"
);
if
(
Settings
::
configuration
.
hasIPv6
)
if
(
Settings
::
configuration
.
hasIPv6
)
MS_DEBUG_TAG
(
info
,
" rtc
ListenIPv6 :
\"
%s
\"
"
,
Settings
::
configuration
.
rtcListen
IPv6
.
c_str
());
MS_DEBUG_TAG
(
info
,
" rtc
IPv6 :
\"
%s
\"
"
,
Settings
::
configuration
.
rtc
IPv6
.
c_str
());
else
else
MS_DEBUG_TAG
(
info
,
" rtc
ListenIPv6
: (unavailable)"
);
MS_DEBUG_TAG
(
info
,
" rtc
IPv6
: (unavailable)"
);
if
(
Settings
::
configuration
.
hasAnnouncedIPv4
)
if
(
Settings
::
configuration
.
hasAnnouncedIPv4
)
MS_DEBUG_TAG
(
info
,
" rtcAnnounced
ListenIPv4 :
\"
%s
\"
"
,
Settings
::
configuration
.
rtcAnnouncedListen
IPv4
.
c_str
());
MS_DEBUG_TAG
(
info
,
" rtcAnnounced
IPv4 :
\"
%s
\"
"
,
Settings
::
configuration
.
rtcAnnounced
IPv4
.
c_str
());
else
else
MS_DEBUG_TAG
(
info
,
" rtcAnnounced
ListenIPv4
: (unset)"
);
MS_DEBUG_TAG
(
info
,
" rtcAnnounced
IPv4
: (unset)"
);
if
(
Settings
::
configuration
.
hasAnnouncedIPv6
)
if
(
Settings
::
configuration
.
hasAnnouncedIPv6
)
MS_DEBUG_TAG
(
info
,
" rtcAnnounced
ListenIPv6 :
\"
%s
\"
"
,
Settings
::
configuration
.
rtcAnnouncedListen
IPv6
.
c_str
());
MS_DEBUG_TAG
(
info
,
" rtcAnnounced
IPv6 :
\"
%s
\"
"
,
Settings
::
configuration
.
rtcAnnounced
IPv6
.
c_str
());
else
else
MS_DEBUG_TAG
(
info
,
" rtcAnnounced
ListenIPv6
: (unset)"
);
MS_DEBUG_TAG
(
info
,
" rtcAnnounced
IPv6
: (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
::
SetDefaultRtc
Listen
IP
(
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
.
rtc
Listen
IPv4
=
ipv4
;
Settings
::
configuration
.
rtcIPv4
=
ipv4
;
Settings
::
configuration
.
hasIPv4
=
true
;
Settings
::
configuration
.
hasIPv4
=
true
;
}
}
if
(
!
ipv6
.
empty
())
if
(
!
ipv6
.
empty
())
{
{
Settings
::
configuration
.
rtc
Listen
IPv6
=
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
::
SetRtc
Listen
IPv4
(
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
.
rtc
Listen
IPv4
.
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
(
"rtc
Listen
IPv4 cannot be '0.0.0.0'"
);
MS_THROW_ERROR
(
"rtcIPv4 cannot be '0.0.0.0'"
);
Settings
::
configuration
.
rtc
Listen
IPv4
=
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 rtc
Listen
IPv4"
,
ip
.
c_str
());
MS_THROW_ERROR
(
"invalid IPv6 '%s' for rtcIPv4"
,
ip
.
c_str
());
default
:
default
:
MS_THROW_ERROR
(
"invalid value '%s' for rtc
Listen
IPv4"
,
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 rtc
Listen
IPv4: %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
::
SetRtc
Listen
IPv6
(
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
.
rtc
Listen
IPv6
.
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
(
"rtc
Listen
IPv6 cannot be '::'"
);
MS_THROW_ERROR
(
"rtcIPv6 cannot be '::'"
);
Settings
::
configuration
.
rtc
Listen
IPv6
=
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 rtc
Listen
IPv6"
,
ip
.
c_str
());
MS_THROW_ERROR
(
"invalid IPv4 '%s' for rtcIPv6"
,
ip
.
c_str
());
default
:
default
:
MS_THROW_ERROR
(
"invalid value '%s' for rtc
Listen
IPv6"
,
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 rtc
Listen
IPv6: %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
::
SetRtcAnnounced
Listen
IPv4
(
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
(
"rtcAnnounced
Listen
IPv4 cannot be '0.0.0.0'"
);
MS_THROW_ERROR
(
"rtcAnnouncedIPv4 cannot be '0.0.0.0'"
);
Settings
::
configuration
.
rtcAnnounced
Listen
IPv4
=
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 rtcAnnounced
Listen
IPv4"
,
ip
.
c_str
());
MS_THROW_ERROR
(
"invalid IPv6 '%s' for rtcAnnouncedIPv4"
,
ip
.
c_str
());
default
:
default
:
MS_THROW_ERROR
(
"invalid value '%s' for rtcAnnounced
Listen
IPv4"
,
ip
.
c_str
());
MS_THROW_ERROR
(
"invalid value '%s' for rtcAnnouncedIPv4"
,
ip
.
c_str
());
}
}
}
}
void
Settings
::
SetRtcAnnounced
Listen
IPv6
(
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
(
"rtcAnnounced
Listen
IPv6 cannot be '::'"
);
MS_THROW_ERROR
(
"rtcAnnouncedIPv6 cannot be '::'"
);
Settings
::
configuration
.
rtcAnnounced
Listen
IPv6
=
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 rtcAnnounced
Listen
IPv6"
,
ip
.
c_str
());
MS_THROW_ERROR
(
"invalid IPv4 '%s' for rtcAnnouncedIPv6"
,
ip
.
c_str
());
default
:
default
:
MS_THROW_ERROR
(
"invalid value '%s' for rtcAnnounced
Listen
IPv6"
,
ip
.
c_str
());
MS_THROW_ERROR
(
"invalid value '%s' for rtcAnnouncedIPv6"
,
ip
.
c_str
());
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论