2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Check proxy availability in ProxiesBox.

This commit is contained in:
John Preston
2018-04-30 19:49:03 +04:00
parent 9935a36c3d
commit f794d8dbd8
15 changed files with 195 additions and 36 deletions

View File

@@ -268,6 +268,22 @@ bool ProxyData::ValidSecret(const QString &secret) {
return QRegularExpression("^[a-fA-F0-9]{32}$").match(secret).hasMatch();
}
QNetworkProxy ToNetworkProxy(const ProxyData &proxy) {
Expects(proxy.type != ProxyData::Type::Mtproto);
if (proxy.type == ProxyData::Type::None) {
return QNetworkProxy::NoProxy;
}
return QNetworkProxy(
(proxy.type == ProxyData::Type::Socks5
? QNetworkProxy::Socks5Proxy
: QNetworkProxy::HttpProxy),
proxy.host,
proxy.port,
proxy.user,
proxy.password);
}
namespace ThirdParty {
void start() {

View File

@@ -442,6 +442,8 @@ struct ProxyData {
};
QNetworkProxy ToNetworkProxy(const ProxyData &proxy);
enum DBIScale {
dbisAuto = 0,
dbisOne = 1,