Some small bug fixes

This commit is contained in:
WolverinDEV 2021-03-07 21:25:55 +01:00
parent f213b199fc
commit 92a3faaed7
7 changed files with 36 additions and 12 deletions

@ -1 +1 @@
Subproject commit 883a2f1433576c75d5731d80681886795fb5c41b Subproject commit d0babbc62fb657783a04737a1265ab1c36636bf6

2
rtclib

@ -1 +1 @@
Subproject commit 06262edcdbfedc0836fe70fb21c90b384898d22b Subproject commit cdf42fccd34c769fabfef7208f829c3f4b62a595

View File

@ -217,7 +217,7 @@ target_link_libraries(PermMapHelper
SET(CPACK_PACKAGE_VERSION_MAJOR "1") SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "5") SET(CPACK_PACKAGE_VERSION_MINOR "5")
SET(CPACK_PACKAGE_VERSION_PATCH "1") SET(CPACK_PACKAGE_VERSION_PATCH "2")
if (BUILD_TYPE_NAME EQUAL OFF) if (BUILD_TYPE_NAME EQUAL OFF)
SET(CPACK_PACKAGE_VERSION_DATA "beta") SET(CPACK_PACKAGE_VERSION_DATA "beta")
elseif (BUILD_TYPE_NAME STREQUAL "") elseif (BUILD_TYPE_NAME STREQUAL "")

View File

@ -348,7 +348,7 @@ void read_bindings(YAML::Node& root, const std::deque<std::shared_ptr<EntryBindi
inline string apply_comments(stringstream &in, map<string, deque<string>>& comments); inline string apply_comments(stringstream &in, map<string, deque<string>>& comments);
std::deque<std::shared_ptr<EntryBinding>> create_local_bindings(int& version, std::string& license); std::deque<std::shared_ptr<EntryBinding>> create_local_bindings(int& version, std::string& license);
#define CURRENT_CONFIG_VERSION 15 #define CURRENT_CONFIG_VERSION 16
static std::string _config_path; static std::string _config_path;
vector<string> config::parseConfig(const std::string& path) { vector<string> config::parseConfig(const std::string& path) {
_config_path = path; _config_path = path;
@ -463,6 +463,13 @@ vector<string> config::parseConfig(const std::string& path) {
nodes_key = "2"; nodes_key = "2";
} }
} }
case 15: {
auto nodes_key = resolveNode(config, "web.webrtc.stun.ip").back();
if(nodes_key.IsDefined() && nodes_key.as<std::string>() == "127.0.0.1") {
nodes_key.reset();
resolveNode(config, "web.webrtc.stun.enabled").back() = "1";
}
}
default: default:
break; break;
} }
@ -1542,16 +1549,14 @@ std::deque<std::shared_ptr<EntryBinding>> config::create_bindings() {
} }
{ {
CREATE_BINDING("webrtc.stun.enabled", 0); CREATE_BINDING("webrtc.stun.enabled", 0);
BIND_INTEGRAL(config::web::stun_enabled, false, false, true); BIND_INTEGRAL(config::web::stun_enabled, true, false, true);
ADD_DESCRIPTION("Whatever to use a STUN server"); ADD_DESCRIPTION("Whatever to use a STUN server");
ADD_NOTE_RELOADABLE(); ADD_NOTE_RELOADABLE();
} }
{ {
CREATE_BINDING("webrtc.stun.ip", 0); CREATE_BINDING("webrtc.stun.host", 0);
BIND_STRING(config::web::stun_host, "127.0.0.1"); BIND_STRING(config::web::stun_host, "stun.l.google.com");
ADD_DESCRIPTION("The address of the stun server to use."); ADD_DESCRIPTION("The address of the stun server to use.");
ADD_DESCRIPTION("Attention: This must be an IP address!");
ADD_DESCRIPTION("Example whise you could use the resolved IP address of 'stun.l.google.com' as the stun server address.");
ADD_NOTE_RELOADABLE(); ADD_NOTE_RELOADABLE();
} }
{ {

View File

@ -119,8 +119,6 @@ void ConnectedClient::updateChannelClientProperties(bool lock_channel_tree, bool
permission::b_client_ignore_antiflood, permission::b_client_ignore_antiflood,
permission::i_channel_view_power, permission::i_channel_view_power,
permission::b_channel_ignore_view_power, permission::b_channel_ignore_view_power,
permission::i_icon_id,
permission::b_client_is_priority_speaker,
}, channel ? channel->channelId() : 0); }, channel ? channel->channelId() : 0);
permission::v2::PermissionFlaggedValue permission::v2::PermissionFlaggedValue

View File

@ -79,6 +79,27 @@ uint32_t librtc_callback_rtc_configure(const void* callback_data_ptr, void* conf
options.max_port = config::web::webrtc_port_max; options.max_port = config::web::webrtc_port_max;
std::string stun_host{config::web::stun_host}; std::string stun_host{config::web::stun_host};
if(!net::is_ipv4(stun_host) && !net::is_ipv6(stun_host)) {
auto timestamp_begin = std::chrono::system_clock::now();
auto result = gethostbyname(stun_host.c_str());
auto timestamp_end = std::chrono::system_clock::now();
if(!result) {
logError(target_client->getServerId(), "{} Failed to resolve stun hostname {}: {}", target_client->getLoggingPrefix(), stun_host, strerror(errno));
return 1;
}
auto addresses = (struct in_addr **) result->h_addr_list;
if(!*addresses) {
logError(target_client->getServerId(), "{} Failed to resolve stun hostname {}: Empty result", target_client->getLoggingPrefix(), stun_host);
return 1;
}
stun_host = inet_ntoa(**addresses);
logTrace(target_client->getServerId(), "{} Resolved stun host {} to {} within {}ms", target_client->getLoggingPrefix(), config::web::stun_host, stun_host,
std::chrono::duration_cast<std::chrono::milliseconds>(timestamp_end - timestamp_begin).count()
);
}
options.stun_host = stun_host.c_str(); options.stun_host = stun_host.c_str();
options.stun_port = config::web::stun_port; options.stun_port = config::web::stun_port;
if(!config::web::stun_enabled) { if(!config::web::stun_enabled) {

2
shared

@ -1 +1 @@
Subproject commit 26981b95f70ed4418be0a0e1720eaa7c7fc0a76a Subproject commit eef0144e77ee87fc7fe275beb743bd85e6e37f19