Add TransportType.h.
GitOrigin-RevId: 403b10f5dcc161be411710749c70734cf9a4fc62
This commit is contained in:
parent
7542612098
commit
b9fc33b7d1
@ -453,6 +453,7 @@ set(TDLIB_SOURCE
|
||||
td/mtproto/SessionConnection.h
|
||||
td/mtproto/TcpTransport.h
|
||||
td/mtproto/Transport.h
|
||||
td/mtproto/TransportType.h
|
||||
td/mtproto/utils.h
|
||||
|
||||
td/telegram/AccessRights.h
|
||||
|
@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "td/mtproto/IStreamTransport.h"
|
||||
#include "td/mtproto/TransportType.h"
|
||||
|
||||
#include "td/net/HttpQuery.h"
|
||||
#include "td/net/HttpReader.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
namespace td {
|
||||
namespace mtproto {
|
||||
|
||||
unique_ptr<IStreamTransport> create_transport(TransportType type) {
|
||||
switch (type.type) {
|
||||
case TransportType::ObfuscatedTcp:
|
||||
@ -24,5 +25,6 @@ unique_ptr<IStreamTransport> create_transport(TransportType type) {
|
||||
}
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
} // namespace mtproto
|
||||
} // namespace td
|
||||
|
@ -6,6 +6,8 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/mtproto/TransportType.h"
|
||||
|
||||
#include "td/utils/buffer.h"
|
||||
#include "td/utils/port/detail/PollableFd.h"
|
||||
#include "td/utils/Status.h"
|
||||
@ -13,17 +15,6 @@
|
||||
namespace td {
|
||||
namespace mtproto {
|
||||
|
||||
struct TransportType {
|
||||
enum Type { Tcp, ObfuscatedTcp, Http } type;
|
||||
int16 dc_id;
|
||||
string secret;
|
||||
|
||||
TransportType() : type(Tcp), dc_id(0), secret() {
|
||||
}
|
||||
TransportType(Type type, int16 dc_id, string secret) : type(type), dc_id(dc_id), secret(std::move(secret)) {
|
||||
}
|
||||
};
|
||||
|
||||
class IStreamTransport {
|
||||
public:
|
||||
IStreamTransport() = default;
|
||||
|
@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "td/mtproto/IStreamTransport.h"
|
||||
#include "td/mtproto/TransportType.h"
|
||||
|
||||
#include "td/utils/buffer.h"
|
||||
#include "td/utils/BufferedFd.h"
|
||||
|
26
td/mtproto/TransportType.h
Normal file
26
td/mtproto/TransportType.h
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2019
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/utils/common.h"
|
||||
|
||||
namespace td {
|
||||
namespace mtproto {
|
||||
|
||||
struct TransportType {
|
||||
enum Type { Tcp, ObfuscatedTcp, Http } type;
|
||||
int16 dc_id;
|
||||
string secret;
|
||||
|
||||
TransportType() : type(Tcp), dc_id(0), secret() {
|
||||
}
|
||||
TransportType(Type type, int16 dc_id, string secret) : type(type), dc_id(dc_id), secret(std::move(secret)) {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mtproto
|
||||
} // namespace td
|
@ -19,7 +19,6 @@
|
||||
#include "td/telegram/StateManager.h"
|
||||
#include "td/telegram/TdDb.h"
|
||||
|
||||
#include "td/mtproto/IStreamTransport.h"
|
||||
#include "td/mtproto/PingConnection.h"
|
||||
#include "td/mtproto/RawConnection.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "td/telegram/net/NetQuery.h"
|
||||
#include "td/telegram/StateManager.h"
|
||||
|
||||
#include "td/mtproto/IStreamTransport.h"
|
||||
#include "td/mtproto/TransportType.h"
|
||||
|
||||
#include "td/actor/actor.h"
|
||||
#include "td/actor/PromiseFuture.h"
|
||||
|
@ -20,9 +20,9 @@
|
||||
#include "td/mtproto/crypto.h"
|
||||
#include "td/mtproto/Handshake.h"
|
||||
#include "td/mtproto/HandshakeActor.h"
|
||||
#include "td/mtproto/IStreamTransport.h"
|
||||
#include "td/mtproto/RawConnection.h"
|
||||
#include "td/mtproto/SessionConnection.h"
|
||||
#include "td/mtproto/TransportType.h"
|
||||
|
||||
#include "td/utils/format.h"
|
||||
#include "td/utils/logging.h"
|
||||
|
@ -12,10 +12,10 @@
|
||||
#include "td/mtproto/crypto.h"
|
||||
#include "td/mtproto/Handshake.h"
|
||||
#include "td/mtproto/HandshakeActor.h"
|
||||
#include "td/mtproto/IStreamTransport.h"
|
||||
#include "td/mtproto/PingConnection.h"
|
||||
#include "td/mtproto/RawConnection.h"
|
||||
#include "td/mtproto/Transport.h"
|
||||
#include "td/mtproto/TransportType.h"
|
||||
|
||||
#include "td/net/GetHostByNameActor.h"
|
||||
#include "td/net/Socks5.h"
|
||||
|
Loading…
Reference in New Issue
Block a user