1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Heartbeat: Report ports for proxy server. v5.0.215 v6.0.156 v7.0.15 (#4171)

The heartbeat of SRS is a timer that requests an HTTP URL. We can use
this heartbeat to report the necessary information for registering the
backend server with the proxy server.

```text
SRS(backend) --heartbeat---> Proxy server
```

A proxy server is a specialized load balancer for media servers. It
operates at the application level rather than the TCP level. For more
information about the proxy server, see issue #4158.

Note that we will merge this PR into SRS 5.0+, allowing the use of SRS
5.0+ as the backend server, not limited to SRS 7.0. However, the proxy
server is introduced in SRS 7.0.

It's also possible to implement a registration service, allowing you to
use other media servers as backend servers. For example, if you gather
information about an nginx-rtmp server and register it with the proxy
server, the proxy will forward RTMP streams to nginx-rtmp. The backend
server is not limited to SRS.

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
This commit is contained in:
Winlin 2024-09-09 10:37:41 +08:00 committed by GitHub
parent d70e7357cf
commit b475d552aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 110 additions and 14 deletions

View file

@ -2409,7 +2409,7 @@ srs_error_t SrsConfig::check_normal_config()
for (int i = 0; conf && i < (int)conf->directives.size(); i++) {
string n = conf->at(i)->name;
if (n != "enabled" && n != "interval" && n != "url"
&& n != "device_id" && n != "summaries") {
&& n != "device_id" && n != "summaries" && n != "ports") {
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal heartbeat.%s", n.c_str());
}
}
@ -8794,17 +8794,36 @@ bool SrsConfig::get_heartbeat_summaries()
SRS_OVERWRITE_BY_ENV_BOOL("srs.heartbeat.summaries"); // SRS_HEARTBEAT_SUMMARIES
static bool DEFAULT = false;
SrsConfDirective* conf = get_heartbeart();
if (!conf) {
return DEFAULT;
}
conf = conf->get("summaries");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return SRS_CONF_PREFER_FALSE(conf->arg0());
}
bool SrsConfig::get_heartbeat_ports()
{
SRS_OVERWRITE_BY_ENV_BOOL("srs.heartbeat.ports"); // SRS_HEARTBEAT_PORTS
static bool DEFAULT = false;
SrsConfDirective* conf = get_heartbeart();
if (!conf) {
return DEFAULT;
}
conf = conf->get("ports");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return SRS_CONF_PREFER_FALSE(conf->arg0());
}