Enhancements

Add better error handling.
Add support for version field of Snell nodes.
Optimize codes.
This commit is contained in:
Tindy X committed 2022-01-23 01:04:16 +08:00
1 parent 9419738959
commit 2f78eafa2c
7 files changed
+41 -24

No files matched your search

+1 -1
View File
@@ -162,7 +162,7 @@ int addNodes(std::string link, std::vector<Proxy> &allNodes, int groupID, parse_
writeLog(LOG_TYPE_INFO, "Parsing subscription data...");
if(explodeConfContent(strSub, nodes) == 0)
{
writeLog(LOG_TYPE_ERROR, "Invalid subscription!");
writeLog(LOG_TYPE_ERROR, "Invalid subscription: '" + link + "'!");
return -1;
}
if(startsWith(strSub, "ssd://"))
+3 -5
View File
@@ -3,10 +3,6 @@
#include <numeric>
#include <cmath>
#include <climits>
#include <rapidjson/writer.h>
#include <rapidjson/document.h>
#include <rapidjson/error/en.h>
#include <yaml-cpp/yaml.h>
#include "../../config/regmatch.h"
#include "../../generator/config/subexport.h"
@@ -295,7 +291,7 @@ void proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGr
case ProxyType::VMess:
singleproxy["type"] = "vmess";
singleproxy["uuid"] = x.UserId;
singleproxy["alterId"] = static_cast<uint32_t>(x.AlterId);
singleproxy["alterId"] = x.AlterId;
singleproxy["cipher"] = x.EncryptMethod;
singleproxy["tls"] = x.TLSSecure;
if(!scv.is_undef())
@@ -433,6 +429,8 @@ void proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGr
case ProxyType::Snell:
singleproxy["type"] = "snell";
singleproxy["psk"] = x.Password;
if(x.AlterId != 0)
singleproxy["version"] = x.AlterId;
if(!x.OBFS.empty())
{
singleproxy["obfs-opts"]["mode"] = x.OBFS;