All checks were successful
Desktop source guards / guards (push) Successful in 5s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
47 lines
1.9 KiB
C++
47 lines
1.9 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 <QtCore/QString>
|
|
#include <QtNetwork/QNetworkProxy>
|
|
|
|
#include <optional>
|
|
|
|
namespace Zsg::Warp {
|
|
|
|
// Cloudflare WARP as an optional ENTRY hop: with the setting on, the first hop
|
|
// of every connection (direct MTProto, MTProxy, WSS, Naive, the update check)
|
|
// goes through a loopback SOCKS5 listener of the zsgnaive library, whose bytes
|
|
// travel through a WireGuard tunnel to WARP. It is never an exit and never an
|
|
// entry in the proxy list. Off by default; a dead tunnel falls back to a direct
|
|
// first hop. State lives in tdata/zsg/warp.json.
|
|
|
|
// Reads the saved setting and starts the tunnel when it is on. Main thread,
|
|
// once, after the working directory is known.
|
|
void Init();
|
|
|
|
[[nodiscard]] bool Enabled();
|
|
// Saves the setting; turning it on registers an account on first use.
|
|
void SetEnabled(bool enabled);
|
|
|
|
// One line for the settings box: off / registering / connecting / up through
|
|
// WireGuard or MASQUE / no answer. Main thread.
|
|
[[nodiscard]] QString StatusText();
|
|
|
|
// The endpoint scanner (like awg-manager's): while WireGuard gets no answer the engine probes many Cloudflare edges and
|
|
// UDP ports side by side and moves to the first one that carries a packet back. It starts by itself after 3 s of silence;
|
|
// this starts it now. False when the tunnel is not running through WireGuard or is already up.
|
|
bool ScanNow();
|
|
// One line about the scanner for the settings box: idle / scanning N of M, found K / nothing found.
|
|
[[nodiscard]] QString ScanText();
|
|
|
|
// The SOCKS5 proxy of the running tunnel, or nothing (setting off, tunnel not
|
|
// up yet, library without WARP). Any thread.
|
|
[[nodiscard]] std::optional<QNetworkProxy> EntryProxy();
|
|
|
|
} // namespace Zsg::Warp
|