Support TCP reflectors.

This commit is contained in:
levlam 2022-05-07 11:42:48 +03:00
parent 0a280c5b0d
commit 412404a721
3 changed files with 5 additions and 3 deletions

View File

@ -2326,8 +2326,8 @@ callProtocol udp_p2p:Bool udp_reflector:Bool min_layer:int32 max_layer:int32 lib
//@class CallServerType @description Describes the type of a call server
//@description A Telegram call reflector @peer_tag A peer tag to be used with the reflector
callServerTypeTelegramReflector peer_tag:bytes = CallServerType;
//@description A Telegram call reflector @peer_tag A peer tag to be used with the reflector @is_tcp True, if the server uses TCP instead of UDP
callServerTypeTelegramReflector peer_tag:bytes is_tcp:Bool = CallServerType;
//@description A WebRTC server @username Username to be used for authentication @password Authentication password @supports_turn True, if the server supports TURN @supports_stun True, if the server supports STUN
callServerTypeWebrtc username:string password:string supports_turn:Bool supports_stun:Bool = CallServerType;

View File

@ -74,6 +74,7 @@ CallConnection::CallConnection(const telegram_api::PhoneConnection &connection)
ipv6 = conn.ipv6_;
port = conn.port_;
peer_tag = conn.peer_tag_.as_slice().str();
is_tcp = conn.tcp_;
break;
}
case telegram_api::phoneConnectionWebrtc::ID: {
@ -103,7 +104,7 @@ tl_object_ptr<td_api::callServer> CallConnection::get_call_server_object() const
auto server_type = [&]() -> tl_object_ptr<td_api::CallServerType> {
switch (type) {
case Type::Telegram:
return make_tl_object<td_api::callServerTypeTelegramReflector>(peer_tag);
return make_tl_object<td_api::callServerTypeTelegramReflector>(peer_tag, is_tcp);
case Type::Webrtc:
return make_tl_object<td_api::callServerTypeWebrtc>(username, password, supports_turn, supports_stun);
default:

View File

@ -55,6 +55,7 @@ struct CallConnection {
// Telegram
string peer_tag;
bool is_tcp = false;
// WebRTC
string username;