diff --git a/data/config/p2p.json b/data/config/p2p.json index 06fc357..c2ca563 100644 --- a/data/config/p2p.json +++ b/data/config/p2p.json @@ -6,5 +6,13 @@ "stun2.l.google.com:19302", "stun3.l.google.com:19302", "stun4.l.google.com:19302" + ], + "turnList": [ + { + "url": "turn.infinipaint.com", + "port": 3478, + "username": "infinipaint", + "credential": "infinipaintpassword" + } ] } diff --git a/include/Helpers/Networking/NetLibrary.cpp b/include/Helpers/Networking/NetLibrary.cpp index 48bbab8..e2a185c 100644 --- a/include/Helpers/Networking/NetLibrary.cpp +++ b/include/Helpers/Networking/NetLibrary.cpp @@ -46,11 +46,14 @@ void NetLibrary::init() { j.at("signalingServer").get_to(signalingAddr); std::vector stunList = j.at("stunList").get>(); + std::vector turnList = j.at("turnList"); for(std::string& s : stunList) { if(s.substr(0, 5).compare("stun:")) s.insert(0, "stun:"); config.iceServers.emplace_back(s); } + for(const nlohmann::json& turnServer : turnList) + config.iceServers.emplace_back(turnServer["url"].get(), turnServer["port"].get(), turnServer["username"].get(), turnServer["credential"].get()); } catch(...) { throw std::runtime_error("[NetLibrary::init] Invalid config/p2p.json");