mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-21 03:10:24 +08:00
27 lines
860 B
C++
27 lines
860 B
C++
#include "QvCoreConfigOperations.h"
|
|
|
|
namespace Qv2ray
|
|
{
|
|
namespace ConfigOperations
|
|
{
|
|
// -------------------------- BEGIN CONFIG VALIDATIONS ----------------------------------------------------------------------------
|
|
|
|
int VerifyVMessProtocolString(QString vmess)
|
|
{
|
|
if (!vmess.toLower().startsWith("vmess://")) {
|
|
return -1;
|
|
}
|
|
|
|
try {
|
|
QStringRef vmessJsonB64(&vmess, 8, vmess.length() - 8);
|
|
auto vmessString = Base64Decode(vmessJsonB64.toString());
|
|
auto vmessConf = StructFromJSONString<VMessProtocolConfigObject>(vmessString);
|
|
return 0;
|
|
} catch (exception *e) {
|
|
LOG(QObject::tr("#VMessDecodeError").toStdString() << e->what())
|
|
return -2;
|
|
}
|
|
}
|
|
}
|
|
}
|