mirror of
https://github.com/outbackdingo/amnezia-client.git
synced 2026-01-27 02:18:09 +00:00
* There's a common issue of building iOS apps on Qt 6.8 because of new introduced ffmpeg dependency in multimedia Qt package ref: https://community.esri.com/t5/qt-maps-sdk-questions/build-failure-on-ios-with-qt-6-8/m-p/1548701#M5339 * Cmake related changes * Source code changes * Various entitlements * Ci-cd config update * Resources changes * Submodules updated * Remove me * QtWidget exclusion omitted * Distribution errors fixed * Outdated files deleted * macos_ne cmake fixed * fix: update provisioning profile specifiers for macOS network extension * fix: update provisioning profile specifiers and code sign flags for macOS build * Revert me (temporary 3rd-build commit pointer) * fix: Welcome screen fix * fix: ci/cd hanging forever fix * fix: Fixed error popup on macos on file save * refactor: rename networkextension target to AmneziaVPNNetworkExtension in macos build configuration * feat: add autostart support for Mac App Store builds on macOS Fixes: QA-8 * feat: add debug logging to Autostart functionality on macOS * Revert "feat: add autostart support for Mac App Store builds on macOS" This reverts commit 3bd25656fb4986d01e5bd6dd265f7279a73bd2a8. * feat: add platform-specific close window behavior for macOS App Store build with Network Extension Closes: QA-12 * When the application starts with "Start minimized" enabled on macOS (especially the sandboxed App-Store build compiled with MACOS_NE), fully hiding the window prevents it from being restored by clicking the Dock icon. The proper behaviour is to start the window in the *minimized* state instead. That way the window is still part of the window list and the system automatically brings it back when the user clicks the Dock icon, replicating the native experience. On the other platforms we keep the old behaviour (hide the window completely and rely on the tray icon), therefore we switch at runtime by checking the current OS. Closes: QA-7 Closes: QA-8 * Revert "When the application starts with "Start minimized" enabled on macOS (especially the" This reverts commit 7b0d17987cdfdbc4cedc3822bf3fd2e4973da452. * feat: MACOS_NE systray menu support * feat: add macOS notification handler and install event filter on main window * feat: implement custom close behavior for Amnezia application on different platforms * fix: update provisioning profile specifiers for macos builds * fix: Fatal error in logs CLI-216 * fix: disabled unavailable on macos ne service logs * fix: dock icon now hides only when window is closed; menubar icon shows always Initial state of the docker icon to be presented follows "Start minimized" setting in app settings. * temp-fix: temporary disable all OpenVPN options of VPN on MACOS_NE since it's not working yet. * fix: build script updated * feat: add macOS NE build workflow to GitHub Actions * fix: Not working Auto start toggle is hidden * fix: Log spamming during xray connection fixed * 3rd-prebuild points to commit that stores macos_ne universal binaries. * fix: missing native dependency on linking stage fixed * chore: update link to submodule --------- Co-authored-by: vladimir.kuznetsov <nethiuswork@gmail.com>
334 lines
12 KiB
C++
334 lines
12 KiB
C++
#ifndef PROTOCOLS_DEFS_H
|
|
#define PROTOCOLS_DEFS_H
|
|
|
|
#include <QDebug>
|
|
#include <QMetaEnum>
|
|
#include <QObject>
|
|
|
|
namespace amnezia
|
|
{
|
|
namespace config_key
|
|
{
|
|
|
|
// Json config strings
|
|
constexpr char hostName[] = "hostName";
|
|
constexpr char userName[] = "userName";
|
|
constexpr char password[] = "password";
|
|
constexpr char port[] = "port";
|
|
constexpr char local_port[] = "local_port";
|
|
|
|
constexpr char dns1[] = "dns1";
|
|
constexpr char dns2[] = "dns2";
|
|
|
|
constexpr char serverIndex[] = "serverIndex";
|
|
constexpr char description[] = "description";
|
|
constexpr char name[] = "name";
|
|
constexpr char cert[] = "cert";
|
|
constexpr char config[] = "config";
|
|
|
|
constexpr char containers[] = "containers";
|
|
constexpr char container[] = "container";
|
|
constexpr char defaultContainer[] = "defaultContainer";
|
|
|
|
constexpr char vpnproto[] = "protocol";
|
|
constexpr char protocols[] = "protocols";
|
|
|
|
constexpr char remote[] = "remote";
|
|
constexpr char transport_proto[] = "transport_proto";
|
|
constexpr char cipher[] = "cipher";
|
|
constexpr char hash[] = "hash";
|
|
constexpr char ncp_disable[] = "ncp_disable";
|
|
constexpr char tls_auth[] = "tls_auth";
|
|
|
|
constexpr char client_priv_key[] = "client_priv_key";
|
|
constexpr char client_pub_key[] = "client_pub_key";
|
|
constexpr char server_priv_key[] = "server_priv_key";
|
|
constexpr char server_pub_key[] = "server_pub_key";
|
|
constexpr char psk_key[] = "psk_key";
|
|
constexpr char mtu[] = "mtu";
|
|
constexpr char allowed_ips[] = "allowed_ips";
|
|
constexpr char persistent_keep_alive[] = "persistent_keep_alive";
|
|
|
|
constexpr char client_ip[] = "client_ip"; // internal ip address
|
|
|
|
constexpr char site[] = "site";
|
|
constexpr char block_outside_dns[] = "block_outside_dns";
|
|
|
|
constexpr char subnet_address[] = "subnet_address";
|
|
constexpr char subnet_mask[] = "subnet_mask";
|
|
constexpr char subnet_cidr[] = "subnet_cidr";
|
|
|
|
constexpr char additional_client_config[] = "additional_client_config";
|
|
constexpr char additional_server_config[] = "additional_server_config";
|
|
|
|
// proto config keys
|
|
constexpr char last_config[] = "last_config";
|
|
|
|
constexpr char isThirdPartyConfig[] = "isThirdPartyConfig";
|
|
constexpr char isObfuscationEnabled[] = "isObfuscationEnabled";
|
|
|
|
constexpr char junkPacketCount[] = "Jc";
|
|
constexpr char junkPacketMinSize[] = "Jmin";
|
|
constexpr char junkPacketMaxSize[] = "Jmax";
|
|
constexpr char initPacketJunkSize[] = "S1";
|
|
constexpr char responsePacketJunkSize[] = "S2";
|
|
constexpr char cookieReplyPacketJunkSize[] = "S3";
|
|
constexpr char transportPacketJunkSize[] = "S4";
|
|
constexpr char initPacketMagicHeader[] = "H1";
|
|
constexpr char responsePacketMagicHeader[] = "H2";
|
|
constexpr char underloadPacketMagicHeader[] = "H3";
|
|
constexpr char transportPacketMagicHeader[] = "H4";
|
|
constexpr char specialJunk1[] = "I1";
|
|
constexpr char specialJunk2[] = "I2";
|
|
constexpr char specialJunk3[] = "I3";
|
|
constexpr char specialJunk4[] = "I4";
|
|
constexpr char specialJunk5[] = "I5";
|
|
constexpr char controlledJunk1[] = "J1";
|
|
constexpr char controlledJunk2[] = "J2";
|
|
constexpr char controlledJunk3[] = "J3";
|
|
constexpr char specialHandshakeTimeout[] = "Itime";
|
|
|
|
constexpr char openvpn[] = "openvpn";
|
|
constexpr char wireguard[] = "wireguard";
|
|
constexpr char shadowsocks[] = "shadowsocks";
|
|
constexpr char cloak[] = "cloak";
|
|
constexpr char sftp[] = "sftp";
|
|
constexpr char awg[] = "awg";
|
|
constexpr char xray[] = "xray";
|
|
constexpr char ssxray[] = "ssxray";
|
|
constexpr char socks5proxy[] = "socks5proxy";
|
|
|
|
constexpr char configVersion[] = "config_version";
|
|
|
|
constexpr char splitTunnelSites[] = "splitTunnelSites";
|
|
constexpr char splitTunnelType[] = "splitTunnelType";
|
|
|
|
constexpr char splitTunnelApps[] = "splitTunnelApps";
|
|
constexpr char appSplitTunnelType[] = "appSplitTunnelType";
|
|
|
|
constexpr char allowedDnsServers[] = "allowedDnsServers";
|
|
|
|
constexpr char killSwitchOption[] = "killSwitchOption";
|
|
|
|
constexpr char crc[] = "crc";
|
|
|
|
constexpr char clientId[] = "clientId";
|
|
|
|
constexpr char nameOverriddenByUser[] = "nameOverriddenByUser";
|
|
|
|
}
|
|
|
|
namespace protocols
|
|
{
|
|
|
|
namespace dns
|
|
{
|
|
constexpr char amneziaDnsIp[] = "172.29.172.254";
|
|
}
|
|
|
|
namespace openvpn
|
|
{
|
|
constexpr char defaultSubnetAddress[] = "10.8.0.0";
|
|
constexpr char defaultSubnetMask[] = "255.255.255.0";
|
|
constexpr char defaultSubnetCidr[] = "24";
|
|
constexpr char defaultMtu[] = "1500";
|
|
|
|
constexpr char serverConfigPath[] = "/opt/amnezia/openvpn/server.conf";
|
|
constexpr char caCertPath[] = "/opt/amnezia/openvpn/pki/ca.crt";
|
|
constexpr char clientCertPath[] = "/opt/amnezia/openvpn/pki/issued";
|
|
constexpr char taKeyPath[] = "/opt/amnezia/openvpn/ta.key";
|
|
constexpr char clientsDirPath[] = "/opt/amnezia/openvpn/clients";
|
|
constexpr char defaultPort[] = "1194";
|
|
constexpr char defaultTransportProto[] = "udp";
|
|
constexpr char defaultCipher[] = "AES-256-GCM";
|
|
constexpr char defaultHash[] = "SHA512";
|
|
constexpr bool defaultBlockOutsideDns = true;
|
|
constexpr bool defaultNcpDisable = false;
|
|
constexpr bool defaultTlsAuth = true;
|
|
constexpr char ncpDisableString[] = "ncp-disable";
|
|
constexpr char tlsAuthString[] = "tls-auth /opt/amnezia/openvpn/ta.key 0";
|
|
|
|
constexpr char defaultAdditionalClientConfig[] = "";
|
|
constexpr char defaultAdditionalServerConfig[] = "";
|
|
}
|
|
|
|
namespace shadowsocks
|
|
{
|
|
constexpr char ssKeyPath[] = "/opt/amnezia/shadowsocks/shadowsocks.key";
|
|
constexpr char defaultPort[] = "6789";
|
|
constexpr char defaultLocalProxyPort[] = "8585";
|
|
constexpr char defaultCipher[] = "chacha20-ietf-poly1305";
|
|
}
|
|
|
|
namespace xray
|
|
{
|
|
constexpr char serverConfigPath[] = "/opt/amnezia/xray/server.json";
|
|
constexpr char uuidPath[] = "/opt/amnezia/xray/xray_uuid.key";
|
|
constexpr char PublicKeyPath[] = "/opt/amnezia/xray/xray_public.key";
|
|
constexpr char PrivateKeyPath[] = "/opt/amnezia/xray/xray_private.key";
|
|
constexpr char shortidPath[] = "/opt/amnezia/xray/xray_short_id.key";
|
|
constexpr char defaultSite[] = "www.googletagmanager.com";
|
|
|
|
constexpr char defaultPort[] = "443";
|
|
constexpr char defaultLocalProxyPort[] = "10808";
|
|
constexpr char defaultLocalAddr[] = "10.33.0.2";
|
|
}
|
|
|
|
namespace cloak
|
|
{
|
|
constexpr char ckPublicKeyPath[] = "/opt/amnezia/cloak/cloak_public.key";
|
|
constexpr char ckBypassUidKeyPath[] = "/opt/amnezia/cloak/cloak_bypass_uid.key";
|
|
constexpr char ckAdminKeyPath[] = "/opt/amnezia/cloak/cloak_admin_uid.key";
|
|
constexpr char defaultPort[] = "443";
|
|
constexpr char defaultRedirSite[] = "tile.openstreetmap.org";
|
|
constexpr char defaultCipher[] = "chacha20-poly1305";
|
|
}
|
|
|
|
namespace wireguard
|
|
{
|
|
constexpr char defaultSubnetAddress[] = "10.8.1.0";
|
|
constexpr char defaultSubnetMask[] = "255.255.255.0";
|
|
constexpr char defaultSubnetCidr[] = "24";
|
|
|
|
constexpr char defaultPort[] = "51820";
|
|
|
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(MACOS_NE)
|
|
constexpr char defaultMtu[] = "1280";
|
|
#else
|
|
constexpr char defaultMtu[] = "1376";
|
|
#endif
|
|
constexpr char serverConfigPath[] = "/opt/amnezia/wireguard/wg0.conf";
|
|
constexpr char serverPublicKeyPath[] = "/opt/amnezia/wireguard/wireguard_server_public_key.key";
|
|
constexpr char serverPskKeyPath[] = "/opt/amnezia/wireguard/wireguard_psk.key";
|
|
|
|
}
|
|
|
|
namespace sftp
|
|
{
|
|
constexpr char defaultUserName[] = "sftp_user";
|
|
|
|
} // namespace sftp
|
|
|
|
namespace awg
|
|
{
|
|
constexpr char defaultPort[] = "55424";
|
|
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(MACOS_NE)
|
|
constexpr char defaultMtu[] = "1280";
|
|
#else
|
|
constexpr char defaultMtu[] = "1376";
|
|
#endif
|
|
|
|
constexpr char serverConfigPath[] = "/opt/amnezia/awg/wg0.conf";
|
|
constexpr char serverPublicKeyPath[] = "/opt/amnezia/awg/wireguard_server_public_key.key";
|
|
constexpr char serverPskKeyPath[] = "/opt/amnezia/awg/wireguard_psk.key";
|
|
|
|
constexpr char defaultJunkPacketCount[] = "3";
|
|
constexpr char defaultJunkPacketMinSize[] = "10";
|
|
constexpr char defaultJunkPacketMaxSize[] = "30";
|
|
constexpr char defaultInitPacketJunkSize[] = "15";
|
|
constexpr char defaultResponsePacketJunkSize[] = "18";
|
|
constexpr char defaultCookieReplyPacketJunkSize[] = "20";
|
|
constexpr char defaultTransportPacketJunkSize[] = "23";
|
|
|
|
constexpr char defaultInitPacketMagicHeader[] = "1020325451";
|
|
constexpr char defaultResponsePacketMagicHeader[] = "3288052141";
|
|
constexpr char defaultTransportPacketMagicHeader[] = "2528465083";
|
|
constexpr char defaultUnderloadPacketMagicHeader[] = "1766607858";
|
|
constexpr char defaultSpecialJunk1[] = "";
|
|
constexpr char defaultSpecialJunk2[] = "";
|
|
constexpr char defaultSpecialJunk3[] = "";
|
|
constexpr char defaultSpecialJunk4[] = "";
|
|
constexpr char defaultSpecialJunk5[] = "";
|
|
constexpr char defaultControlledJunk1[] = "";
|
|
constexpr char defaultControlledJunk2[] = "";
|
|
constexpr char defaultControlledJunk3[] = "";
|
|
constexpr char defaultSpecialHandshakeTimeout[] = "";
|
|
}
|
|
|
|
namespace socks5Proxy
|
|
{
|
|
constexpr char defaultUserName[] = "proxy_user";
|
|
constexpr char defaultPort[] = "38080";
|
|
|
|
constexpr char proxyConfigPath[] = "/usr/local/3proxy/conf/3proxy.cfg";
|
|
}
|
|
|
|
} // namespace protocols
|
|
|
|
namespace ProtocolEnumNS
|
|
{
|
|
Q_NAMESPACE
|
|
|
|
enum TransportProto {
|
|
Udp,
|
|
Tcp,
|
|
TcpAndUdp
|
|
};
|
|
Q_ENUM_NS(TransportProto)
|
|
|
|
enum Proto {
|
|
Any = 0,
|
|
OpenVpn,
|
|
ShadowSocks,
|
|
Cloak,
|
|
WireGuard,
|
|
Awg,
|
|
Ikev2,
|
|
L2tp,
|
|
Xray,
|
|
SSXray,
|
|
|
|
// non-vpn
|
|
TorWebSite,
|
|
Dns,
|
|
Sftp,
|
|
Socks5Proxy
|
|
};
|
|
Q_ENUM_NS(Proto)
|
|
|
|
enum ServiceType {
|
|
None = 0,
|
|
Vpn,
|
|
Other
|
|
};
|
|
Q_ENUM_NS(ServiceType)
|
|
} // namespace ProtocolEnumNS
|
|
|
|
using namespace ProtocolEnumNS;
|
|
|
|
class ProtocolProps : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
Q_INVOKABLE static QList<Proto> allProtocols();
|
|
|
|
// spelling may differ for various protocols - TCP for OpenVPN, tcp for others
|
|
Q_INVOKABLE static TransportProto transportProtoFromString(QString p);
|
|
Q_INVOKABLE static QString transportProtoToString(TransportProto proto, Proto p = Proto::Any);
|
|
|
|
Q_INVOKABLE static Proto protoFromString(QString p);
|
|
Q_INVOKABLE static QString protoToString(Proto p);
|
|
|
|
Q_INVOKABLE static QMap<Proto, QString> protocolHumanNames();
|
|
Q_INVOKABLE static QMap<Proto, QString> protocolDescriptions();
|
|
|
|
Q_INVOKABLE static ServiceType protocolService(Proto p);
|
|
|
|
Q_INVOKABLE static int getPortForInstall(Proto p);
|
|
|
|
Q_INVOKABLE static int defaultPort(Proto p);
|
|
Q_INVOKABLE static bool defaultPortChangeable(Proto p);
|
|
|
|
Q_INVOKABLE static TransportProto defaultTransportProto(Proto p);
|
|
Q_INVOKABLE static bool defaultTransportProtoChangeable(Proto p);
|
|
|
|
Q_INVOKABLE static QString key_proto_config_data(Proto p);
|
|
Q_INVOKABLE static QString key_proto_config_path(Proto p);
|
|
};
|
|
} // namespace amnezia
|
|
|
|
QDebug operator<<(QDebug debug, const amnezia::Proto &p);
|
|
|
|
#endif // PROTOCOLS_DEFS_H
|