mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-23 02:00:20 +07:00
remove comment & reset file
This commit is contained in:
@@ -95,7 +95,6 @@ ErrorCode XrayProtocol::start()
|
||||
|
||||
m_connectivityProbeStarted = false;
|
||||
|
||||
// Step 3: fail fast if the VPS itself is unreachable, before spawning xray/tun2socks.
|
||||
if (!probeServerReachable()) {
|
||||
qCritical() << "XrayProtocol: VPN server" << m_remoteAddress << "is unreachable";
|
||||
return ErrorCode::XrayServerUnreachable;
|
||||
@@ -120,6 +119,8 @@ ErrorCode XrayProtocol::start()
|
||||
return ErrorCode::XrayExecutableCrashed;
|
||||
}
|
||||
|
||||
// Fix fingerprint: old configs may contain "Mozilla/5.0" which xray-core rejects.
|
||||
// Replace with the correct default at runtime so stale stored configs still work.
|
||||
if (xrayConfigStr.contains("Mozilla/5.0", Qt::CaseInsensitive)) {
|
||||
xrayConfigStr.replace("Mozilla/5.0", amnezia::protocols::xray::defaultFingerprint,
|
||||
Qt::CaseInsensitive);
|
||||
@@ -127,6 +128,8 @@ ErrorCode XrayProtocol::start()
|
||||
<< amnezia::protocols::xray::defaultFingerprint;
|
||||
}
|
||||
|
||||
// Fix inbound listen address: old configs may use "10.33.0.2" which doesn't exist
|
||||
// until TUN is created. xray must listen on 127.0.0.1 so tun2socks can connect.
|
||||
if (xrayConfigStr.contains(amnezia::protocols::xray::defaultLocalAddr)) {
|
||||
xrayConfigStr.replace(amnezia::protocols::xray::defaultLocalAddr,
|
||||
amnezia::protocols::xray::defaultLocalListenAddr);
|
||||
|
||||
@@ -29,11 +29,8 @@ private:
|
||||
ErrorCode setupRouting();
|
||||
ErrorCode startTun2Socks();
|
||||
|
||||
// Step 3: fast pre-connect TCP probe to the real VPN server endpoint.
|
||||
bool probeServerReachable();
|
||||
// Step 2/4: end-to-end probe through the local SOCKS5 proxy (xray -> VPS -> internet).
|
||||
void runConnectivityProbe(std::function<void(bool)> onResult);
|
||||
// Step 4: periodic liveness monitoring after the tunnel is established.
|
||||
void startLivenessMonitor();
|
||||
void stopLivenessMonitor();
|
||||
int extractServerPort() const;
|
||||
|
||||
@@ -60,9 +60,6 @@ bool DaemonLocalServer::initialize() {
|
||||
DaemonLocalServerConnection* connection =
|
||||
new DaemonLocalServerConnection(&m_server, socket);
|
||||
connect(socket, &QLocalSocket::disconnected, connection, [connection]() {
|
||||
// The client holds a single persistent connection for the whole session, so a dropped
|
||||
// socket means the app exited or crashed. Deactivate the tunnel so WireGuard, routing and
|
||||
// DNS don't leak. deactivate() is a safe no-op if nothing is active.
|
||||
logger.debug() << "Client connection dropped, deactivating daemon";
|
||||
Daemon::instance()->deactivate(true);
|
||||
connection->deleteLater();
|
||||
|
||||
Reference in New Issue
Block a user