mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 10:12:50 +00:00
fix bug (#11)
This commit is contained in:
1 parent
3ea867e4b8
commit
ffbd262aae
2 files changed
+72
-49
No files matched your search
@@ -25,12 +25,18 @@
|
|||||||
|
|
||||||
extern string_array ss_ciphers, ssr_ciphers;
|
extern string_array ss_ciphers, ssr_ciphers;
|
||||||
|
|
||||||
const string_array clashr_protocols = {"origin", "auth_sha1_v4", "auth_aes128_md5", "auth_aes128_sha1", "auth_chain_a",
|
const string_array clashr_protocols = {
|
||||||
"auth_chain_b"};
|
"origin", "auth_sha1_v4", "auth_aes128_md5", "auth_aes128_sha1", "auth_chain_a",
|
||||||
const string_array clashr_obfs = {"plain", "http_simple", "http_post", "random_head", "tls1.2_ticket_auth",
|
"auth_chain_b"
|
||||||
"tls1.2_ticket_fastauth"};
|
};
|
||||||
const string_array clash_ssr_ciphers = {"rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb",
|
const string_array clashr_obfs = {
|
||||||
"aes-192-cfb", "aes-256-cfb", "chacha20-ietf", "xchacha20", "none"};
|
"plain", "http_simple", "http_post", "random_head", "tls1.2_ticket_auth",
|
||||||
|
"tls1.2_ticket_fastauth"
|
||||||
|
};
|
||||||
|
const string_array clash_ssr_ciphers = {
|
||||||
|
"rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb",
|
||||||
|
"aes-192-cfb", "aes-256-cfb", "chacha20-ietf", "xchacha20", "none"
|
||||||
|
};
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
vmessLinkConstruct(const std::string &remarks, const std::string &add, const std::string &port, const std::string &type,
|
vmessLinkConstruct(const std::string &remarks, const std::string &add, const std::string &port, const std::string &type,
|
||||||
@@ -70,7 +76,8 @@ bool matchRange(const std::string &range, int target) {
|
|||||||
bool match = false;
|
bool match = false;
|
||||||
std::string range_begin_str, range_end_str;
|
std::string range_begin_str, range_end_str;
|
||||||
int range_begin, range_end;
|
int range_begin, range_end;
|
||||||
static const std::string reg_num = "-?\\d+", reg_range = "(\\d+)-(\\d+)", reg_not = "\\!-?(\\d+)", reg_not_range = "\\!(\\d+)-(\\d+)", reg_less = "(\\d+)-", reg_more = "(\\d+)\\+";
|
static const std::string reg_num = "-?\\d+", reg_range = "(\\d+)-(\\d+)", reg_not = "\\!-?(\\d+)", reg_not_range =
|
||||||
|
"\\!(\\d+)-(\\d+)", reg_less = "(\\d+)-", reg_more = "(\\d+)\\+";
|
||||||
for (std::string &x: vArray) {
|
for (std::string &x: vArray) {
|
||||||
if (regMatch(x, reg_num)) {
|
if (regMatch(x, reg_num)) {
|
||||||
if (to_int(x, INT_MAX) == target)
|
if (to_int(x, INT_MAX) == target)
|
||||||
@@ -105,9 +112,12 @@ bool matchRange(const std::string &range, int target) {
|
|||||||
|
|
||||||
bool applyMatcher(const std::string &rule, std::string &real_rule, const Proxy &node) {
|
bool applyMatcher(const std::string &rule, std::string &real_rule, const Proxy &node) {
|
||||||
std::string target, ret_real_rule;
|
std::string target, ret_real_rule;
|
||||||
static const std::string groupid_regex = R"(^!!(?:GROUPID|INSERT)=([\d\-+!,]+)(?:!!(.*))?$)", group_regex = R"(^!!(?:GROUP)=(.+?)(?:!!(.*))?$)";
|
static const std::string groupid_regex = R"(^!!(?:GROUPID|INSERT)=([\d\-+!,]+)(?:!!(.*))?$)", group_regex =
|
||||||
static const std::string type_regex = R"(^!!(?:TYPE)=(.+?)(?:!!(.*))?$)", port_regex = R"(^!!(?:PORT)=(.+?)(?:!!(.*))?$)", server_regex = R"(^!!(?:SERVER)=(.+?)(?:!!(.*))?$)";
|
R"(^!!(?:GROUP)=(.+?)(?:!!(.*))?$)";
|
||||||
static const std::map<ProxyType, const char *> types = {{ProxyType::Shadowsocks, "SS"},
|
static const std::string type_regex = R"(^!!(?:TYPE)=(.+?)(?:!!(.*))?$)", port_regex =
|
||||||
|
R"(^!!(?:PORT)=(.+?)(?:!!(.*))?$)", server_regex = R"(^!!(?:SERVER)=(.+?)(?:!!(.*))?$)";
|
||||||
|
static const std::map<ProxyType, const char *> types = {
|
||||||
|
{ProxyType::Shadowsocks, "SS"},
|
||||||
{ProxyType::ShadowsocksR, "SSR"},
|
{ProxyType::ShadowsocksR, "SSR"},
|
||||||
{ProxyType::VMess, "VMESS"},
|
{ProxyType::VMess, "VMESS"},
|
||||||
{ProxyType::Trojan, "TROJAN"},
|
{ProxyType::Trojan, "TROJAN"},
|
||||||
@@ -118,7 +128,8 @@ bool applyMatcher(const std::string &rule, std::string &real_rule, const Proxy &
|
|||||||
{ProxyType::WireGuard, "WIREGUARD"},
|
{ProxyType::WireGuard, "WIREGUARD"},
|
||||||
{ProxyType::VLESS, "VLESS"},
|
{ProxyType::VLESS, "VLESS"},
|
||||||
{ProxyType::Hysteria, "HYSTERIA"},
|
{ProxyType::Hysteria, "HYSTERIA"},
|
||||||
{ProxyType::Hysteria2, "HYSTERIA2"}};
|
{ProxyType::Hysteria2, "HYSTERIA2"}
|
||||||
|
};
|
||||||
if (startsWith(rule, "!!GROUP=")) {
|
if (startsWith(rule, "!!GROUP=")) {
|
||||||
regGetMatch(rule, group_regex, 3, 0, &target, &ret_real_rule);
|
regGetMatch(rule, group_regex, 3, 0, &target, &ret_real_rule);
|
||||||
real_rule = ret_real_rule;
|
real_rule = ret_real_rule;
|
||||||
@@ -184,8 +195,7 @@ groupGenerate(const std::string &rule, std::vector<Proxy> &nodelist, string_arra
|
|||||||
auto filter = (std::function<std::string(const std::vector<Proxy> &)>) ctx.eval("filter");
|
auto filter = (std::function<std::string(const std::vector<Proxy> &)>) ctx.eval("filter");
|
||||||
std::string result_list = filter(nodelist);
|
std::string result_list = filter(nodelist);
|
||||||
filtered_nodelist = split(regTrim(result_list), "\n");
|
filtered_nodelist = split(regTrim(result_list), "\n");
|
||||||
}
|
} catch (qjs::exception) {
|
||||||
catch (qjs::exception) {
|
|
||||||
script_print_stack(ctx);
|
script_print_stack(ctx);
|
||||||
}
|
}
|
||||||
}, global.scriptCleanContext);
|
}, global.scriptCleanContext);
|
||||||
@@ -207,17 +217,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
std::vector<Proxy> nodelist;
|
std::vector<Proxy> nodelist;
|
||||||
string_array remarks_list;
|
string_array remarks_list;
|
||||||
/// proxies style
|
/// proxies style
|
||||||
bool block = false, compact = false;
|
|
||||||
switch (hash_(ext.clash_proxies_style)) {
|
|
||||||
case "block"_hash:
|
|
||||||
block = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
case "flow"_hash:
|
|
||||||
break;
|
|
||||||
case "compact"_hash:
|
|
||||||
compact = true;
|
|
||||||
break;
|
|
||||||
bool proxy_block = false, proxy_compact = false, group_block = false, group_compact = false;
|
bool proxy_block = false, proxy_compact = false, group_block = false, group_compact = false;
|
||||||
switch (hash_(ext.clash_proxies_style)) {
|
switch (hash_(ext.clash_proxies_style)) {
|
||||||
case "block"_hash:
|
case "block"_hash:
|
||||||
@@ -637,7 +637,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
// sees in https://dreamacro.github.io/clash/configuration/outbound.html#snell
|
// sees in https://dreamacro.github.io/clash/configuration/outbound.html#snell
|
||||||
if (udp && x.Type != ProxyType::Snell && x.Type != ProxyType::TUIC)
|
if (udp && x.Type != ProxyType::Snell && x.Type != ProxyType::TUIC)
|
||||||
singleproxy["udp"] = true;
|
singleproxy["udp"] = true;
|
||||||
if (block)
|
if(proxy_block)
|
||||||
singleproxy.SetStyle(YAML::EmitterStyle::Block);
|
singleproxy.SetStyle(YAML::EmitterStyle::Block);
|
||||||
else
|
else
|
||||||
singleproxy.SetStyle(YAML::EmitterStyle::Flow);
|
singleproxy.SetStyle(YAML::EmitterStyle::Flow);
|
||||||
@@ -646,7 +646,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
nodelist.emplace_back(x);
|
nodelist.emplace_back(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compact)
|
if(proxy_compact)
|
||||||
proxies.SetStyle(YAML::EmitterStyle::Flow);
|
proxies.SetStyle(YAML::EmitterStyle::Flow);
|
||||||
|
|
||||||
if (ext.nodelist) {
|
if (ext.nodelist) {
|
||||||
@@ -754,7 +754,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
yamlnode["Proxy Group"] = original_groups;
|
yamlnode["Proxy Group"] = original_groups;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void formatterShortId(std::string &input) {
|
void formatterShortId(std::string &input) {
|
||||||
std::string target = "short-id:";
|
std::string target = "short-id:";
|
||||||
@@ -781,7 +781,6 @@ void formatterShortId(std::string &input) {
|
|||||||
// 继续查找下一个实例
|
// 继续查找下一个实例
|
||||||
startPos = input.find(target, startPos + 1);
|
startPos = input.find(target, startPos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string proxyToClash(std::vector<Proxy> &nodes, const std::string &base_conf,
|
std::string proxyToClash(std::vector<Proxy> &nodes, const std::string &base_conf,
|
||||||
@@ -792,8 +791,7 @@ std::string proxyToClash(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
yamlnode = YAML::Load(base_conf);
|
yamlnode = YAML::Load(base_conf);
|
||||||
}
|
} catch (std::exception &e) {
|
||||||
catch (std::exception &e) {
|
|
||||||
writeLog(0, std::string("Clash base loader failed with error: ") + e.what(), LOG_LEVEL_ERROR);
|
writeLog(0, std::string("Clash base loader failed with error: ") + e.what(), LOG_LEVEL_ERROR);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -897,7 +895,10 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
|
|
||||||
processRemark(x.Remark, remarks_list);
|
processRemark(x.Remark, remarks_list);
|
||||||
|
|
||||||
std::string &hostname = x.Hostname, &sni = x.ServerName, &username = x.Username, &password = x.Password, &method = x.EncryptMethod, &id = x.UserId, &transproto = x.TransferProtocol, &host = x.Host, &edge = x.Edge, &path = x.Path, &protocol = x.Protocol, &protoparam = x.ProtocolParam, &obfs = x.OBFS, &obfsparam = x.OBFSParam, &plugin = x.Plugin, &pluginopts = x.PluginOption, &underlying_proxy = x.UnderlyingProxy;
|
std::string &hostname = x.Hostname, &sni = x.ServerName, &username = x.Username, &password = x.Password, &method
|
||||||
|
= x.EncryptMethod, &id = x.UserId, &transproto = x.TransferProtocol, &host = x.Host, &edge = x.Edge, &
|
||||||
|
path = x.Path, &protocol = x.Protocol, &protoparam = x.ProtocolParam, &obfs = x.OBFS, &obfsparam = x.
|
||||||
|
OBFSParam, &plugin = x.Plugin, &pluginopts = x.PluginOption, &underlying_proxy = x.UnderlyingProxy;
|
||||||
std::string port = std::to_string(x.Port);;
|
std::string port = std::to_string(x.Port);;
|
||||||
bool &tlssecure = x.TLSSecure;
|
bool &tlssecure = x.TLSSecure;
|
||||||
|
|
||||||
@@ -963,8 +964,10 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
if (ext.surge_ssr_path.empty() || surge_ver < 2)
|
if (ext.surge_ssr_path.empty() || surge_ver < 2)
|
||||||
continue;
|
continue;
|
||||||
proxy = "external, exec=\"" + ext.surge_ssr_path + "\", args=\"";
|
proxy = "external, exec=\"" + ext.surge_ssr_path + "\", args=\"";
|
||||||
args = {"-l", std::to_string(local_port), "-s", hostname, "-p", port, "-m", method, "-k", password,
|
args = {
|
||||||
"-o", obfs, "-O", protocol};
|
"-l", std::to_string(local_port), "-s", hostname, "-p", port, "-m", method, "-k", password,
|
||||||
|
"-o", obfs, "-O", protocol
|
||||||
|
};
|
||||||
if (!obfsparam.empty()) {
|
if (!obfsparam.empty()) {
|
||||||
args.emplace_back("-g");
|
args.emplace_back("-g");
|
||||||
args.emplace_back(std::move(obfsparam));
|
args.emplace_back(std::move(obfsparam));
|
||||||
@@ -1164,7 +1167,12 @@ std::string proxyToSingle(std::vector<Proxy> &nodes, int types, extra_settings &
|
|||||||
|
|
||||||
for (Proxy &x: nodes) {
|
for (Proxy &x: nodes) {
|
||||||
std::string remark = x.Remark;
|
std::string remark = x.Remark;
|
||||||
std::string &hostname = x.Hostname, &sni = x.ServerName, &password = x.Password, &method = x.EncryptMethod, &plugin = x.Plugin, &pluginopts = x.PluginOption, &protocol = x.Protocol, &protoparam = x.ProtocolParam, &obfs = x.OBFS, &obfsparam = x.OBFSParam, &id = x.UserId, &transproto = x.TransferProtocol, &host = x.Host, &path = x.Path, &faketype = x.FakeType;
|
std::string &hostname = x.Hostname, &sni = x.ServerName, &password = x.Password, &method = x.EncryptMethod, &
|
||||||
|
plugin = x.Plugin, &pluginopts = x.PluginOption, &protocol = x.Protocol, &protoparam = x.
|
||||||
|
ProtocolParam,
|
||||||
|
&obfs = x.OBFS, &obfsparam = x.OBFSParam, &id = x.UserId, &transproto = x.TransferProtocol, &host = x.
|
||||||
|
Host, &
|
||||||
|
path = x.Path, &faketype = x.FakeType;
|
||||||
bool &tlssecure = x.TLSSecure;
|
bool &tlssecure = x.TLSSecure;
|
||||||
std::string port = std::to_string(x.Port);
|
std::string port = std::to_string(x.Port);
|
||||||
std::string aid = std::to_string(x.AlterId);
|
std::string aid = std::to_string(x.AlterId);
|
||||||
@@ -1182,8 +1190,9 @@ std::string proxyToSingle(std::vector<Proxy> &nodes, int types, extra_settings &
|
|||||||
plugin.empty())
|
plugin.empty())
|
||||||
proxyStr = "ssr://" + urlSafeBase64Encode(
|
proxyStr = "ssr://" + urlSafeBase64Encode(
|
||||||
hostname + ":" + port + ":origin:" + method + ":plain:" +
|
hostname + ":" + port + ":origin:" + method + ":plain:" +
|
||||||
urlSafeBase64Encode(password) \
|
urlSafeBase64Encode(password)
|
||||||
+ "/?group=" + urlSafeBase64Encode(x.Group) + "&remarks=" + urlSafeBase64Encode(remark));
|
+ "/?group=" + urlSafeBase64Encode(x.Group) + "&remarks=" + urlSafeBase64Encode(
|
||||||
|
remark));
|
||||||
} else
|
} else
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
@@ -1191,9 +1200,11 @@ std::string proxyToSingle(std::vector<Proxy> &nodes, int types, extra_settings &
|
|||||||
if (ssr) {
|
if (ssr) {
|
||||||
proxyStr = "ssr://" + urlSafeBase64Encode(
|
proxyStr = "ssr://" + urlSafeBase64Encode(
|
||||||
hostname + ":" + port + ":" + protocol + ":" + method + ":" + obfs + ":" +
|
hostname + ":" + port + ":" + protocol + ":" + method + ":" + obfs + ":" +
|
||||||
urlSafeBase64Encode(password) \
|
urlSafeBase64Encode(password)
|
||||||
+ "/?group=" + urlSafeBase64Encode(x.Group) + "&remarks=" + urlSafeBase64Encode(remark) \
|
+ "/?group=" + urlSafeBase64Encode(x.Group) + "&remarks=" + urlSafeBase64Encode(
|
||||||
+ "&obfsparam=" + urlSafeBase64Encode(obfsparam) + "&protoparam=" + urlSafeBase64Encode(protoparam));
|
remark)
|
||||||
|
+ "&obfsparam=" + urlSafeBase64Encode(obfsparam) + "&protoparam=" +
|
||||||
|
urlSafeBase64Encode(protoparam));
|
||||||
} else if (ss) {
|
} else if (ss) {
|
||||||
if (std::find(ss_ciphers.begin(), ss_ciphers.end(), method) != ss_ciphers.end() &&
|
if (std::find(ss_ciphers.begin(), ss_ciphers.end(), method) != ss_ciphers.end() &&
|
||||||
protocol == "origin" && obfs == "plain")
|
protocol == "origin" && obfs == "plain")
|
||||||
@@ -1333,7 +1344,12 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
|
|||||||
|
|
||||||
processRemark(x.Remark, remarks_list);
|
processRemark(x.Remark, remarks_list);
|
||||||
|
|
||||||
std::string &hostname = x.Hostname, &method = x.EncryptMethod, &password = x.Password, &id = x.UserId, &transproto = x.TransferProtocol, &host = x.Host, &path = x.Path, &edge = x.Edge, &protocol = x.Protocol, &protoparam = x.ProtocolParam, &obfs = x.OBFS, &obfsparam = x.OBFSParam, &plugin = x.Plugin, &pluginopts = x.PluginOption, &username = x.Username;
|
std::string &hostname = x.Hostname, &method = x.EncryptMethod, &password = x.Password, &id = x.UserId, &
|
||||||
|
transproto = x.TransferProtocol, &host = x.Host, &path = x.Path, &edge = x.Edge, &protocol = x.
|
||||||
|
Protocol,
|
||||||
|
&protoparam = x.ProtocolParam, &obfs = x.OBFS, &obfsparam = x.OBFSParam, &plugin = x.Plugin, &pluginopts
|
||||||
|
= x.
|
||||||
|
PluginOption, &username = x.Username;
|
||||||
std::string port = std::to_string(x.Port);
|
std::string port = std::to_string(x.Port);
|
||||||
bool &tlssecure = x.TLSSecure;
|
bool &tlssecure = x.TLSSecure;
|
||||||
tribool scv;
|
tribool scv;
|
||||||
@@ -1368,9 +1384,11 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
|
|||||||
if (ext.nodelist) {
|
if (ext.nodelist) {
|
||||||
proxyStr = "ssr://" + urlSafeBase64Encode(
|
proxyStr = "ssr://" + urlSafeBase64Encode(
|
||||||
hostname + ":" + port + ":" + protocol + ":" + method + ":" + obfs + ":" +
|
hostname + ":" + port + ":" + protocol + ":" + method + ":" + obfs + ":" +
|
||||||
urlSafeBase64Encode(password) \
|
urlSafeBase64Encode(password)
|
||||||
+ "/?group=" + urlSafeBase64Encode(x.Group) + "&remarks=" + urlSafeBase64Encode(x.Remark) \
|
+ "/?group=" + urlSafeBase64Encode(x.Group) + "&remarks=" + urlSafeBase64Encode(
|
||||||
+ "&obfsparam=" + urlSafeBase64Encode(obfsparam) + "&protoparam=" + urlSafeBase64Encode(protoparam));
|
x.Remark)
|
||||||
|
+ "&obfsparam=" + urlSafeBase64Encode(obfsparam) + "&protoparam=" +
|
||||||
|
urlSafeBase64Encode(protoparam));
|
||||||
} else {
|
} else {
|
||||||
proxyStr = x.Remark + " = shadowsocksr, " + hostname + ", " + port + ", " + method + ", \"" +
|
proxyStr = x.Remark + " = shadowsocksr, " + hostname + ", " + port + ", " + method + ", \"" +
|
||||||
password + "\", group=" + x.Group + ", protocol=" + protocol + ", obfs=" + obfs;
|
password + "\", group=" + x.Group + ", protocol=" + protocol + ", obfs=" + obfs;
|
||||||
@@ -1562,7 +1580,10 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
|
|||||||
|
|
||||||
processRemark(x.Remark, remarks_list);
|
processRemark(x.Remark, remarks_list);
|
||||||
|
|
||||||
std::string &hostname = x.Hostname, &method = x.EncryptMethod, &id = x.UserId, &transproto = x.TransferProtocol, &host = x.Host, &path = x.Path, &password = x.Password, &plugin = x.Plugin, &pluginopts = x.PluginOption, &protocol = x.Protocol, &protoparam = x.ProtocolParam, &obfs = x.OBFS, &obfsparam = x.OBFSParam, &username = x.Username;
|
std::string &hostname = x.Hostname, &method = x.EncryptMethod, &id = x.UserId, &transproto = x.TransferProtocol,
|
||||||
|
&host = x.Host, &path = x.Path, &password = x.Password, &plugin = x.Plugin, &pluginopts = x.PluginOption
|
||||||
|
, &protocol = x.Protocol, &protoparam = x.ProtocolParam, &obfs = x.OBFS, &obfsparam = x.OBFSParam, &
|
||||||
|
username = x.Username;
|
||||||
std::string port = std::to_string(x.Port);
|
std::string port = std::to_string(x.Port);
|
||||||
bool &tlssecure = x.TLSSecure;
|
bool &tlssecure = x.TLSSecure;
|
||||||
|
|
||||||
@@ -1827,7 +1848,8 @@ std::string proxyToSSD(std::vector<Proxy> &nodes, std::string &group, std::strin
|
|||||||
writer.StartArray();
|
writer.StartArray();
|
||||||
|
|
||||||
for (Proxy &x: nodes) {
|
for (Proxy &x: nodes) {
|
||||||
std::string &hostname = x.Hostname, &password = x.Password, &method = x.EncryptMethod, &plugin = x.Plugin, &pluginopts = x.PluginOption, &protocol = x.Protocol, &obfs = x.OBFS;
|
std::string &hostname = x.Hostname, &password = x.Password, &method = x.EncryptMethod, &plugin = x.Plugin, &
|
||||||
|
pluginopts = x.PluginOption, &protocol = x.Protocol, &obfs = x.OBFS;
|
||||||
|
|
||||||
switch (x.Type) {
|
switch (x.Type) {
|
||||||
case ProxyType::Shadowsocks:
|
case ProxyType::Shadowsocks:
|
||||||
@@ -2062,7 +2084,10 @@ proxyToLoon(std::vector<Proxy> &nodes, const std::string &base_conf,
|
|||||||
}
|
}
|
||||||
processRemark(x.Remark, remarks_list);
|
processRemark(x.Remark, remarks_list);
|
||||||
|
|
||||||
std::string &hostname = x.Hostname, &username = x.Username, &password = x.Password, &method = x.EncryptMethod, &plugin = x.Plugin, &pluginopts = x.PluginOption, &id = x.UserId, &transproto = x.TransferProtocol, &host = x.Host, &path = x.Path, &protocol = x.Protocol, &protoparam = x.ProtocolParam, &obfs = x.OBFS, &obfsparam = x.OBFSParam;
|
std::string &hostname = x.Hostname, &username = x.Username, &password = x.Password, &method = x.EncryptMethod, &
|
||||||
|
plugin = x.Plugin, &pluginopts = x.PluginOption, &id = x.UserId, &transproto = x.TransferProtocol, &host
|
||||||
|
= x.Host, &path = x.Path, &protocol = x.Protocol, &protoparam = x.ProtocolParam, &obfs = x.OBFS, &
|
||||||
|
obfsparam = x.OBFSParam;
|
||||||
std::string port = std::to_string(x.Port), aid = std::to_string(x.AlterId);
|
std::string port = std::to_string(x.Port), aid = std::to_string(x.AlterId);
|
||||||
bool &tlssecure = x.TLSSecure;
|
bool &tlssecure = x.TLSSecure;
|
||||||
|
|
||||||
@@ -2608,7 +2633,6 @@ proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json,
|
|||||||
addSingBoxCommonMembers(proxy, x, "hysteria2", allocator);
|
addSingBoxCommonMembers(proxy, x, "hysteria2", allocator);
|
||||||
proxy.AddMember("password", rapidjson::StringRef(x.Password.c_str()), allocator);
|
proxy.AddMember("password", rapidjson::StringRef(x.Password.c_str()), allocator);
|
||||||
if (!x.TLSSecure) {
|
if (!x.TLSSecure) {
|
||||||
|
|
||||||
rapidjson::Value tls(rapidjson::kObjectType);
|
rapidjson::Value tls(rapidjson::kObjectType);
|
||||||
tls.AddMember("enabled", true, allocator);
|
tls.AddMember("enabled", true, allocator);
|
||||||
if (!x.ServerName.empty())
|
if (!x.ServerName.empty())
|
||||||
@@ -2648,7 +2672,6 @@ proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json,
|
|||||||
obfs.AddMember("password", rapidjson::StringRef(x.OBFSPassword.c_str()), allocator);
|
obfs.AddMember("password", rapidjson::StringRef(x.OBFSPassword.c_str()), allocator);
|
||||||
}
|
}
|
||||||
proxy.AddMember("obfs", obfs, allocator);
|
proxy.AddMember("obfs", obfs, allocator);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1583,7 +1583,7 @@ void explodeStdVless(std::string vless, Proxy &node) {
|
|||||||
remarks = urlDecode(vless.substr(pos + 1));
|
remarks = urlDecode(vless.substr(pos + 1));
|
||||||
vless.erase(pos);
|
vless.erase(pos);
|
||||||
}
|
}
|
||||||
const std::string stdvless_matcher = R"(^([\da-f]{4}(?:[\da-f]{4}-){4}[\da-f]{12})@\[?([\d\-a-zA-Z:.]+)\]?:(\d+)(?:\/?\?(.*))?$)";
|
const std::string stdvless_matcher = R"(^([\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12})@\[?([\d\-a-zA-Z:.]+)\]?:(\d+)(?:\/?\?(.*))?$)";
|
||||||
if (regGetMatch(vless, stdvless_matcher, 5, 0, &id, &add, &port, &addition))
|
if (regGetMatch(vless, stdvless_matcher, 5, 0, &id, &add, &port, &addition))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user