ZaStoGram_desktop/Telegram/SourceFiles/mtproto/runtime/proxy_data.h
loop-uh 0e40e4b8a9 Merge upstream tdesktop a8de5f928b (v7.3.4 + 51: Update brotli to 1.2.1)
Ручное слияние для Windows-клиента: оригинал в dev не попадал с v7.3.1, так как
синхронизация v7.3.2-v7.3.4 встала на конфликте lib_ui. Таймер upstream-sync на
время слияния остановлен.

- lib_ui: форк 7e5d8bc (слияние с оригиналом 1ff7be7).
- Версия 7.3.4 без бета-признака: BetaChannel 0, AppBetaVersion false.
- mtproto: «плохая конфигурация прокси» теперь учитывает прокси (колбэк рантайма,
  делегат сессии, соединение); правки session_private перенесены в
  mtproto/session/private/* (лимиты длины, пустые RPC-ответы, DEBUG_LOG дампов).
- update_checker: ограничение размера ответа и отключение HTTP/2 оригинала поверх
  гонки зеркал форка.
- thanos_effect_renderer: версия оригинала (R32F вместо RGBA32F); проверка
  возможностей — по compute.
- download_manager_mtproto: проверка слишком большой части оригинала.
- prepare.py: патчи qtsvg и Windows 7 оригинала вместе с patches_extra форка.
- Файлы .agents/.claude/.github, удалённые форком, остаются удалёнными.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 16:07:40 -05:00

142 lines
3.1 KiB
C++

/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#include "base/bytes.h"
#include "base/basic_types.h"
#include <QtCore/QString>
#include <vector>
namespace MTP {
struct ProxyData {
enum class Settings {
System,
Enabled,
Disabled,
};
enum class Type {
None,
Socks5,
Http,
Mtproto,
Web,
};
enum class Status {
Valid,
Unsupported,
IncorrectSecret,
Invalid,
};
Type type = Type::None;
QString host;
uint32 port = 0;
QString user, password;
QString originalHost;
std::vector<QString> resolvedIPs;
crl::time resolvedExpireAt = 0;
// A WEB proxy address is a hostname with an optional base path, like
// `proxy.example.com` or `proxy.example.com/my-super-app`, so that a
// production site can keep serving everything outside that prefix. The
// path lives in the otherwise unused `user` field: that keeps the
// serialized proxy format unchanged and makes a client without this
// feature reject the entry instead of silently using the host root.
[[nodiscard]] QString webAddress() const;
void setWebAddress(const QString &value);
[[nodiscard]] QString webBasePath() const;
[[nodiscard]] bool valid() const;
[[nodiscard]] Status status() const;
[[nodiscard]] bool supportsCalls() const;
[[nodiscard]] bool tryCustomResolve() const;
[[nodiscard]] bytes::vector secretFromMtprotoPassword() const;
[[nodiscard]] explicit operator bool() const;
[[nodiscard]] bool operator==(const ProxyData &other) const;
[[nodiscard]] bool operator!=(const ProxyData &other) const;
[[nodiscard]] static Status MtprotoPasswordStatus(
const QString &password);
};
enum class ProxyTlsProfile {
Auto,
Firefox,
AndroidChrome,
Yandex,
FirefoxAndroid,
AndroidOkHttp,
AutoRotate,
ChromeModern,
};
enum class ProxyClientHelloFragmentation {
Off,
Soft,
};
enum class ProxyConnectionPattern {
Off,
Soft,
Quiet,
Strict,
Browser,
};
enum class ProxyRecordSizing {
Off,
Conservative,
Varied,
};
enum class ProxyTiming {
Off,
Gentle,
Balanced,
};
enum class ProxyStartupCover {
Off,
Soft,
Strict,
};
enum class ProxyTransport {
Tcp,
Wss,
};
enum class ProxyStealthLevel {
CompatStrict,
CompatModern,
DpiAdaptiveHandshake,
DpiAdaptiveData,
Experimental,
};
struct ProxyStealthOptions {
ProxyStealthLevel level = ProxyStealthLevel::DpiAdaptiveData;
ProxyTlsProfile tlsProfile = ProxyTlsProfile::Auto;
ProxyClientHelloFragmentation clientHelloFragmentation
= ProxyClientHelloFragmentation::Off;
ProxyConnectionPattern connectionPattern = ProxyConnectionPattern::Browser;
ProxyRecordSizing recordSizing = ProxyRecordSizing::Off;
ProxyTiming timing = ProxyTiming::Off;
ProxyStartupCover startupCover = ProxyStartupCover::Off;
bool syntheticPsk = false;
ProxyTransport transport = ProxyTransport::Wss;
QString wssCustomHost;
int wssCustomPort = 443;
QString wssCustomPath;
QString wssCustomDomain;
friend bool operator==(
const ProxyStealthOptions &,
const ProxyStealthOptions &) = default;
};
} // namespace MTP