example/client has "-n" option to not use STUN server

This commit is contained in:
ecotarobles
2020-09-25 16:25:26 +03:00
parent a99efd27d2
commit 7348b2b350
4 changed files with 29 additions and 18 deletions

View File

@ -67,12 +67,16 @@ int main(int argc, char **argv) {
Configuration config;
string stunServer = "";
if (params->stunServer().substr(0,5).compare("stun:") != 0) {
stunServer = "stun:";
if (params->noStun()) {
cout << "No stun server is configured. Only local hosts and public IP addresses suported." << endl;
} else {
if (params->stunServer().substr(0,5).compare("stun:") != 0) {
stunServer = "stun:";
}
stunServer += params->stunServer() + ":" + to_string(params->stunPort());
cout << "Stun server is " << stunServer << endl;
config.iceServers.emplace_back(stunServer);
}
stunServer += params->stunServer() + ":" + to_string(params->stunPort());
cout << "Stun server is " << stunServer << endl;
config.iceServers.emplace_back(stunServer);
localId = randomId(4);
cout << "The local ID is: " << localId << endl;