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

For #307: WebRTC: Support use domain name as CANDIDATE. v4.0.259

This commit is contained in:
winlin 2022-09-02 09:46:58 +08:00
parent 88ba3d25f8
commit 4a225c5640
6 changed files with 116 additions and 44 deletions

View file

@ -2545,7 +2545,8 @@ srs_error_t SrsConfig::check_normal_config()
string n = conf->at(i)->name;
if (n != "enabled" && n != "listen" && n != "dir" && n != "candidate" && n != "ecdsa"
&& n != "encrypt" && n != "reuseport" && n != "merge_nalus" && n != "black_hole"
&& n != "ip_family" && n != "api_as_candidates") {
&& n != "ip_family" && n != "api_as_candidates" && n != "resolve_api_domain"
&& n != "keep_api_domain" && n != "use_auto_detect_network_ip") {
return srs_error_new(ERROR_SYSTEM_CONFIG_INVALID, "illegal rtc_server.%s", n.c_str());
}
}
@ -3662,6 +3663,57 @@ bool SrsConfig::get_api_as_candidates()
return SRS_CONF_PERFER_TRUE(conf->arg0());
}
bool SrsConfig::get_resolve_api_domain()
{
static bool DEFAULT = true;
SrsConfDirective* conf = root->get("rtc_server");
if (!conf) {
return DEFAULT;
}
conf = conf->get("resolve_api_domain");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return SRS_CONF_PERFER_TRUE(conf->arg0());
}
bool SrsConfig::get_keep_api_domain()
{
static bool DEFAULT = false;
SrsConfDirective* conf = root->get("rtc_server");
if (!conf) {
return DEFAULT;
}
conf = conf->get("keep_api_domain");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return SRS_CONF_PERFER_FALSE(conf->arg0());
}
bool SrsConfig::get_use_auto_detect_network_ip()
{
static bool DEFAULT = true;
SrsConfDirective* conf = root->get("rtc_server");
if (!conf) {
return DEFAULT;
}
conf = conf->get("use_auto_detect_network_ip");
if (!conf || conf->arg0().empty()) {
return DEFAULT;
}
return SRS_CONF_PERFER_TRUE(conf->arg0());
}
std::string SrsConfig::get_rtc_server_ip_family()
{
static string DEFAULT = "ipv4";