mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Support statistic for HTTP-API, HTTP-Callback and Security (#2483)
* commit message for your changes. Lines starting * Update srs_app_rtc_api.cpp * add SrsRtcConnPlay and SrsRtcConnPublish, in enum SrsRtmpConnType * Update srs_rtmp_stack.cpp * Update srs_app_rtc_conn.cpp * Update srs_app_rtc_api.cpp * update utest * Update srs_utest_app.cpp
This commit is contained in:
parent
20931ddbb1
commit
0efd7b1bbc
9 changed files with 170 additions and 51 deletions
|
|
@ -519,6 +519,28 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|||
}
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtmpConnPlay, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("deny", "play", "all");
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("deny", "play", "12.13.14.15");
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("deny", "play", "11.12.13.14");
|
||||
if (true) {
|
||||
SrsConfDirective* d = new SrsConfDirective();
|
||||
d->name = "deny";
|
||||
d->args.push_back("play");
|
||||
d->args.push_back("12.13.14.15");
|
||||
rules.directives.push_back(d);
|
||||
}
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("deny", "publish", "12.13.14.15");
|
||||
|
|
@ -539,6 +561,16 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|||
rules.get_or_create("deny", "publish", "12.13.14.15");
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtmpConnHaivisionPublish, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("deny", "publish", "12.13.14.15");
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPublish, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("deny", "publish", "all");
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPublish, "11.12.13.14", &rr));
|
||||
}
|
||||
|
||||
// Allowed if not denied.
|
||||
if (true) {
|
||||
|
|
@ -571,6 +603,26 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|||
rules.get_or_create("deny", "publish", "12.13.14.15");
|
||||
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtmpConnFlashPublish, "11.12.13.14", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("deny", "play", "12.13.14.15");
|
||||
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPlay, "11.12.13.14", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("deny", "publish", "12.13.14.15");
|
||||
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("deny", "play", "all");
|
||||
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPublish, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("deny", "play", "12.13.14.15");
|
||||
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPublish, "12.13.14.15", &rr));
|
||||
}
|
||||
|
||||
// Allowed by rule.
|
||||
if (true) {
|
||||
|
|
@ -583,6 +635,26 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|||
rules.get_or_create("allow", "play", "all");
|
||||
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtmpConnPlay, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("allow", "play", "12.13.14.15");
|
||||
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("allow", "play", "all");
|
||||
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("allow", "publish", "all");
|
||||
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPublish, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("allow", "publish", "12.13.14.15");
|
||||
HELPER_EXPECT_SUCCESS(sec.do_check(&rules, SrsRtcConnPublish, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("allow", "publish", "all");
|
||||
|
|
@ -632,6 +704,16 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|||
rules.get_or_create("allow", "publish", "12.13.14.15");
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtmpConnPlay, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("allow", "play", "11.12.13.14");
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("allow", "publish", "12.13.14.15");
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "12.13.14.15", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("allow", "publish", "11.12.13.14");
|
||||
|
|
@ -650,6 +732,12 @@ VOID TEST(AppSecurity, CheckSecurity)
|
|||
rules.get_or_create("deny", "play", "11.12.13.14");
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtmpConnPlay, "11.12.13.14", &rr));
|
||||
}
|
||||
if (true) {
|
||||
SrsSecurity sec; SrsRequest rr; SrsConfDirective rules;
|
||||
rules.get_or_create("allow", "play", "11.12.13.14");
|
||||
rules.get_or_create("deny", "play", "11.12.13.14");
|
||||
HELPER_EXPECT_FAILED(sec.do_check(&rules, SrsRtcConnPlay, "11.12.13.14", &rr));
|
||||
}
|
||||
|
||||
// SRS apply the following simple strategies one by one:
|
||||
// 1. allow all if security disabled.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue