Turn server added
This commit is contained in:
parent
bd6c10631d
commit
aac162d9c5
2 changed files with 11 additions and 0 deletions
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,11 +46,14 @@ void NetLibrary::init() {
|
|||
j.at("signalingServer").get_to<std::string>(signalingAddr);
|
||||
|
||||
std::vector<std::string> stunList = j.at("stunList").get<std::vector<std::string>>();
|
||||
std::vector<nlohmann::json> 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<std::string>(), turnServer["port"].get<uint16_t>(), turnServer["username"].get<std::string>(), turnServer["credential"].get<std::string>());
|
||||
}
|
||||
catch(...) {
|
||||
throw std::runtime_error("[NetLibrary::init] Invalid config/p2p.json");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue