正在显示
3 个修改的文件
包含
165 行增加
和
4 行删除
@@ -53,10 +53,12 @@ SrsGoApiRoot::~SrsGoApiRoot() | @@ -53,10 +53,12 @@ SrsGoApiRoot::~SrsGoApiRoot() | ||
53 | 53 | ||
54 | int SrsGoApiRoot::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | 54 | int SrsGoApiRoot::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) |
55 | { | 55 | { |
56 | + SrsStatistic* stat = SrsStatistic::instance(); | ||
56 | std::stringstream ss; | 57 | std::stringstream ss; |
57 | 58 | ||
58 | ss << SRS_JOBJECT_START | 59 | ss << SRS_JOBJECT_START |
59 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT | 60 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT |
61 | + << SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT | ||
60 | << SRS_JFIELD_ORG("urls", SRS_JOBJECT_START) | 62 | << SRS_JFIELD_ORG("urls", SRS_JOBJECT_START) |
61 | << SRS_JFIELD_STR("api", "the api root") | 63 | << SRS_JFIELD_STR("api", "the api root") |
62 | << SRS_JOBJECT_END | 64 | << SRS_JOBJECT_END |
@@ -75,10 +77,12 @@ SrsGoApiApi::~SrsGoApiApi() | @@ -75,10 +77,12 @@ SrsGoApiApi::~SrsGoApiApi() | ||
75 | 77 | ||
76 | int SrsGoApiApi::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | 78 | int SrsGoApiApi::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) |
77 | { | 79 | { |
80 | + SrsStatistic* stat = SrsStatistic::instance(); | ||
78 | std::stringstream ss; | 81 | std::stringstream ss; |
79 | 82 | ||
80 | ss << SRS_JOBJECT_START | 83 | ss << SRS_JOBJECT_START |
81 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT | 84 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT |
85 | + << SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT | ||
82 | << SRS_JFIELD_ORG("urls", SRS_JOBJECT_START) | 86 | << SRS_JFIELD_ORG("urls", SRS_JOBJECT_START) |
83 | << SRS_JFIELD_STR("v1", "the api version 1.0") | 87 | << SRS_JFIELD_STR("v1", "the api version 1.0") |
84 | << SRS_JOBJECT_END | 88 | << SRS_JOBJECT_END |
@@ -97,10 +101,12 @@ SrsGoApiV1::~SrsGoApiV1() | @@ -97,10 +101,12 @@ SrsGoApiV1::~SrsGoApiV1() | ||
97 | 101 | ||
98 | int SrsGoApiV1::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | 102 | int SrsGoApiV1::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) |
99 | { | 103 | { |
104 | + SrsStatistic* stat = SrsStatistic::instance(); | ||
100 | std::stringstream ss; | 105 | std::stringstream ss; |
101 | 106 | ||
102 | ss << SRS_JOBJECT_START | 107 | ss << SRS_JOBJECT_START |
103 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT | 108 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT |
109 | + << SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT | ||
104 | << SRS_JFIELD_ORG("urls", SRS_JOBJECT_START) | 110 | << SRS_JFIELD_ORG("urls", SRS_JOBJECT_START) |
105 | << SRS_JFIELD_STR("versions", "the version of SRS") << SRS_JFIELD_CONT | 111 | << SRS_JFIELD_STR("versions", "the version of SRS") << SRS_JFIELD_CONT |
106 | << SRS_JFIELD_STR("summaries", "the summary(pid, argv, pwd, cpu, mem) of SRS") << SRS_JFIELD_CONT | 112 | << SRS_JFIELD_STR("summaries", "the summary(pid, argv, pwd, cpu, mem) of SRS") << SRS_JFIELD_CONT |
@@ -108,11 +114,12 @@ int SrsGoApiV1::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -108,11 +114,12 @@ int SrsGoApiV1::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
108 | << SRS_JFIELD_STR("self_proc_stats", "the self process stats") << SRS_JFIELD_CONT | 114 | << SRS_JFIELD_STR("self_proc_stats", "the self process stats") << SRS_JFIELD_CONT |
109 | << SRS_JFIELD_STR("system_proc_stats", "the system process stats") << SRS_JFIELD_CONT | 115 | << SRS_JFIELD_STR("system_proc_stats", "the system process stats") << SRS_JFIELD_CONT |
110 | << SRS_JFIELD_STR("meminfos", "the meminfo of system") << SRS_JFIELD_CONT | 116 | << SRS_JFIELD_STR("meminfos", "the meminfo of system") << SRS_JFIELD_CONT |
111 | - << SRS_JFIELD_STR("authors", "the primary authors and contributors") << SRS_JFIELD_CONT | 117 | + << SRS_JFIELD_STR("authors", "the license, copyright, authors and contributors") << SRS_JFIELD_CONT |
118 | + << SRS_JFIELD_STR("features", "the supported features of SRS") << SRS_JFIELD_CONT | ||
112 | << SRS_JFIELD_STR("requests", "the request itself, for http debug") << SRS_JFIELD_CONT | 119 | << SRS_JFIELD_STR("requests", "the request itself, for http debug") << SRS_JFIELD_CONT |
113 | - << SRS_JFIELD_STR("vhosts", "dumps vhost to json") << SRS_JFIELD_CONT | ||
114 | - << SRS_JFIELD_STR("streams", "dumps streams to json") << SRS_JFIELD_CONT | ||
115 | - << SRS_JFIELD_STR("clients", "dumps clients to json") << SRS_JFIELD_CONT | 120 | + << SRS_JFIELD_STR("vhosts", "manage all vhosts or specified vhost") << SRS_JFIELD_CONT |
121 | + << SRS_JFIELD_STR("streams", "manage all streams or specified stream") << SRS_JFIELD_CONT | ||
122 | + << SRS_JFIELD_STR("clients", "manage all clients or specified client, default query top 10 clients") << SRS_JFIELD_CONT | ||
116 | << SRS_JFIELD_ORG("tests", SRS_JOBJECT_START) | 123 | << SRS_JFIELD_ORG("tests", SRS_JOBJECT_START) |
117 | << SRS_JFIELD_STR("requests", "show the request info") << SRS_JFIELD_CONT | 124 | << SRS_JFIELD_STR("requests", "show the request info") << SRS_JFIELD_CONT |
118 | << SRS_JFIELD_STR("errors", "always return an error 100") << SRS_JFIELD_CONT | 125 | << SRS_JFIELD_STR("errors", "always return an error 100") << SRS_JFIELD_CONT |
@@ -135,10 +142,12 @@ SrsGoApiVersion::~SrsGoApiVersion() | @@ -135,10 +142,12 @@ SrsGoApiVersion::~SrsGoApiVersion() | ||
135 | 142 | ||
136 | int SrsGoApiVersion::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | 143 | int SrsGoApiVersion::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) |
137 | { | 144 | { |
145 | + SrsStatistic* stat = SrsStatistic::instance(); | ||
138 | std::stringstream ss; | 146 | std::stringstream ss; |
139 | 147 | ||
140 | ss << SRS_JOBJECT_START | 148 | ss << SRS_JOBJECT_START |
141 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT | 149 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT |
150 | + << SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT | ||
142 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) | 151 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) |
143 | << SRS_JFIELD_ORG("major", VERSION_MAJOR) << SRS_JFIELD_CONT | 152 | << SRS_JFIELD_ORG("major", VERSION_MAJOR) << SRS_JFIELD_CONT |
144 | << SRS_JFIELD_ORG("minor", VERSION_MINOR) << SRS_JFIELD_CONT | 153 | << SRS_JFIELD_ORG("minor", VERSION_MINOR) << SRS_JFIELD_CONT |
@@ -175,12 +184,14 @@ SrsGoApiRusages::~SrsGoApiRusages() | @@ -175,12 +184,14 @@ SrsGoApiRusages::~SrsGoApiRusages() | ||
175 | 184 | ||
176 | int SrsGoApiRusages::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* req) | 185 | int SrsGoApiRusages::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* req) |
177 | { | 186 | { |
187 | + SrsStatistic* stat = SrsStatistic::instance(); | ||
178 | std::stringstream ss; | 188 | std::stringstream ss; |
179 | 189 | ||
180 | SrsRusage* r = srs_get_system_rusage(); | 190 | SrsRusage* r = srs_get_system_rusage(); |
181 | 191 | ||
182 | ss << SRS_JOBJECT_START | 192 | ss << SRS_JOBJECT_START |
183 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT | 193 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT |
194 | + << SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT | ||
184 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) | 195 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) |
185 | << SRS_JFIELD_ORG("ok", (r->ok? "true":"false")) << SRS_JFIELD_CONT | 196 | << SRS_JFIELD_ORG("ok", (r->ok? "true":"false")) << SRS_JFIELD_CONT |
186 | << SRS_JFIELD_ORG("sample_time", r->sample_time) << SRS_JFIELD_CONT | 197 | << SRS_JFIELD_ORG("sample_time", r->sample_time) << SRS_JFIELD_CONT |
@@ -216,12 +227,14 @@ SrsGoApiSelfProcStats::~SrsGoApiSelfProcStats() | @@ -216,12 +227,14 @@ SrsGoApiSelfProcStats::~SrsGoApiSelfProcStats() | ||
216 | 227 | ||
217 | int SrsGoApiSelfProcStats::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | 228 | int SrsGoApiSelfProcStats::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) |
218 | { | 229 | { |
230 | + SrsStatistic* stat = SrsStatistic::instance(); | ||
219 | std::stringstream ss; | 231 | std::stringstream ss; |
220 | 232 | ||
221 | SrsProcSelfStat* u = srs_get_self_proc_stat(); | 233 | SrsProcSelfStat* u = srs_get_self_proc_stat(); |
222 | 234 | ||
223 | ss << SRS_JOBJECT_START | 235 | ss << SRS_JOBJECT_START |
224 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT | 236 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT |
237 | + << SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT | ||
225 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) | 238 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) |
226 | << SRS_JFIELD_ORG("ok", (u->ok? "true":"false")) << SRS_JFIELD_CONT | 239 | << SRS_JFIELD_ORG("ok", (u->ok? "true":"false")) << SRS_JFIELD_CONT |
227 | << SRS_JFIELD_ORG("sample_time", u->sample_time) << SRS_JFIELD_CONT | 240 | << SRS_JFIELD_ORG("sample_time", u->sample_time) << SRS_JFIELD_CONT |
@@ -286,12 +299,14 @@ SrsGoApiSystemProcStats::~SrsGoApiSystemProcStats() | @@ -286,12 +299,14 @@ SrsGoApiSystemProcStats::~SrsGoApiSystemProcStats() | ||
286 | 299 | ||
287 | int SrsGoApiSystemProcStats::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | 300 | int SrsGoApiSystemProcStats::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) |
288 | { | 301 | { |
302 | + SrsStatistic* stat = SrsStatistic::instance(); | ||
289 | std::stringstream ss; | 303 | std::stringstream ss; |
290 | 304 | ||
291 | SrsProcSystemStat* s = srs_get_system_proc_stat(); | 305 | SrsProcSystemStat* s = srs_get_system_proc_stat(); |
292 | 306 | ||
293 | ss << SRS_JOBJECT_START | 307 | ss << SRS_JOBJECT_START |
294 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT | 308 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT |
309 | + << SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT | ||
295 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) | 310 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) |
296 | << SRS_JFIELD_ORG("ok", (s->ok? "true":"false")) << SRS_JFIELD_CONT | 311 | << SRS_JFIELD_ORG("ok", (s->ok? "true":"false")) << SRS_JFIELD_CONT |
297 | << SRS_JFIELD_ORG("sample_time", s->sample_time) << SRS_JFIELD_CONT | 312 | << SRS_JFIELD_ORG("sample_time", s->sample_time) << SRS_JFIELD_CONT |
@@ -321,12 +336,14 @@ SrsGoApiMemInfos::~SrsGoApiMemInfos() | @@ -321,12 +336,14 @@ SrsGoApiMemInfos::~SrsGoApiMemInfos() | ||
321 | 336 | ||
322 | int SrsGoApiMemInfos::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | 337 | int SrsGoApiMemInfos::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) |
323 | { | 338 | { |
339 | + SrsStatistic* stat = SrsStatistic::instance(); | ||
324 | std::stringstream ss; | 340 | std::stringstream ss; |
325 | 341 | ||
326 | SrsMemInfo* m = srs_get_meminfo(); | 342 | SrsMemInfo* m = srs_get_meminfo(); |
327 | 343 | ||
328 | ss << SRS_JOBJECT_START | 344 | ss << SRS_JOBJECT_START |
329 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT | 345 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT |
346 | + << SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT | ||
330 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) | 347 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) |
331 | << SRS_JFIELD_ORG("ok", (m->ok? "true":"false")) << SRS_JFIELD_CONT | 348 | << SRS_JFIELD_ORG("ok", (m->ok? "true":"false")) << SRS_JFIELD_CONT |
332 | << SRS_JFIELD_ORG("sample_time", m->sample_time) << SRS_JFIELD_CONT | 349 | << SRS_JFIELD_ORG("sample_time", m->sample_time) << SRS_JFIELD_CONT |
@@ -357,12 +374,16 @@ SrsGoApiAuthors::~SrsGoApiAuthors() | @@ -357,12 +374,16 @@ SrsGoApiAuthors::~SrsGoApiAuthors() | ||
357 | 374 | ||
358 | int SrsGoApiAuthors::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | 375 | int SrsGoApiAuthors::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) |
359 | { | 376 | { |
377 | + SrsStatistic* stat = SrsStatistic::instance(); | ||
360 | std::stringstream ss; | 378 | std::stringstream ss; |
361 | 379 | ||
362 | ss << SRS_JOBJECT_START | 380 | ss << SRS_JOBJECT_START |
363 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT | 381 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT |
382 | + << SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT | ||
364 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) | 383 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) |
365 | << SRS_JFIELD_STR("primary", RTMP_SIG_SRS_PRIMARY) << SRS_JFIELD_CONT | 384 | << SRS_JFIELD_STR("primary", RTMP_SIG_SRS_PRIMARY) << SRS_JFIELD_CONT |
385 | + << SRS_JFIELD_STR("license", RTMP_SIG_SRS_LICENSE) << SRS_JFIELD_CONT | ||
386 | + << SRS_JFIELD_STR("copyright", RTMP_SIG_SRS_COPYRIGHT) << SRS_JFIELD_CONT | ||
366 | << SRS_JFIELD_STR("authors", RTMP_SIG_SRS_AUTHROS) << SRS_JFIELD_CONT | 387 | << SRS_JFIELD_STR("authors", RTMP_SIG_SRS_AUTHROS) << SRS_JFIELD_CONT |
367 | << SRS_JFIELD_STR("contributors_link", RTMP_SIG_SRS_CONTRIBUTORS_URL) << SRS_JFIELD_CONT | 388 | << SRS_JFIELD_STR("contributors_link", RTMP_SIG_SRS_CONTRIBUTORS_URL) << SRS_JFIELD_CONT |
368 | << SRS_JFIELD_STR("contributors", SRS_AUTO_CONSTRIBUTORS) | 389 | << SRS_JFIELD_STR("contributors", SRS_AUTO_CONSTRIBUTORS) |
@@ -372,6 +393,132 @@ int SrsGoApiAuthors::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -372,6 +393,132 @@ int SrsGoApiAuthors::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
372 | return srs_http_response_json(w, ss.str()); | 393 | return srs_http_response_json(w, ss.str()); |
373 | } | 394 | } |
374 | 395 | ||
396 | +SrsGoApiFeatures::SrsGoApiFeatures() | ||
397 | +{ | ||
398 | +} | ||
399 | + | ||
400 | +SrsGoApiFeatures::~SrsGoApiFeatures() | ||
401 | +{ | ||
402 | +} | ||
403 | + | ||
404 | +int SrsGoApiFeatures::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
405 | +{ | ||
406 | + SrsStatistic* stat = SrsStatistic::instance(); | ||
407 | + std::stringstream ss; | ||
408 | + | ||
409 | +#ifdef SRS_AUTO_SSL | ||
410 | + bool ssl = true; | ||
411 | +#else | ||
412 | + bool ssl = false; | ||
413 | +#endif | ||
414 | +#ifdef SRS_AUTO_HLS | ||
415 | + bool hls = true; | ||
416 | +#else | ||
417 | + bool hls = false; | ||
418 | +#endif | ||
419 | +#ifdef SRS_AUTO_HDS | ||
420 | + bool hds = true; | ||
421 | +#else | ||
422 | + bool hds = false; | ||
423 | +#endif | ||
424 | +#ifdef SRS_AUTO_HTTP_CALLBACK | ||
425 | + bool callback = true; | ||
426 | +#else | ||
427 | + bool callback = false; | ||
428 | +#endif | ||
429 | +#ifdef SRS_AUTO_HTTP_API | ||
430 | + bool api = true; | ||
431 | +#else | ||
432 | + bool api = false; | ||
433 | +#endif | ||
434 | +#ifdef SRS_AUTO_HTTP_SERVER | ||
435 | + bool httpd = true; | ||
436 | +#else | ||
437 | + bool httpd = false; | ||
438 | +#endif | ||
439 | +#ifdef SRS_AUTO_DVR | ||
440 | + bool dvr = true; | ||
441 | +#else | ||
442 | + bool dvr = false; | ||
443 | +#endif | ||
444 | +#ifdef SRS_AUTO_TRANSCODE | ||
445 | + bool transcode = true; | ||
446 | +#else | ||
447 | + bool transcode = false; | ||
448 | +#endif | ||
449 | +#ifdef SRS_AUTO_INGEST | ||
450 | + bool ingest = true; | ||
451 | +#else | ||
452 | + bool ingest = false; | ||
453 | +#endif | ||
454 | +#ifdef SRS_AUTO_STAT | ||
455 | + bool _stat = true; | ||
456 | +#else | ||
457 | + bool _stat = false; | ||
458 | +#endif | ||
459 | +#ifdef SRS_AUTO_NGINX | ||
460 | + bool nginx = true; | ||
461 | +#else | ||
462 | + bool nginx = false; | ||
463 | +#endif | ||
464 | +#ifdef SRS_AUTO_FFMPEG_TOOL | ||
465 | + bool ffmpeg = true; | ||
466 | +#else | ||
467 | + bool ffmpeg = false; | ||
468 | +#endif | ||
469 | +#ifdef SRS_AUTO_STREAM_CASTER | ||
470 | + bool caster = true; | ||
471 | +#else | ||
472 | + bool caster = false; | ||
473 | +#endif | ||
474 | +#ifdef SRS_PERF_COMPLEX_SEND | ||
475 | + bool complex_send = true; | ||
476 | +#else | ||
477 | + bool complex_send = false; | ||
478 | +#endif | ||
479 | +#ifdef SRS_PERF_TCP_NODELAY | ||
480 | + bool tcp_nodelay = true; | ||
481 | +#else | ||
482 | + bool tcp_nodelay = false; | ||
483 | +#endif | ||
484 | +#ifdef SRS_PERF_SO_SNDBUF_SIZE | ||
485 | + bool so_sendbuf = true; | ||
486 | +#else | ||
487 | + bool so_sendbuf = false; | ||
488 | +#endif | ||
489 | +#ifdef SRS_PERF_MERGED_READ | ||
490 | + bool mr = true; | ||
491 | +#else | ||
492 | + bool mr = false; | ||
493 | +#endif | ||
494 | + | ||
495 | + ss << SRS_JOBJECT_START | ||
496 | + << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT | ||
497 | + << SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT | ||
498 | + << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) | ||
499 | + << SRS_JFIELD_BOOL("ssl", ssl) << SRS_JFIELD_CONT | ||
500 | + << SRS_JFIELD_BOOL("hls", hls) << SRS_JFIELD_CONT | ||
501 | + << SRS_JFIELD_BOOL("hds", hds) << SRS_JFIELD_CONT | ||
502 | + << SRS_JFIELD_BOOL("callback", callback) << SRS_JFIELD_CONT | ||
503 | + << SRS_JFIELD_BOOL("api", api) << SRS_JFIELD_CONT | ||
504 | + << SRS_JFIELD_BOOL("httpd", httpd) << SRS_JFIELD_CONT | ||
505 | + << SRS_JFIELD_BOOL("dvr", dvr) << SRS_JFIELD_CONT | ||
506 | + << SRS_JFIELD_BOOL("transcode", transcode) << SRS_JFIELD_CONT | ||
507 | + << SRS_JFIELD_BOOL("ingest", ingest) << SRS_JFIELD_CONT | ||
508 | + << SRS_JFIELD_BOOL("stat", _stat) << SRS_JFIELD_CONT | ||
509 | + << SRS_JFIELD_BOOL("nginx", nginx) << SRS_JFIELD_CONT | ||
510 | + << SRS_JFIELD_BOOL("ffmpeg", ffmpeg) << SRS_JFIELD_CONT | ||
511 | + << SRS_JFIELD_BOOL("stream_caster", caster) << SRS_JFIELD_CONT | ||
512 | + << SRS_JFIELD_BOOL("complex_send", complex_send) << SRS_JFIELD_CONT | ||
513 | + << SRS_JFIELD_BOOL("tcp_nodelay", tcp_nodelay) << SRS_JFIELD_CONT | ||
514 | + << SRS_JFIELD_BOOL("so_sendbuf", so_sendbuf) << SRS_JFIELD_CONT | ||
515 | + << SRS_JFIELD_BOOL("mr", mr) | ||
516 | + << SRS_JOBJECT_END | ||
517 | + << SRS_JOBJECT_END; | ||
518 | + | ||
519 | + return srs_http_response_json(w, ss.str()); | ||
520 | +} | ||
521 | + | ||
375 | SrsGoApiRequests::SrsGoApiRequests() | 522 | SrsGoApiRequests::SrsGoApiRequests() |
376 | { | 523 | { |
377 | } | 524 | } |
@@ -384,10 +531,12 @@ int SrsGoApiRequests::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | @@ -384,10 +531,12 @@ int SrsGoApiRequests::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r) | ||
384 | { | 531 | { |
385 | ISrsHttpMessage* req = r; | 532 | ISrsHttpMessage* req = r; |
386 | 533 | ||
534 | + SrsStatistic* stat = SrsStatistic::instance(); | ||
387 | std::stringstream ss; | 535 | std::stringstream ss; |
388 | 536 | ||
389 | ss << SRS_JOBJECT_START | 537 | ss << SRS_JOBJECT_START |
390 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT | 538 | << SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT |
539 | + << SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT | ||
391 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) | 540 | << SRS_JFIELD_ORG("data", SRS_JOBJECT_START) |
392 | << SRS_JFIELD_STR("uri", req->uri()) << SRS_JFIELD_CONT | 541 | << SRS_JFIELD_STR("uri", req->uri()) << SRS_JFIELD_CONT |
393 | << SRS_JFIELD_STR("path", req->path()) << SRS_JFIELD_CONT; | 542 | << SRS_JFIELD_STR("path", req->path()) << SRS_JFIELD_CONT; |
@@ -132,6 +132,15 @@ public: | @@ -132,6 +132,15 @@ public: | ||
132 | virtual int serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r); | 132 | virtual int serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r); |
133 | }; | 133 | }; |
134 | 134 | ||
135 | +class SrsGoApiFeatures : public ISrsHttpHandler | ||
136 | +{ | ||
137 | +public: | ||
138 | + SrsGoApiFeatures(); | ||
139 | + virtual ~SrsGoApiFeatures(); | ||
140 | +public: | ||
141 | + virtual int serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r); | ||
142 | +}; | ||
143 | + | ||
135 | class SrsGoApiRequests : public ISrsHttpHandler | 144 | class SrsGoApiRequests : public ISrsHttpHandler |
136 | { | 145 | { |
137 | public: | 146 | public: |
@@ -800,6 +800,9 @@ int SrsServer::http_handle() | @@ -800,6 +800,9 @@ int SrsServer::http_handle() | ||
800 | if ((ret = http_api_mux->handle("/api/v1/authors", new SrsGoApiAuthors())) != ERROR_SUCCESS) { | 800 | if ((ret = http_api_mux->handle("/api/v1/authors", new SrsGoApiAuthors())) != ERROR_SUCCESS) { |
801 | return ret; | 801 | return ret; |
802 | } | 802 | } |
803 | + if ((ret = http_api_mux->handle("/api/v1/features", new SrsGoApiFeatures())) != ERROR_SUCCESS) { | ||
804 | + return ret; | ||
805 | + } | ||
803 | if ((ret = http_api_mux->handle("/api/v1/vhosts/", new SrsGoApiVhosts())) != ERROR_SUCCESS) { | 806 | if ((ret = http_api_mux->handle("/api/v1/vhosts/", new SrsGoApiVhosts())) != ERROR_SUCCESS) { |
804 | return ret; | 807 | return ret; |
805 | } | 808 | } |
-
请 注册 或 登录 后发表评论