mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-22 02:01:08 +07:00
flow default and config fixes
This commit is contained in:
@@ -244,11 +244,7 @@ ErrorCode XrayConfigurator::applyServerSettingsToRemote(const ServerCredentials
|
|||||||
<< "container=" << static_cast<int>(container) << "host=" << credentials.hostName
|
<< "container=" << static_cast<int>(container) << "host=" << credentials.hostName
|
||||||
<< "transport=" << srv.transport << "security=" << srv.security << "port=" << srv.port
|
<< "transport=" << srv.transport << "security=" << srv.security << "port=" << srv.port
|
||||||
<< "appendClient=" << appendNewClient;
|
<< "appendClient=" << appendNewClient;
|
||||||
QString flowValue = srv.flow;
|
const QString flowValue = srv.flow;
|
||||||
if (flowValue.isEmpty() && srv.security == QLatin1String("reality")) {
|
|
||||||
flowValue = QStringLiteral("xtls-rprx-vision");
|
|
||||||
}
|
|
||||||
|
|
||||||
QString realityPublicKey;
|
QString realityPublicKey;
|
||||||
QString realityShortId;
|
QString realityShortId;
|
||||||
if (srv.security == QLatin1String("reality")) {
|
if (srv.security == QLatin1String("reality")) {
|
||||||
@@ -563,9 +559,12 @@ QJsonObject XrayConfigurator::buildStreamSettings(const XrayServerConfig &srv, c
|
|||||||
if (pad.obfsMode) {
|
if (pad.obfsMode) {
|
||||||
if (!pad.bytesMin.isEmpty() || !pad.bytesMax.isEmpty()) {
|
if (!pad.bytesMin.isEmpty() || !pad.bytesMax.isEmpty()) {
|
||||||
QJsonObject br;
|
QJsonObject br;
|
||||||
br[QStringLiteral("from")] = pad.bytesMin.isEmpty() ? 1 : pad.bytesMin.toInt();
|
const int fromV = pad.bytesMin.isEmpty() ? 1 : pad.bytesMin.toInt();
|
||||||
br[QStringLiteral("to")] = pad.bytesMax.isEmpty() ? (pad.bytesMin.isEmpty() ? 256 : pad.bytesMin.toInt())
|
int toV = pad.bytesMax.isEmpty() ? 256 : pad.bytesMax.toInt();
|
||||||
: pad.bytesMax.toInt();
|
if (toV < fromV)
|
||||||
|
toV = fromV;
|
||||||
|
br[QStringLiteral("from")] = fromV;
|
||||||
|
br[QStringLiteral("to")] = toV;
|
||||||
xo[QStringLiteral("xPaddingBytes")] = br;
|
xo[QStringLiteral("xPaddingBytes")] = br;
|
||||||
}
|
}
|
||||||
xo[QStringLiteral("xPaddingKey")] = pad.key.isEmpty() ? QStringLiteral("x_padding") : pad.key;
|
xo[QStringLiteral("xPaddingKey")] = pad.key.isEmpty() ? QStringLiteral("x_padding") : pad.key;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ XrayXPaddingConfig XrayXPaddingConfig::fromJson(const QJsonObject &json)
|
|||||||
c.bytesMin = json.value(configKey::xPaddingBytesMin).toString();
|
c.bytesMin = json.value(configKey::xPaddingBytesMin).toString();
|
||||||
c.bytesMax = json.value(configKey::xPaddingBytesMax).toString();
|
c.bytesMax = json.value(configKey::xPaddingBytesMax).toString();
|
||||||
c.obfsMode = json.value(configKey::xPaddingObfsMode).toBool(true);
|
c.obfsMode = json.value(configKey::xPaddingObfsMode).toBool(true);
|
||||||
c.key = json.value(configKey::xPaddingKey).toString(protocols::xray::defaultSite);
|
c.key = json.value(configKey::xPaddingKey).toString();
|
||||||
c.header = json.value(configKey::xPaddingHeader).toString();
|
c.header = json.value(configKey::xPaddingHeader).toString();
|
||||||
c.placement = json.value(configKey::xPaddingPlacement).toString(protocols::xray::defaultXPaddingPlacement);
|
c.placement = json.value(configKey::xPaddingPlacement).toString(protocols::xray::defaultXPaddingPlacement);
|
||||||
c.method = json.value(configKey::xPaddingMethod).toString(protocols::xray::defaultXPaddingMethod);
|
c.method = json.value(configKey::xPaddingMethod).toString(protocols::xray::defaultXPaddingMethod);
|
||||||
@@ -365,6 +365,8 @@ XrayServerConfig XrayServerConfig::fromJson(const QJsonObject &json)
|
|||||||
bool XrayServerConfig::hasEqualServerSettings(const XrayServerConfig &other) const
|
bool XrayServerConfig::hasEqualServerSettings(const XrayServerConfig &other) const
|
||||||
{
|
{
|
||||||
return port == other.port
|
return port == other.port
|
||||||
|
&& transportProto == other.transportProto
|
||||||
|
&& subnetAddress == other.subnetAddress
|
||||||
&& site == other.site
|
&& site == other.site
|
||||||
&& security == other.security
|
&& security == other.security
|
||||||
&& flow == other.flow
|
&& flow == other.flow
|
||||||
|
|||||||
Reference in New Issue
Block a user