mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 18:24:58 +00:00
merge tindy2013
This commit is contained in:
1 parent
e88f8fd485
commit
090c2def1d
7 files changed
+128
-101
No files matched your search
@@ -10,7 +10,7 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY_IMAGE: tindy2013/subconverter
|
REGISTRY_IMAGE: asdlokj1qpi23/subconverter
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
@@ -161,8 +161,7 @@ void processRemark(std::string &remark, const string_array &remarks_list, bool p
|
|||||||
}
|
}
|
||||||
std::string tempRemark = remark;
|
std::string tempRemark = remark;
|
||||||
int cnt = 2;
|
int cnt = 2;
|
||||||
while(std::find(remarks_list.cbegin(), remarks_list.cend(), tempRemark) != remarks_list.cend())
|
while (std::find(remarks_list.cbegin(), remarks_list.cend(), tempRemark) != remarks_list.cend()) {
|
||||||
{
|
|
||||||
tempRemark = remark + " " + std::to_string(cnt);
|
tempRemark = remark + " " + std::to_string(cnt);
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
@@ -220,8 +219,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
compact = true;
|
compact = true;
|
||||||
break;
|
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:
|
||||||
proxy_block = true;
|
proxy_block = true;
|
||||||
break;
|
break;
|
||||||
@@ -232,8 +230,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
proxy_compact = true;
|
proxy_compact = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch(hash_(ext.clash_proxy_groups_style))
|
switch (hash_(ext.clash_proxy_groups_style)) {
|
||||||
{
|
|
||||||
case "block"_hash:
|
case "block"_hash:
|
||||||
group_block = true;
|
group_block = true;
|
||||||
break;
|
break;
|
||||||
@@ -358,7 +355,8 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
case ProxyType::ShadowsocksR:
|
case ProxyType::ShadowsocksR:
|
||||||
//ignoring all nodes with unsupported obfs, protocols and encryption
|
//ignoring all nodes with unsupported obfs, protocols and encryption
|
||||||
if (ext.filter_deprecated) {
|
if (ext.filter_deprecated) {
|
||||||
if (!clashR && std::find(clash_ssr_ciphers.cbegin(), clash_ssr_ciphers.cend(), x.EncryptMethod) ==
|
if (!clashR &&
|
||||||
|
std::find(clash_ssr_ciphers.cbegin(), clash_ssr_ciphers.cend(), x.EncryptMethod) ==
|
||||||
clash_ssr_ciphers.cend())
|
clash_ssr_ciphers.cend())
|
||||||
continue;
|
continue;
|
||||||
if (std::find(clashr_protocols.cbegin(), clashr_protocols.cend(), x.Protocol) ==
|
if (std::find(clashr_protocols.cbegin(), clashr_protocols.cend(), x.Protocol) ==
|
||||||
@@ -566,7 +564,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
singleproxy["tfo"] = tfo.get();
|
singleproxy["tfo"] = tfo.get();
|
||||||
if (xudp && udp)
|
if (xudp && udp)
|
||||||
singleproxy["xudp"] = true;
|
singleproxy["xudp"] = true;
|
||||||
if(!x.PacketEncoding.empty()){
|
if (!x.PacketEncoding.empty()) {
|
||||||
singleproxy["packet-encoding"] = x.PacketEncoding;
|
singleproxy["packet-encoding"] = x.PacketEncoding;
|
||||||
}
|
}
|
||||||
if (!x.Flow.empty())
|
if (!x.Flow.empty())
|
||||||
@@ -694,8 +692,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
switch(x.Type)
|
switch (x.Type) {
|
||||||
{
|
|
||||||
case ProxyGroupType::Select:
|
case ProxyGroupType::Select:
|
||||||
case ProxyGroupType::Relay:
|
case ProxyGroupType::Relay:
|
||||||
break;
|
break;
|
||||||
@@ -705,14 +702,14 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
case ProxyGroupType::Smart:
|
case ProxyGroupType::Smart:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case ProxyGroupType::URLTest:
|
case ProxyGroupType::URLTest:
|
||||||
if(!x.Lazy.is_undef())
|
if (!x.Lazy.is_undef())
|
||||||
singlegroup["lazy"] = x.Lazy.get();
|
singlegroup["lazy"] = x.Lazy.get();
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case ProxyGroupType::Fallback:
|
case ProxyGroupType::Fallback:
|
||||||
singlegroup["url"] = x.Url;
|
singlegroup["url"] = x.Url;
|
||||||
if(x.Interval > 0)
|
if (x.Interval > 0)
|
||||||
singlegroup["interval"] = x.Interval;
|
singlegroup["interval"] = x.Interval;
|
||||||
if(x.Tolerance > 0)
|
if (x.Tolerance > 0)
|
||||||
singlegroup["tolerance"] = x.Tolerance;
|
singlegroup["tolerance"] = x.Tolerance;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -732,7 +729,7 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
}
|
}
|
||||||
if (!filtered_nodelist.empty())
|
if (!filtered_nodelist.empty())
|
||||||
singlegroup["proxies"] = filtered_nodelist;
|
singlegroup["proxies"] = filtered_nodelist;
|
||||||
if(group_block)
|
if (group_block)
|
||||||
singlegroup.SetStyle(YAML::EmitterStyle::Block);
|
singlegroup.SetStyle(YAML::EmitterStyle::Block);
|
||||||
else
|
else
|
||||||
singlegroup.SetStyle(YAML::EmitterStyle::Flow);
|
singlegroup.SetStyle(YAML::EmitterStyle::Flow);
|
||||||
@@ -748,13 +745,15 @@ proxyToClash(std::vector<Proxy> &nodes, YAML::Node &yamlnode, const ProxyGroupCo
|
|||||||
if (!replace_flag)
|
if (!replace_flag)
|
||||||
original_groups.push_back(singlegroup);
|
original_groups.push_back(singlegroup);
|
||||||
}
|
}
|
||||||
if(group_compact)
|
if (group_compact)
|
||||||
original_groups.SetStyle(YAML::EmitterStyle::Flow);
|
original_groups.SetStyle(YAML::EmitterStyle::Flow);
|
||||||
|
|
||||||
if (ext.clash_new_field_name)
|
if (ext.clash_new_field_name)
|
||||||
yamlnode["proxy-groups"] = original_groups;
|
yamlnode["proxy-groups"] = original_groups;
|
||||||
else
|
else
|
||||||
yamlnode["Proxy Group"] = original_groups;
|
yamlnode["Proxy Group"] = original_groups;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void formatterShortId(std::string &input) {
|
void formatterShortId(std::string &input) {
|
||||||
@@ -786,7 +785,8 @@ void formatterShortId(std::string &input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string proxyToClash(std::vector<Proxy> &nodes, const std::string &base_conf,
|
std::string proxyToClash(std::vector<Proxy> &nodes, const std::string &base_conf,
|
||||||
std::vector<RulesetContent> &ruleset_content_array, const ProxyGroupConfigs &extra_proxy_group,
|
std::vector<RulesetContent> &ruleset_content_array,
|
||||||
|
const ProxyGroupConfigs &extra_proxy_group,
|
||||||
bool clashR, extra_settings &ext) {
|
bool clashR, extra_settings &ext) {
|
||||||
YAML::Node yamlnode;
|
YAML::Node yamlnode;
|
||||||
|
|
||||||
@@ -861,7 +861,8 @@ std::string generatePeer(Proxy &node, bool client_id_as_reserved = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf,
|
std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf,
|
||||||
std::vector<RulesetContent> &ruleset_content_array, const ProxyGroupConfigs &extra_proxy_group,
|
std::vector<RulesetContent> &ruleset_content_array,
|
||||||
|
const ProxyGroupConfigs &extra_proxy_group,
|
||||||
int surge_ver, extra_settings &ext) {
|
int surge_ver, extra_settings &ext) {
|
||||||
INIReader ini;
|
INIReader ini;
|
||||||
std::string output_nodelist;
|
std::string output_nodelist;
|
||||||
@@ -896,8 +897,8 @@ 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;
|
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;
|
||||||
|
|
||||||
tribool udp = ext.udp, tfo = ext.tfo, scv = ext.skip_cert_verify, tls13 = ext.tls13;
|
tribool udp = ext.udp, tfo = ext.tfo, scv = ext.skip_cert_verify, tls13 = ext.tls13;
|
||||||
@@ -912,7 +913,8 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
switch (x.Type) {
|
switch (x.Type) {
|
||||||
case ProxyType::Shadowsocks:
|
case ProxyType::Shadowsocks:
|
||||||
if (surge_ver >= 3 || surge_ver == -3) {
|
if (surge_ver >= 3 || surge_ver == -3) {
|
||||||
proxy = "ss, " + hostname + ", " + port + ", encrypt-method=" + method + ", password=" + password;
|
proxy = "ss, " + hostname + ", " + port + ", encrypt-method=" + method + ", password=" +
|
||||||
|
password;
|
||||||
} else {
|
} else {
|
||||||
proxy = "custom, " + hostname + ", " + port + ", " + method + ", " + password +
|
proxy = "custom, " + hostname + ", " + port + ", " + method + ", " + password +
|
||||||
", https://github.com/pobizhe/SSEncrypt/raw/master/SSEncrypt.module";
|
", https://github.com/pobizhe/SSEncrypt/raw/master/SSEncrypt.module";
|
||||||
@@ -1031,17 +1033,17 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
proxy += ", version=" + std::to_string(x.SnellVersion);
|
proxy += ", version=" + std::to_string(x.SnellVersion);
|
||||||
break;
|
break;
|
||||||
case ProxyType::Hysteria2:
|
case ProxyType::Hysteria2:
|
||||||
if(surge_ver < 4)
|
if (surge_ver < 4)
|
||||||
continue;
|
continue;
|
||||||
proxy = "hysteria, " + hostname + ", " + port + ", password=" + password;
|
proxy = "hysteria, " + hostname + ", " + port + ", password=" + password;
|
||||||
if(x.DownSpeed)
|
if (x.DownSpeed)
|
||||||
proxy += ", download-bandwidth=" + x.DownSpeed;
|
proxy += ", download-bandwidth=" + x.DownSpeed;
|
||||||
|
|
||||||
if(!scv.is_undef())
|
if (!scv.is_undef())
|
||||||
proxy += ",skip-cert-verify=" + std::string(scv.get() ? "true" : "false");
|
proxy += ",skip-cert-verify=" + std::string(scv.get() ? "true" : "false");
|
||||||
if(!x.Fingerprint.empty())
|
if (!x.Fingerprint.empty())
|
||||||
proxy += ",server-cert-fingerprint-sha256=" + x.Fingerprint;
|
proxy += ",server-cert-fingerprint-sha256=" + x.Fingerprint;
|
||||||
if(!x.SNI.empty())
|
if (!x.SNI.empty())
|
||||||
proxy += ",sni=" + x.SNI;
|
proxy += ",sni=" + x.SNI;
|
||||||
break;
|
break;
|
||||||
case ProxyType::WireGuard:
|
case ProxyType::WireGuard:
|
||||||
@@ -1094,15 +1096,14 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
string_array filtered_nodelist;
|
string_array filtered_nodelist;
|
||||||
std::string group;
|
std::string group;
|
||||||
|
|
||||||
switch(x.Type)
|
switch (x.Type) {
|
||||||
{
|
|
||||||
case ProxyGroupType::Select:
|
case ProxyGroupType::Select:
|
||||||
case ProxyGroupType::Smart:
|
case ProxyGroupType::Smart:
|
||||||
case ProxyGroupType::URLTest:
|
case ProxyGroupType::URLTest:
|
||||||
case ProxyGroupType::Fallback:
|
case ProxyGroupType::Fallback:
|
||||||
break;
|
break;
|
||||||
case ProxyGroupType::LoadBalance:
|
case ProxyGroupType::LoadBalance:
|
||||||
if(surge_ver < 1 && surge_ver != -3)
|
if (surge_ver < 1 && surge_ver != -3)
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
case ProxyGroupType::SSID:
|
case ProxyGroupType::SSID:
|
||||||
@@ -1150,7 +1151,8 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ext.enable_rule_generator)
|
if (ext.enable_rule_generator)
|
||||||
rulesetToSurge(ini, ruleset_content_array, surge_ver, ext.overwrite_original_rules, ext.managed_config_prefix);
|
rulesetToSurge(ini, ruleset_content_array, surge_ver, ext.overwrite_original_rules,
|
||||||
|
ext.managed_config_prefix);
|
||||||
|
|
||||||
return ini.to_string();
|
return ini.to_string();
|
||||||
}
|
}
|
||||||
@@ -1179,7 +1181,8 @@ std::string proxyToSingle(std::vector<Proxy> &nodes, int types, extra_settings &
|
|||||||
if (std::find(ssr_ciphers.begin(), ssr_ciphers.end(), method) != ssr_ciphers.end() &&
|
if (std::find(ssr_ciphers.begin(), ssr_ciphers.end(), method) != ssr_ciphers.end() &&
|
||||||
plugin.empty())
|
plugin.empty())
|
||||||
proxyStr = "ssr://" + urlSafeBase64Encode(
|
proxyStr = "ssr://" + urlSafeBase64Encode(
|
||||||
hostname + ":" + port + ":origin:" + method + ":plain:" + urlSafeBase64Encode(password) \
|
hostname + ":" + port + ":origin:" + method + ":plain:" +
|
||||||
|
urlSafeBase64Encode(password) \
|
||||||
+ "/?group=" + urlSafeBase64Encode(x.Group) + "&remarks=" + urlSafeBase64Encode(remark));
|
+ "/?group=" + urlSafeBase64Encode(x.Group) + "&remarks=" + urlSafeBase64Encode(remark));
|
||||||
} else
|
} else
|
||||||
continue;
|
continue;
|
||||||
@@ -1195,7 +1198,8 @@ std::string proxyToSingle(std::vector<Proxy> &nodes, int types, extra_settings &
|
|||||||
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")
|
||||||
proxyStr =
|
proxyStr =
|
||||||
"ss://" + urlSafeBase64Encode(method + ":" + password) + "@" + hostname + ":" + port +
|
"ss://" + urlSafeBase64Encode(method + ":" + password) + "@" + hostname + ":" +
|
||||||
|
port +
|
||||||
"#" + urlEncode(remark);
|
"#" + urlEncode(remark);
|
||||||
} else
|
} else
|
||||||
continue;
|
continue;
|
||||||
@@ -1247,7 +1251,8 @@ std::string proxyToSSSub(std::string base_conf, std::vector<Proxy> &nodes, extra
|
|||||||
base_conf = "{}";
|
base_conf = "{}";
|
||||||
rapidjson::ParseResult result = base.Parse(base_conf.data());
|
rapidjson::ParseResult result = base.Parse(base_conf.data());
|
||||||
if (!result)
|
if (!result)
|
||||||
writeLog(0, std::string("SIP008 base loader failed with error: ") + rapidjson::GetParseError_En(result.Code()) +
|
writeLog(0, std::string("SIP008 base loader failed with error: ") +
|
||||||
|
rapidjson::GetParseError_En(result.Code()) +
|
||||||
" (" + std::to_string(result.Offset()) + ")", LOG_LEVEL_ERROR);
|
" (" + std::to_string(result.Offset()) + ")", LOG_LEVEL_ERROR);
|
||||||
|
|
||||||
rapidjson::Value proxies(rapidjson::kArrayType);
|
rapidjson::Value proxies(rapidjson::kArrayType);
|
||||||
@@ -1289,7 +1294,8 @@ std::string proxyToSSSub(std::string base_conf, std::vector<Proxy> &nodes, extra
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
proxyToQuan(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector<RulesetContent> &ruleset_content_array,
|
proxyToQuan(std::vector<Proxy> &nodes, const std::string &base_conf,
|
||||||
|
std::vector<RulesetContent> &ruleset_content_array,
|
||||||
const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext) {
|
const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext) {
|
||||||
INIReader ini;
|
INIReader ini;
|
||||||
ini.store_any_line = true;
|
ini.store_any_line = true;
|
||||||
@@ -1340,7 +1346,8 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
|
|||||||
if (method == "auto")
|
if (method == "auto")
|
||||||
method = "chacha20-ietf-poly1305";
|
method = "chacha20-ietf-poly1305";
|
||||||
proxyStr =
|
proxyStr =
|
||||||
x.Remark + " = vmess, " + hostname + ", " + port + ", " + method + ", \"" + id + "\", group=" +
|
x.Remark + " = vmess, " + hostname + ", " + port + ", " + method + ", \"" + id +
|
||||||
|
"\", group=" +
|
||||||
x.Group;
|
x.Group;
|
||||||
if (tlssecure) {
|
if (tlssecure) {
|
||||||
proxyStr += ", over-tls=true, tls-host=" + host;
|
proxyStr += ", over-tls=true, tls-host=" + host;
|
||||||
@@ -1382,7 +1389,8 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
|
|||||||
proxyStr += "&group=" + urlSafeBase64Encode(x.Group) + "#" + urlEncode(x.Remark);
|
proxyStr += "&group=" + urlSafeBase64Encode(x.Group) + "#" + urlEncode(x.Remark);
|
||||||
} else {
|
} else {
|
||||||
proxyStr =
|
proxyStr =
|
||||||
x.Remark + " = shadowsocks, " + hostname + ", " + port + ", " + method + ", \"" + password +
|
x.Remark + " = shadowsocks, " + hostname + ", " + port + ", " + method + ", \"" +
|
||||||
|
password +
|
||||||
"\", group=" + x.Group;
|
"\", group=" + x.Group;
|
||||||
if (plugin == "obfs-local" && !pluginopts.empty()) {
|
if (plugin == "obfs-local" && !pluginopts.empty()) {
|
||||||
proxyStr += ", " + replaceAllDistinct(pluginopts, ";", ", ");
|
proxyStr += ", " + replaceAllDistinct(pluginopts, ";", ", ");
|
||||||
@@ -1391,7 +1399,8 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
|
|||||||
break;
|
break;
|
||||||
case ProxyType::HTTP:
|
case ProxyType::HTTP:
|
||||||
case ProxyType::HTTPS:
|
case ProxyType::HTTPS:
|
||||||
proxyStr = x.Remark + " = http, upstream-proxy-address=" + hostname + ", upstream-proxy-port=" + port +
|
proxyStr =
|
||||||
|
x.Remark + " = http, upstream-proxy-address=" + hostname + ", upstream-proxy-port=" + port +
|
||||||
", group=" + x.Group;
|
", group=" + x.Group;
|
||||||
if (!username.empty() && !password.empty())
|
if (!username.empty() && !password.empty())
|
||||||
proxyStr += ", upstream-proxy-auth=true, upstream-proxy-username=" + username +
|
proxyStr += ", upstream-proxy-auth=true, upstream-proxy-username=" + username +
|
||||||
@@ -1411,7 +1420,8 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
|
|||||||
proxyStr = "http://" + urlSafeBase64Encode(proxyStr);
|
proxyStr = "http://" + urlSafeBase64Encode(proxyStr);
|
||||||
break;
|
break;
|
||||||
case ProxyType::SOCKS5:
|
case ProxyType::SOCKS5:
|
||||||
proxyStr = x.Remark + " = socks, upstream-proxy-address=" + hostname + ", upstream-proxy-port=" + port +
|
proxyStr = x.Remark + " = socks, upstream-proxy-address=" + hostname + ", upstream-proxy-port=" +
|
||||||
|
port +
|
||||||
", group=" + x.Group;
|
", group=" + x.Group;
|
||||||
if (!username.empty() && !password.empty())
|
if (!username.empty() && !password.empty())
|
||||||
proxyStr += ", upstream-proxy-auth=true, upstream-proxy-username=" + username +
|
proxyStr += ", upstream-proxy-auth=true, upstream-proxy-username=" + username +
|
||||||
@@ -1505,7 +1515,8 @@ void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetC
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string proxyToQuanX(std::vector<Proxy> &nodes, const std::string &base_conf,
|
std::string proxyToQuanX(std::vector<Proxy> &nodes, const std::string &base_conf,
|
||||||
std::vector<RulesetContent> &ruleset_content_array, const ProxyGroupConfigs &extra_proxy_group,
|
std::vector<RulesetContent> &ruleset_content_array,
|
||||||
|
const ProxyGroupConfigs &extra_proxy_group,
|
||||||
extra_settings &ext) {
|
extra_settings &ext) {
|
||||||
INIReader ini;
|
INIReader ini;
|
||||||
ini.store_any_line = true;
|
ini.store_any_line = true;
|
||||||
@@ -1602,7 +1613,8 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
|
|||||||
proxyStr += ", obfs=over-tls, obfs-host=" + host;
|
proxyStr += ", obfs=over-tls, obfs-host=" + host;
|
||||||
break;
|
break;
|
||||||
case ProxyType::Shadowsocks:
|
case ProxyType::Shadowsocks:
|
||||||
proxyStr = "shadowsocks = " + hostname + ":" + port + ", method=" + method + ", password=" + password;
|
proxyStr =
|
||||||
|
"shadowsocks = " + hostname + ":" + port + ", method=" + method + ", password=" + password;
|
||||||
if (!plugin.empty()) {
|
if (!plugin.empty()) {
|
||||||
switch (hash_(plugin)) {
|
switch (hash_(plugin)) {
|
||||||
case "simple-obfs"_hash:
|
case "simple-obfs"_hash:
|
||||||
@@ -1634,7 +1646,8 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case ProxyType::ShadowsocksR:
|
case ProxyType::ShadowsocksR:
|
||||||
proxyStr = "shadowsocks = " + hostname + ":" + port + ", method=" + method + ", password=" + password +
|
proxyStr =
|
||||||
|
"shadowsocks = " + hostname + ":" + port + ", method=" + method + ", password=" + password +
|
||||||
", ssr-protocol=" + protocol;
|
", ssr-protocol=" + protocol;
|
||||||
if (!protoparam.empty())
|
if (!protoparam.empty())
|
||||||
proxyStr += ", ssr-protocol-param=" + protoparam;
|
proxyStr += ", ssr-protocol-param=" + protoparam;
|
||||||
@@ -1644,7 +1657,8 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
|
|||||||
break;
|
break;
|
||||||
case ProxyType::HTTP:
|
case ProxyType::HTTP:
|
||||||
case ProxyType::HTTPS:
|
case ProxyType::HTTPS:
|
||||||
proxyStr = "http = " + hostname + ":" + port + ", username=" + (username.empty() ? "none" : username) +
|
proxyStr =
|
||||||
|
"http = " + hostname + ":" + port + ", username=" + (username.empty() ? "none" : username) +
|
||||||
", password=" + (password.empty() ? "none" : password);
|
", password=" + (password.empty() ? "none" : password);
|
||||||
if (tlssecure) {
|
if (tlssecure) {
|
||||||
proxyStr += ", over-tls=true";
|
proxyStr += ", over-tls=true";
|
||||||
@@ -1759,8 +1773,7 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
|
|||||||
std::string proxies = join(filtered_nodelist, ", ");
|
std::string proxies = join(filtered_nodelist, ", ");
|
||||||
|
|
||||||
std::string singlegroup = type + "=" + x.Name + ", " + proxies;
|
std::string singlegroup = type + "=" + x.Name + ", " + proxies;
|
||||||
if(x.Type != ProxyGroupType::Select && x.Type != ProxyGroupType::SSID)
|
if (x.Type != ProxyGroupType::Select && x.Type != ProxyGroupType::SSID) {
|
||||||
{
|
|
||||||
singlegroup += ", check-interval=" + std::to_string(x.Interval);
|
singlegroup += ", check-interval=" + std::to_string(x.Interval);
|
||||||
if (x.Tolerance > 0)
|
if (x.Tolerance > 0)
|
||||||
singlegroup += ", tolerance=" + std::to_string(x.Tolerance);
|
singlegroup += ", tolerance=" + std::to_string(x.Tolerance);
|
||||||
@@ -1791,7 +1804,8 @@ std::string proxyToSSD(std::vector<Proxy> &nodes, std::string &group, std::strin
|
|||||||
writer.String("password");
|
writer.String("password");
|
||||||
if (!userinfo.empty()) {
|
if (!userinfo.empty()) {
|
||||||
std::string data = replaceAllDistinct(userinfo, "; ", "&");
|
std::string data = replaceAllDistinct(userinfo, "; ", "&");
|
||||||
std::string upload = getUrlArg(data, "upload"), download = getUrlArg(data, "download"), total = getUrlArg(data,
|
std::string upload = getUrlArg(data, "upload"), download = getUrlArg(data, "download"), total = getUrlArg(
|
||||||
|
data,
|
||||||
"total"), expiry = getUrlArg(
|
"total"), expiry = getUrlArg(
|
||||||
data, "expire");
|
data, "expire");
|
||||||
double used = (to_number(upload, 0.0) + to_number(download, 0.0)) / std::pow(1024, 3) * 1.0, tot =
|
double used = (to_number(upload, 0.0) + to_number(download, 0.0)) / std::pow(1024, 3) * 1.0, tot =
|
||||||
@@ -1915,7 +1929,8 @@ void proxyToMellow(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Rulese
|
|||||||
case ProxyType::Shadowsocks:
|
case ProxyType::Shadowsocks:
|
||||||
if (!x.Plugin.empty())
|
if (!x.Plugin.empty())
|
||||||
continue;
|
continue;
|
||||||
proxy = x.Remark + ", ss, ss://" + urlSafeBase64Encode(method + ":" + password) + "@" + hostname + ":" +
|
proxy = x.Remark + ", ss, ss://" + urlSafeBase64Encode(method + ":" + password) + "@" + hostname +
|
||||||
|
":" +
|
||||||
port;
|
port;
|
||||||
break;
|
break;
|
||||||
case ProxyType::VMess:
|
case ProxyType::VMess:
|
||||||
@@ -1950,11 +1965,13 @@ void proxyToMellow(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Rulese
|
|||||||
proxy += "&sockopt.tcpfastopen=" + tfo.get_str();
|
proxy += "&sockopt.tcpfastopen=" + tfo.get_str();
|
||||||
break;
|
break;
|
||||||
case ProxyType::SOCKS5:
|
case ProxyType::SOCKS5:
|
||||||
proxy = x.Remark + ", builtin, socks, address=" + hostname + ", port=" + port + ", user=" + username +
|
proxy = x.Remark + ", builtin, socks, address=" + hostname + ", port=" + port + ", user=" +
|
||||||
|
username +
|
||||||
", pass=" + password;
|
", pass=" + password;
|
||||||
break;
|
break;
|
||||||
case ProxyType::HTTP:
|
case ProxyType::HTTP:
|
||||||
proxy = x.Remark + ", builtin, http, address=" + hostname + ", port=" + port + ", user=" + username +
|
proxy = x.Remark + ", builtin, http, address=" + hostname + ", port=" + port + ", user=" +
|
||||||
|
username +
|
||||||
", pass=" + password;
|
", pass=" + password;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -2019,7 +2036,8 @@ void proxyToMellow(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Rulese
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
proxyToLoon(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector<RulesetContent> &ruleset_content_array,
|
proxyToLoon(std::vector<Proxy> &nodes, const std::string &base_conf,
|
||||||
|
std::vector<RulesetContent> &ruleset_content_array,
|
||||||
const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext) {
|
const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext) {
|
||||||
INIReader ini;
|
INIReader ini;
|
||||||
std::string output_nodelist;
|
std::string output_nodelist;
|
||||||
@@ -2059,7 +2077,8 @@ proxyToLoon(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector
|
|||||||
if (plugin == "simple-obfs" || plugin == "obfs-local") {
|
if (plugin == "simple-obfs" || plugin == "obfs-local") {
|
||||||
if (!pluginopts.empty())
|
if (!pluginopts.empty())
|
||||||
proxy += "," +
|
proxy += "," +
|
||||||
replaceAllDistinct(replaceAllDistinct(pluginopts, ";obfs-host=", ","), "obfs=", "");
|
replaceAllDistinct(replaceAllDistinct(pluginopts, ";obfs-host=", ","), "obfs=",
|
||||||
|
"");
|
||||||
} else if (!plugin.empty())
|
} else if (!plugin.empty())
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
@@ -2244,7 +2263,8 @@ proxyToLoon(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector
|
|||||||
if (x.Type != ProxyGroupType::Select) {
|
if (x.Type != ProxyGroupType::Select) {
|
||||||
group += ",url=" + x.Url + ",interval=" + std::to_string(x.Interval);
|
group += ",url=" + x.Url + ",interval=" + std::to_string(x.Interval);
|
||||||
if (x.Type == ProxyGroupType::LoadBalance) {
|
if (x.Type == ProxyGroupType::LoadBalance) {
|
||||||
group += ",algorithm=" + std::string(x.Strategy == BalanceStrategy::RoundRobin ? "round-robin" : "pcc");
|
group += ",algorithm=" +
|
||||||
|
std::string(x.Strategy == BalanceStrategy::RoundRobin ? "round-robin" : "pcc");
|
||||||
if (x.Timeout > 0)
|
if (x.Timeout > 0)
|
||||||
group += ",max-timeout=" + std::to_string(x.Timeout);
|
group += ",max-timeout=" + std::to_string(x.Timeout);
|
||||||
}
|
}
|
||||||
@@ -2361,7 +2381,8 @@ bool isNumeric(const std::string &str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json, std::vector<RulesetContent> &ruleset_content_array,
|
proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json,
|
||||||
|
std::vector<RulesetContent> &ruleset_content_array,
|
||||||
const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext) {
|
const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext) {
|
||||||
using namespace rapidjson_ext;
|
using namespace rapidjson_ext;
|
||||||
rapidjson::Document::AllocatorType &allocator = json.GetAllocator();
|
rapidjson::Document::AllocatorType &allocator = json.GetAllocator();
|
||||||
@@ -2437,7 +2458,7 @@ proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json, std::vector
|
|||||||
proxy.AddMember("packet_encoding", rapidjson::StringRef("xudp"), allocator);
|
proxy.AddMember("packet_encoding", rapidjson::StringRef("xudp"), allocator);
|
||||||
if (!x.Flow.empty())
|
if (!x.Flow.empty())
|
||||||
proxy.AddMember("flow", rapidjson::StringRef(x.Flow.c_str()), allocator);
|
proxy.AddMember("flow", rapidjson::StringRef(x.Flow.c_str()), allocator);
|
||||||
if(!x.PacketEncoding.empty()){
|
if (!x.PacketEncoding.empty()) {
|
||||||
proxy.AddMember("packet_encoding", rapidjson::StringRef(x.PacketEncoding.c_str()), allocator);
|
proxy.AddMember("packet_encoding", rapidjson::StringRef(x.PacketEncoding.c_str()), allocator);
|
||||||
}
|
}
|
||||||
rapidjson::Value vlesstransport(rapidjson::kObjectType);
|
rapidjson::Value vlesstransport(rapidjson::kObjectType);
|
||||||
@@ -2653,7 +2674,8 @@ proxyToSingBox(std::vector<Proxy> &nodes, rapidjson::Document &json, std::vector
|
|||||||
proxy.AddMember("tls", tls, allocator);
|
proxy.AddMember("tls", tls, allocator);
|
||||||
}
|
}
|
||||||
if (!x.CongestionControl.empty()) {
|
if (!x.CongestionControl.empty()) {
|
||||||
proxy.AddMember("congestion_control", rapidjson::StringRef(x.CongestionControl.c_str()), allocator);
|
proxy.AddMember("congestion_control", rapidjson::StringRef(x.CongestionControl.c_str()),
|
||||||
|
allocator);
|
||||||
}
|
}
|
||||||
if (!x.UdpRelayMode.empty()) {
|
if (!x.UdpRelayMode.empty()) {
|
||||||
proxy.AddMember("udp_relay_mode", rapidjson::StringRef(x.UdpRelayMode.c_str()), allocator);
|
proxy.AddMember("udp_relay_mode", rapidjson::StringRef(x.UdpRelayMode.c_str()), allocator);
|
||||||
|
|||||||
@@ -800,7 +800,7 @@ void readConf()
|
|||||||
return readYAMLConf(yaml);
|
return readYAMLConf(yaml);
|
||||||
}
|
}
|
||||||
toml::value conf = parseToml(prefdata, global.prefPath);
|
toml::value conf = parseToml(prefdata, global.prefPath);
|
||||||
if(!conf.is_uninitialized() && toml::find_or<int>(conf, "version", 0))
|
if(!conf.is_empty() && toml::find_or<int>(conf, "version", 0))
|
||||||
return readTOMLConf(conf);
|
return readTOMLConf(conf);
|
||||||
}
|
}
|
||||||
catch (YAML::Exception &e)
|
catch (YAML::Exception &e)
|
||||||
@@ -1209,7 +1209,7 @@ int loadExternalConfig(std::string &path, ExternalConfig &ext)
|
|||||||
if(yaml.size() && yaml["custom"].IsDefined())
|
if(yaml.size() && yaml["custom"].IsDefined())
|
||||||
return loadExternalYAML(yaml, ext);
|
return loadExternalYAML(yaml, ext);
|
||||||
toml::value conf = parseToml(base_content, path);
|
toml::value conf = parseToml(base_content, path);
|
||||||
if(!conf.is_uninitialized() && toml::find_or<int>(conf, "version", 0))
|
if(!conf.is_empty() && toml::find_or<int>(conf, "version", 0))
|
||||||
return loadExternalTOML(conf, ext);
|
return loadExternalTOML(conf, ext);
|
||||||
}
|
}
|
||||||
catch (YAML::Exception &e)
|
catch (YAML::Exception &e)
|
||||||
|
|||||||
@@ -101,12 +101,12 @@ extern Settings global;
|
|||||||
|
|
||||||
int importItems(string_array &target, bool scope_limit = true);
|
int importItems(string_array &target, bool scope_limit = true);
|
||||||
int loadExternalConfig(std::string &path, ExternalConfig &ext);
|
int loadExternalConfig(std::string &path, ExternalConfig &ext);
|
||||||
template <class T, class... U>
|
//template <class T, class... U>
|
||||||
void find_if_exist(const toml::value &v, const toml::key &k, T& target, U&&... args)
|
//void find_if_exist(const toml::value &v, const toml::key &k, T& target, U&&... args)
|
||||||
{
|
//{
|
||||||
if(v.contains(k)) target = toml::find<T>(v, k);
|
// if(v.contains(k)) target = toml::find<T>(v, k);
|
||||||
if constexpr (sizeof...(args) > 0) find_if_exist(v, std::forward<U>(args)...);
|
// if constexpr (sizeof...(args) > 0) find_if_exist(v, std::forward<U>(args)...);
|
||||||
}
|
//}
|
||||||
template <class... Args>
|
template <class... Args>
|
||||||
void parseGroupTimes(const std::string &src, Args... args)
|
void parseGroupTimes(const std::string &src, Args... args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -127,10 +127,14 @@ struct Proxy {
|
|||||||
String Flow;
|
String Flow;
|
||||||
bool FlowShow = false;
|
bool FlowShow = false;
|
||||||
tribool DisableSni;
|
tribool DisableSni;
|
||||||
|
uint32_t UpSpeed;
|
||||||
|
uint32_t DownSpeed;
|
||||||
|
String SNI;
|
||||||
tribool ReduceRtt;
|
tribool ReduceRtt;
|
||||||
String UdpRelayMode = "native";
|
String UdpRelayMode = "native";
|
||||||
uint16_t RequestTimeout = 15000;
|
uint16_t RequestTimeout = 15000;
|
||||||
String token;
|
String token;
|
||||||
|
String UnderlyingProxy;
|
||||||
std::vector<String> AlpnList;
|
std::vector<String> AlpnList;
|
||||||
String PacketEncoding;
|
String PacketEncoding;
|
||||||
};
|
};
|
||||||
|
|||||||
+29
-28
@@ -36,7 +36,7 @@ std::string modSSMD5 = "f7653207090ce3389115e9c88541afe0";
|
|||||||
|
|
||||||
void commonConstruct(Proxy &node, ProxyType type, const std::string &group, const std::string &remarks,
|
void commonConstruct(Proxy &node, ProxyType type, const std::string &group, const std::string &remarks,
|
||||||
const std::string &server, const std::string &port, const tribool &udp, const tribool &tfo,
|
const std::string &server, const std::string &port, const tribool &udp, const tribool &tfo,
|
||||||
const tribool &scv, const tribool &tls13) {
|
const tribool &scv, const tribool &tls13,const std::string& underlying_proxy) {
|
||||||
node.Type = type;
|
node.Type = type;
|
||||||
node.Group = group;
|
node.Group = group;
|
||||||
node.Remark = remarks;
|
node.Remark = remarks;
|
||||||
@@ -46,6 +46,7 @@ void commonConstruct(Proxy &node, ProxyType type, const std::string &group, cons
|
|||||||
node.TCPFastOpen = tfo;
|
node.TCPFastOpen = tfo;
|
||||||
node.AllowInsecure = scv;
|
node.AllowInsecure = scv;
|
||||||
node.TLS13 = tls13;
|
node.TLS13 = tls13;
|
||||||
|
node.UnderlyingProxy = underlying_proxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vmessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
|
void vmessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
|
||||||
@@ -53,8 +54,8 @@ void vmessConstruct(Proxy &node, const std::string &group, const std::string &re
|
|||||||
const std::string &net, const std::string &cipher, const std::string &path, const std::string &host,
|
const std::string &net, const std::string &cipher, const std::string &path, const std::string &host,
|
||||||
const std::string &edge, const std::string &tls, const std::string &sni,
|
const std::string &edge, const std::string &tls, const std::string &sni,
|
||||||
const std::vector<std::string> &alpnList, tribool udp, tribool tfo,
|
const std::vector<std::string> &alpnList, tribool udp, tribool tfo,
|
||||||
tribool scv, tribool tls13) {
|
tribool scv, tribool tls13,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, ProxyType::VMess, group, remarks, add, port, udp, tfo, scv, tls13);
|
commonConstruct(node, ProxyType::VMess, group, remarks, add, port, udp, tfo, scv, tls13,underlying_proxy);
|
||||||
node.UserId = id.empty() ? "00000000-0000-0000-0000-000000000000" : id;
|
node.UserId = id.empty() ? "00000000-0000-0000-0000-000000000000" : id;
|
||||||
node.AlterId = to_int(aid);
|
node.AlterId = to_int(aid);
|
||||||
node.EncryptMethod = cipher;
|
node.EncryptMethod = cipher;
|
||||||
@@ -76,8 +77,8 @@ void vmessConstruct(Proxy &node, const std::string &group, const std::string &re
|
|||||||
void ssrConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
void ssrConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
||||||
const std::string &port, const std::string &protocol, const std::string &method,
|
const std::string &port, const std::string &protocol, const std::string &method,
|
||||||
const std::string &obfs, const std::string &password, const std::string &obfsparam,
|
const std::string &obfs, const std::string &password, const std::string &obfsparam,
|
||||||
const std::string &protoparam, tribool udp, tribool tfo, tribool scv) {
|
const std::string &protoparam, tribool udp, tribool tfo, tribool scv,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, ProxyType::ShadowsocksR, group, remarks, server, port, udp, tfo, scv, tribool());
|
commonConstruct(node, ProxyType::ShadowsocksR, group, remarks, server, port, udp, tfo, scv, tribool(),underlying_proxy);
|
||||||
node.Password = password;
|
node.Password = password;
|
||||||
node.EncryptMethod = method;
|
node.EncryptMethod = method;
|
||||||
node.Protocol = protocol;
|
node.Protocol = protocol;
|
||||||
@@ -89,8 +90,8 @@ void ssrConstruct(Proxy &node, const std::string &group, const std::string &rema
|
|||||||
void ssConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
void ssConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
||||||
const std::string &port, const std::string &password, const std::string &method,
|
const std::string &port, const std::string &password, const std::string &method,
|
||||||
const std::string &plugin, const std::string &pluginopts, tribool udp, tribool tfo, tribool scv,
|
const std::string &plugin, const std::string &pluginopts, tribool udp, tribool tfo, tribool scv,
|
||||||
tribool tls13) {
|
tribool tls13,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, ProxyType::Shadowsocks, group, remarks, server, port, udp, tfo, scv, tls13);
|
commonConstruct(node, ProxyType::Shadowsocks, group, remarks, server, port, udp, tfo, scv, tls13,underlying_proxy);
|
||||||
node.Password = password;
|
node.Password = password;
|
||||||
node.EncryptMethod = method;
|
node.EncryptMethod = method;
|
||||||
node.Plugin = plugin;
|
node.Plugin = plugin;
|
||||||
@@ -99,17 +100,17 @@ void ssConstruct(Proxy &node, const std::string &group, const std::string &remar
|
|||||||
|
|
||||||
void socksConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
void socksConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
||||||
const std::string &port, const std::string &username, const std::string &password, tribool udp,
|
const std::string &port, const std::string &username, const std::string &password, tribool udp,
|
||||||
tribool tfo, tribool scv) {
|
tribool tfo, tribool scv,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, ProxyType::SOCKS5, group, remarks, server, port, udp, tfo, scv, tribool());
|
commonConstruct(node, ProxyType::SOCKS5, group, remarks, server, port, udp, tfo, scv, tribool(),underlying_proxy);
|
||||||
node.Username = username;
|
node.Username = username;
|
||||||
node.Password = password;
|
node.Password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
void httpConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
void httpConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
||||||
const std::string &port, const std::string &username, const std::string &password, bool tls,
|
const std::string &port, const std::string &username, const std::string &password, bool tls,
|
||||||
tribool tfo, tribool scv, tribool tls13) {
|
tribool tfo, tribool scv, tribool tls13,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, tls ? ProxyType::HTTPS : ProxyType::HTTP, group, remarks, server, port, tribool(), tfo, scv,
|
commonConstruct(node, tls ? ProxyType::HTTPS : ProxyType::HTTP, group, remarks, server, port, tribool(), tfo, scv,
|
||||||
tls13);
|
tls13,underlying_proxy);
|
||||||
node.Username = username;
|
node.Username = username;
|
||||||
node.Password = password;
|
node.Password = password;
|
||||||
node.TLSSecure = tls;
|
node.TLSSecure = tls;
|
||||||
@@ -121,8 +122,8 @@ void trojanConstruct(Proxy &node, const std::string &group, const std::string &r
|
|||||||
const std::vector<std::string> &alpnList,
|
const std::vector<std::string> &alpnList,
|
||||||
bool tlssecure,
|
bool tlssecure,
|
||||||
tribool udp, tribool tfo,
|
tribool udp, tribool tfo,
|
||||||
tribool scv, tribool tls13) {
|
tribool scv, tribool tls13,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, ProxyType::Trojan, group, remarks, server, port, udp, tfo, scv, tls13);
|
commonConstruct(node, ProxyType::Trojan, group, remarks, server, port, udp, tfo, scv, tls13,underlying_proxy);
|
||||||
node.Password = password;
|
node.Password = password;
|
||||||
node.Host = host;
|
node.Host = host;
|
||||||
node.TLSSecure = tlssecure;
|
node.TLSSecure = tlssecure;
|
||||||
@@ -135,8 +136,8 @@ void trojanConstruct(Proxy &node, const std::string &group, const std::string &r
|
|||||||
|
|
||||||
void snellConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
void snellConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
||||||
const std::string &port, const std::string &password, const std::string &obfs,
|
const std::string &port, const std::string &password, const std::string &obfs,
|
||||||
const std::string &host, uint16_t version, tribool udp, tribool tfo, tribool scv) {
|
const std::string &host, uint16_t version, tribool udp, tribool tfo, tribool scv,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, ProxyType::Snell, group, remarks, server, port, udp, tfo, scv, tribool());
|
commonConstruct(node, ProxyType::Snell, group, remarks, server, port, udp, tfo, scv, tribool(),underlying_proxy);
|
||||||
node.Password = password;
|
node.Password = password;
|
||||||
node.OBFS = obfs;
|
node.OBFS = obfs;
|
||||||
node.Host = host;
|
node.Host = host;
|
||||||
@@ -147,8 +148,8 @@ void wireguardConstruct(Proxy &node, const std::string &group, const std::string
|
|||||||
const std::string &port, const std::string &selfIp, const std::string &selfIpv6,
|
const std::string &port, const std::string &selfIp, const std::string &selfIpv6,
|
||||||
const std::string &privKey, const std::string &pubKey, const std::string &psk,
|
const std::string &privKey, const std::string &pubKey, const std::string &psk,
|
||||||
const string_array &dns, const std::string &mtu, const std::string &keepalive,
|
const string_array &dns, const std::string &mtu, const std::string &keepalive,
|
||||||
const std::string &testUrl, const std::string &clientId, const tribool &udp) {
|
const std::string &testUrl, const std::string &clientId, const tribool &udp,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, ProxyType::WireGuard, group, remarks, server, port, udp, tribool(), tribool(), tribool());
|
commonConstruct(node, ProxyType::WireGuard, group, remarks, server, port, udp, tribool(), tribool(), tribool(),underlying_proxy);
|
||||||
node.SelfIP = selfIp;
|
node.SelfIP = selfIp;
|
||||||
node.SelfIPv6 = selfIpv6;
|
node.SelfIPv6 = selfIpv6;
|
||||||
node.PrivateKey = privKey;
|
node.PrivateKey = privKey;
|
||||||
@@ -168,8 +169,8 @@ void hysteriaConstruct(Proxy &node, const std::string &group, const std::string
|
|||||||
const std::string &obfsParam, const std::string &insecure, const std::string &ports,
|
const std::string &obfsParam, const std::string &insecure, const std::string &ports,
|
||||||
const std::string &sni, tribool udp,
|
const std::string &sni, tribool udp,
|
||||||
tribool tfo, tribool scv,
|
tribool tfo, tribool scv,
|
||||||
tribool tls13) {
|
tribool tls13,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, ProxyType::Hysteria, group, remarks, add, port, udp, tfo, scv, tls13);
|
commonConstruct(node, ProxyType::Hysteria, group, remarks, add, port, udp, tfo, scv, tls13,underlying_proxy);
|
||||||
node.Auth = auth;
|
node.Auth = auth;
|
||||||
node.Host = (host.empty() && !isIPv4(add) && !isIPv6(add)) ? add.data() : trim(host);
|
node.Host = (host.empty() && !isIPv4(add) && !isIPv6(add)) ? add.data() : trim(host);
|
||||||
node.UpMbps = up;
|
node.UpMbps = up;
|
||||||
@@ -191,8 +192,8 @@ void vlessConstruct(Proxy &node, const std::string &group, const std::string &re
|
|||||||
const std::string &pbk, const std::string &sid, const std::string &fp, const std::string &sni,
|
const std::string &pbk, const std::string &sid, const std::string &fp, const std::string &sni,
|
||||||
const std::vector<std::string> &alpnList,const std::string &packet_encoding,
|
const std::vector<std::string> &alpnList,const std::string &packet_encoding,
|
||||||
tribool udp, tribool tfo,
|
tribool udp, tribool tfo,
|
||||||
tribool scv, tribool tls13) {
|
tribool scv, tribool tls13,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, ProxyType::VLESS, group, remarks, add, port, udp, tfo, scv, tls13);
|
commonConstruct(node, ProxyType::VLESS, group, remarks, add, port, udp, tfo, scv, tls13,underlying_proxy);
|
||||||
node.UserId = id.empty() ? "00000000-0000-0000-0000-000000000000" : id;
|
node.UserId = id.empty() ? "00000000-0000-0000-0000-000000000000" : id;
|
||||||
node.AlterId = to_int(aid);
|
node.AlterId = to_int(aid);
|
||||||
node.EncryptMethod = cipher;
|
node.EncryptMethod = cipher;
|
||||||
@@ -231,8 +232,8 @@ void hysteria2Construct(Proxy &node, const std::string &group, const std::string
|
|||||||
const std::string &obfsParam, const std::string &obfsPassword, const std::string &sni,
|
const std::string &obfsParam, const std::string &obfsPassword, const std::string &sni,
|
||||||
const std::string &publicKey, const std::string &ports,
|
const std::string &publicKey, const std::string &ports,
|
||||||
tribool udp, tribool tfo,
|
tribool udp, tribool tfo,
|
||||||
tribool scv) {
|
tribool scv,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, ProxyType::Hysteria2, group, remarks, add, port, udp, tfo, scv, tribool());
|
commonConstruct(node, ProxyType::Hysteria2, group, remarks, add, port, udp, tfo, scv, tribool(),underlying_proxy);
|
||||||
node.Password = password;
|
node.Password = password;
|
||||||
node.Host = (host.empty() && !isIPv4(add) && !isIPv6(add)) ? add.data() : trim(host);
|
node.Host = (host.empty() && !isIPv4(add) && !isIPv6(add)) ? add.data() : trim(host);
|
||||||
node.UpMbps = up;
|
node.UpMbps = up;
|
||||||
@@ -251,8 +252,8 @@ void tuicConstruct(Proxy &node, const std::string &group, const std::string &rem
|
|||||||
const std::string &sni, const std::string &uuid, const std::string &udpRelayMode,
|
const std::string &sni, const std::string &uuid, const std::string &udpRelayMode,
|
||||||
const std::string &token,
|
const std::string &token,
|
||||||
tribool udp, tribool tfo,
|
tribool udp, tribool tfo,
|
||||||
tribool scv, tribool reduceRtt, tribool disableSni, uint16_t request_timeout) {
|
tribool scv, tribool reduceRtt, tribool disableSni, uint16_t request_timeout,const std::string& underlying_proxy) {
|
||||||
commonConstruct(node, ProxyType::TUIC, group, remarks, add, port, udp, tfo, scv, tribool());
|
commonConstruct(node, ProxyType::TUIC, group, remarks, add, port, udp, tfo, scv, tribool(),underlying_proxy);
|
||||||
node.Password = password;
|
node.Password = password;
|
||||||
node.Alpn = alpn;
|
node.Alpn = alpn;
|
||||||
node.ServerName = sni;
|
node.ServerName = sni;
|
||||||
@@ -1309,7 +1310,7 @@ void explodeClash(Node yamlnode, std::vector<Proxy> &nodes) {
|
|||||||
singleproxy["ipv6"] >>= ipv6;
|
singleproxy["ipv6"] >>= ipv6;
|
||||||
|
|
||||||
wireguardConstruct(node, group, ps, server, port, ip, ipv6, private_key, public_key, password,
|
wireguardConstruct(node, group, ps, server, port, ip, ipv6, private_key, public_key, password,
|
||||||
dns_server, mtu, "0", "", "", udp);
|
dns_server, mtu, "0", "", "", udp,"");
|
||||||
break;
|
break;
|
||||||
case "vless"_hash:
|
case "vless"_hash:
|
||||||
group = XRAY_DEFAULT_GROUP;
|
group = XRAY_DEFAULT_GROUP;
|
||||||
@@ -2160,7 +2161,7 @@ bool explodeSurge(std::string surge, std::vector<Proxy> &nodes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
wireguardConstruct(node, WG_DEFAULT_GROUP, remarks, "", "0", ip, ipv6, private_key, "", "", dns_servers,
|
wireguardConstruct(node, WG_DEFAULT_GROUP, remarks, "", "0", ip, ipv6, private_key, "", "", dns_servers,
|
||||||
mtu, keepalive, test_url, "", udp);
|
mtu, keepalive, test_url, "", udp,"");
|
||||||
parsePeers(node, peer);
|
parsePeers(node, peer);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -2823,7 +2824,7 @@ void explodeSingbox(rapidjson::Value &outbounds, std::vector<Proxy> &nodes) {
|
|||||||
password = GetMember(singboxNode, "pre_shared_key");
|
password = GetMember(singboxNode, "pre_shared_key");
|
||||||
dns_server = {"8.8.8.8"};
|
dns_server = {"8.8.8.8"};
|
||||||
wireguardConstruct(node, group, ps, server, port, ip, ipv6, private_key, public_key, password,
|
wireguardConstruct(node, group, ps, server, port, ip, ipv6, private_key, public_key, password,
|
||||||
dns_server, mtu, "0", "", "", udp);
|
dns_server, mtu, "0", "", "", udp,"");
|
||||||
break;
|
break;
|
||||||
case "socks"_hash:
|
case "socks"_hash:
|
||||||
group = SOCKS_DEFAULT_GROUP;
|
group = SOCKS_DEFAULT_GROUP;
|
||||||
|
|||||||
+11
-11
@@ -25,7 +25,7 @@ void hysteriaConstruct(Proxy &node, const std::string &group, const std::string
|
|||||||
const std::string &down, const std::string &alpn, const std::string &obfsParam,
|
const std::string &down, const std::string &alpn, const std::string &obfsParam,
|
||||||
const std::string &insecure, const std::string &ports, const std::string &sni,
|
const std::string &insecure, const std::string &ports, const std::string &sni,
|
||||||
tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),
|
tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),
|
||||||
tribool tls13 = tribool());
|
tribool tls13 = tribool(),const std::string& underlying_proxy="");
|
||||||
|
|
||||||
void hysteria2Construct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
|
void hysteria2Construct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
|
||||||
const std::string &port, const std::string &password, const std::string &host,
|
const std::string &port, const std::string &password, const std::string &host,
|
||||||
@@ -33,7 +33,7 @@ void hysteria2Construct(Proxy &node, const std::string &group, const std::string
|
|||||||
const std::string &obfsParam, const std::string &obfsPassword, const std::string &sni,
|
const std::string &obfsParam, const std::string &obfsPassword, const std::string &sni,
|
||||||
const std::string &publicKey, const std::string &ports,
|
const std::string &publicKey, const std::string &ports,
|
||||||
tribool udp, tribool tfo,
|
tribool udp, tribool tfo,
|
||||||
tribool scv);
|
tribool scv,const std::string& underlying_proxy="");
|
||||||
|
|
||||||
void vlessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
|
void vlessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
|
||||||
const std::string &port, const std::string &type, const std::string &id, const std::string &aid,
|
const std::string &port, const std::string &type, const std::string &id, const std::string &aid,
|
||||||
@@ -42,45 +42,45 @@ void vlessConstruct(Proxy &node, const std::string &group, const std::string &re
|
|||||||
const std::string &pkd, const std::string &sid, const std::string &fp, const std::string &sni,
|
const std::string &pkd, const std::string &sid, const std::string &fp, const std::string &sni,
|
||||||
const std::vector<std::string> &alpnList,const std::string &packet_encoding,
|
const std::vector<std::string> &alpnList,const std::string &packet_encoding,
|
||||||
tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),
|
tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),
|
||||||
tribool tls13 = tribool());
|
tribool tls13 = tribool(),const std::string& underlying_proxy="");
|
||||||
|
|
||||||
void vmessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
|
void vmessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
|
||||||
const std::string &port, const std::string &type, const std::string &id, const std::string &aid,
|
const std::string &port, const std::string &type, const std::string &id, const std::string &aid,
|
||||||
const std::string &net, const std::string &cipher, const std::string &path, const std::string &host,
|
const std::string &net, const std::string &cipher, const std::string &path, const std::string &host,
|
||||||
const std::string &edge, const std::string &tls, const std::string &sni,
|
const std::string &edge, const std::string &tls, const std::string &sni,
|
||||||
const std::vector<std::string> &alpnList, tribool udp = tribool(),
|
const std::vector<std::string> &alpnList, tribool udp = tribool(),
|
||||||
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
|
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool(),const std::string& underlying_proxy="");
|
||||||
|
|
||||||
void ssrConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
void ssrConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
||||||
const std::string &port, const std::string &protocol, const std::string &method,
|
const std::string &port, const std::string &protocol, const std::string &method,
|
||||||
const std::string &obfs, const std::string &password, const std::string &obfsparam,
|
const std::string &obfs, const std::string &password, const std::string &obfsparam,
|
||||||
const std::string &protoparam, tribool udp = tribool(), tribool tfo = tribool(),
|
const std::string &protoparam, tribool udp = tribool(), tribool tfo = tribool(),
|
||||||
tribool scv = tribool());
|
tribool scv = tribool(),const std::string& underlying_proxy="");
|
||||||
|
|
||||||
void ssConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
void ssConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
||||||
const std::string &port, const std::string &password, const std::string &method,
|
const std::string &port, const std::string &password, const std::string &method,
|
||||||
const std::string &plugin, const std::string &pluginopts, tribool udp = tribool(),
|
const std::string &plugin, const std::string &pluginopts, tribool udp = tribool(),
|
||||||
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
|
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool(),const std::string& underlying_proxy="");
|
||||||
|
|
||||||
void socksConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
void socksConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
||||||
const std::string &port, const std::string &username, const std::string &password,
|
const std::string &port, const std::string &username, const std::string &password,
|
||||||
tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool());
|
tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),const std::string& underlying_proxy="");
|
||||||
|
|
||||||
void httpConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
void httpConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
||||||
const std::string &port, const std::string &username, const std::string &password, bool tls,
|
const std::string &port, const std::string &username, const std::string &password, bool tls,
|
||||||
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool());
|
tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool(),const std::string& underlying_proxy="");
|
||||||
|
|
||||||
void trojanConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
void trojanConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
||||||
const std::string &port, const std::string &password, const std::string &network,
|
const std::string &port, const std::string &password, const std::string &network,
|
||||||
const std::string &host, const std::string &path, const std::string &fp, const std::string &sni,
|
const std::string &host, const std::string &path, const std::string &fp, const std::string &sni,
|
||||||
const std::vector<std::string> &alpnList,
|
const std::vector<std::string> &alpnList,
|
||||||
bool tlssecure, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),
|
bool tlssecure, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),
|
||||||
tribool tls13 = tribool());
|
tribool tls13 = tribool(),const std::string& underlying_proxy="");
|
||||||
|
|
||||||
void snellConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
void snellConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server,
|
||||||
const std::string &port, const std::string &password, const std::string &obfs,
|
const std::string &port, const std::string &password, const std::string &obfs,
|
||||||
const std::string &host, uint16_t version = 0, tribool udp = tribool(), tribool tfo = tribool(),
|
const std::string &host, uint16_t version = 0, tribool udp = tribool(), tribool tfo = tribool(),
|
||||||
tribool scv = tribool());
|
tribool scv = tribool(),const std::string& underlying_proxy="");
|
||||||
|
|
||||||
void tuicConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
|
void tuicConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add,
|
||||||
const std::string &port, const std::string &password, const std::string &congestion_control,
|
const std::string &port, const std::string &password, const std::string &congestion_control,
|
||||||
@@ -89,7 +89,7 @@ void tuicConstruct(Proxy &node, const std::string &group, const std::string &rem
|
|||||||
const std::string &token,
|
const std::string &token,
|
||||||
tribool udp = tribool(), tribool tfo = tribool(),
|
tribool udp = tribool(), tribool tfo = tribool(),
|
||||||
tribool scv = tribool(), tribool reduceRtt = tribool(), tribool disableSni = tribool(),
|
tribool scv = tribool(), tribool reduceRtt = tribool(), tribool disableSni = tribool(),
|
||||||
uint16_t request_timeout = 15000);
|
uint16_t request_timeout = 15000,const std::string& underlying_proxy="");
|
||||||
|
|
||||||
void explodeVmess(std::string vmess, Proxy &node);
|
void explodeVmess(std::string vmess, Proxy &node);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user