mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 02:02:24 +00:00
Fix build error on some platform
This commit is contained in:
5 files changed
+21
-23
No files matched your search
+4
-4
@@ -123,7 +123,7 @@ public:
|
|||||||
if(parsed)
|
if(parsed)
|
||||||
return GetErrorString(last_error);
|
return GetErrorString(last_error);
|
||||||
else
|
else
|
||||||
return "line " + std::__cxx11::to_string(last_error_index) + ": " + GetErrorString(last_error);
|
return "line " + std::to_string(last_error_index) + ": " + GetErrorString(last_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -639,7 +639,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
int SetDouble(std::string section, std::string itemName, double itemVal)
|
int SetDouble(std::string section, std::string itemName, double itemVal)
|
||||||
{
|
{
|
||||||
return Set(section, itemName, std::__cxx11::to_string(itemVal));
|
return Set(section, itemName, std::to_string(itemVal));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -655,7 +655,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
int SetLong(std::string section, std::string itemName, long itemVal)
|
int SetLong(std::string section, std::string itemName, long itemVal)
|
||||||
{
|
{
|
||||||
return Set(section, itemName, std::__cxx11::to_string(itemVal));
|
return Set(section, itemName, std::to_string(itemVal));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -673,7 +673,7 @@ public:
|
|||||||
{
|
{
|
||||||
std::string data;
|
std::string data;
|
||||||
for(auto &x : Array)
|
for(auto &x : Array)
|
||||||
data += std::__cxx11::to_string(x) + separator;
|
data += std::to_string(x) + separator;
|
||||||
data = data.substr(0, data.size() - separator.size());
|
data = data.substr(0, data.size() - separator.size());
|
||||||
return Set(section, itemName, data);
|
return Set(section, itemName, data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
//common settings
|
//common settings
|
||||||
std::string pref_path = "pref.ini";
|
std::string pref_path = "pref.ini";
|
||||||
|
bool generator_mode = false;
|
||||||
string_array def_exclude_remarks, def_include_remarks, rulesets;
|
string_array def_exclude_remarks, def_include_remarks, rulesets;
|
||||||
std::vector<ruleset_content> ruleset_content_array;
|
std::vector<ruleset_content> ruleset_content_array;
|
||||||
std::string listen_address = "127.0.0.1", default_url, managed_config_prefix;
|
std::string listen_address = "127.0.0.1", default_url, managed_config_prefix;
|
||||||
|
|||||||
+4
-7
@@ -82,14 +82,11 @@ template <typename T> static inline void eraseElements(T &target)
|
|||||||
#ifndef HAVE_TO_STRING
|
#ifndef HAVE_TO_STRING
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
namespace __cxx11
|
template <typename T> std::string to_string(const T& n)
|
||||||
{
|
{
|
||||||
template <typename T> std::string to_string(const T& n)
|
std::ostringstream ss;
|
||||||
{
|
ss << n;
|
||||||
std::ostringstream ss;
|
return ss.str();
|
||||||
ss << n;
|
|
||||||
return ss.str();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // HAVE_TO_STRING
|
#endif // HAVE_TO_STRING
|
||||||
|
|||||||
+11
-11
@@ -789,7 +789,7 @@ std::string netchToSurge(std::vector<nodeInfo> &nodes, std::string &base_conf, s
|
|||||||
while(std::count(remarks_list.begin(), remarks_list.end(), remark) > 0)
|
while(std::count(remarks_list.begin(), remarks_list.end(), remark) > 0)
|
||||||
remark = x.remarks = x.remarks + "$";
|
remark = x.remarks = x.remarks + "$";
|
||||||
hostname = GetMember(json, "Hostname");
|
hostname = GetMember(json, "Hostname");
|
||||||
port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
port = std::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
||||||
username = GetMember(json, "Username");
|
username = GetMember(json, "Username");
|
||||||
password = GetMember(json, "Password");
|
password = GetMember(json, "Password");
|
||||||
method = GetMember(json, "EncryptMethod");
|
method = GetMember(json, "EncryptMethod");
|
||||||
@@ -839,7 +839,7 @@ std::string netchToSurge(std::vector<nodeInfo> &nodes, std::string &base_conf, s
|
|||||||
obfs = GetMember(json, "OBFS");
|
obfs = GetMember(json, "OBFS");
|
||||||
obfsparam = GetMember(json, "OBFSParam");
|
obfsparam = GetMember(json, "OBFSParam");
|
||||||
proxy = "external, exec=\"" + ext.surge_ssr_path + "\", args=\"";
|
proxy = "external, exec=\"" + ext.surge_ssr_path + "\", args=\"";
|
||||||
string_array args = {"-l", std::__cxx11::to_string(local_port), "-s", hostname, "-p", port, "-m", method, "-k", password, "-o", obfs, "-O", protocol};
|
string_array args = {"-l", std::to_string(local_port), "-s", hostname, "-p", port, "-m", method, "-k", password, "-o", obfs, "-O", protocol};
|
||||||
if(obfsparam.size())
|
if(obfsparam.size())
|
||||||
{
|
{
|
||||||
args.emplace_back("-g");
|
args.emplace_back("-g");
|
||||||
@@ -855,8 +855,8 @@ std::string netchToSurge(std::vector<nodeInfo> &nodes, std::string &base_conf, s
|
|||||||
return std::move(a) + "\", args=\"" + std::move(b);
|
return std::move(a) + "\", args=\"" + std::move(b);
|
||||||
});
|
});
|
||||||
//std::string ipaddr = (isIPv4(hostname) || isIPv6(hostname)) ? hostname : hostnameToIPAddr(hostname);
|
//std::string ipaddr = (isIPv4(hostname) || isIPv6(hostname)) ? hostname : hostnameToIPAddr(hostname);
|
||||||
//proxy += "\", local-port=" + std::__cxx11::to_string(local_port) + ", addresses=" + ipaddr;
|
//proxy += "\", local-port=" + std::to_string(local_port) + ", addresses=" + ipaddr;
|
||||||
proxy += "\", local-port=" + std::__cxx11::to_string(local_port);
|
proxy += "\", local-port=" + std::to_string(local_port);
|
||||||
local_port++;
|
local_port++;
|
||||||
}
|
}
|
||||||
else if(x.linkType == SPEEDTEST_MESSAGE_FOUNDSOCKS)
|
else if(x.linkType == SPEEDTEST_MESSAGE_FOUNDSOCKS)
|
||||||
@@ -947,7 +947,7 @@ std::string netchToSurge(std::vector<nodeInfo> &nodes, std::string &base_conf, s
|
|||||||
return std::move(a) + "," + std::move(b);
|
return std::move(a) + "," + std::move(b);
|
||||||
});
|
});
|
||||||
if(vArray[1] == "url-test" || vArray[1] == "fallback")
|
if(vArray[1] == "url-test" || vArray[1] == "fallback")
|
||||||
proxy += ",url=" + url + ",interval=" + std::__cxx11::to_string(interval);
|
proxy += ",url=" + url + ",interval=" + std::to_string(interval);
|
||||||
|
|
||||||
ini.Set("{NONAME}", vArray[0] + " = " + proxy); //insert order
|
ini.Set("{NONAME}", vArray[0] + " = " + proxy); //insert order
|
||||||
}
|
}
|
||||||
@@ -990,7 +990,7 @@ std::string netchToSS(std::vector<nodeInfo> &nodes, extra_settings &ext)
|
|||||||
|
|
||||||
remark = x.remarks;
|
remark = x.remarks;
|
||||||
hostname = GetMember(json, "Hostname");
|
hostname = GetMember(json, "Hostname");
|
||||||
port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
port = std::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
||||||
password = GetMember(json, "Password");
|
password = GetMember(json, "Password");
|
||||||
method = GetMember(json, "EncryptMethod");
|
method = GetMember(json, "EncryptMethod");
|
||||||
plugin = GetMember(json, "Plugin");
|
plugin = GetMember(json, "Plugin");
|
||||||
@@ -1057,7 +1057,7 @@ std::string netchToSSR(std::vector<nodeInfo> &nodes, extra_settings &ext)
|
|||||||
|
|
||||||
remark = x.remarks;
|
remark = x.remarks;
|
||||||
hostname = GetMember(json, "Hostname");
|
hostname = GetMember(json, "Hostname");
|
||||||
port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
port = std::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
||||||
password = GetMember(json, "Password");
|
password = GetMember(json, "Password");
|
||||||
method = GetMember(json, "EncryptMethod");
|
method = GetMember(json, "EncryptMethod");
|
||||||
protocol = GetMember(json, "Protocol");
|
protocol = GetMember(json, "Protocol");
|
||||||
@@ -1118,7 +1118,7 @@ std::string netchToVMess(std::vector<nodeInfo> &nodes, extra_settings &ext)
|
|||||||
|
|
||||||
remark = x.remarks;
|
remark = x.remarks;
|
||||||
hostname = GetMember(json, "Hostname");
|
hostname = GetMember(json, "Hostname");
|
||||||
port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
port = std::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
||||||
method = GetMember(json, "EncryptMethod");
|
method = GetMember(json, "EncryptMethod");
|
||||||
id = GetMember(json, "UserID");
|
id = GetMember(json, "UserID");
|
||||||
aid = GetMember(json, "AlterID");
|
aid = GetMember(json, "AlterID");
|
||||||
@@ -1181,7 +1181,7 @@ std::string netchToQuan(std::vector<nodeInfo> &nodes, extra_settings &ext)
|
|||||||
remark = x.remarks;
|
remark = x.remarks;
|
||||||
|
|
||||||
hostname = GetMember(json, "Hostname");
|
hostname = GetMember(json, "Hostname");
|
||||||
port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
port = std::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
||||||
method = GetMember(json, "EncryptMethod");
|
method = GetMember(json, "EncryptMethod");
|
||||||
password = GetMember(json, "Password");
|
password = GetMember(json, "Password");
|
||||||
|
|
||||||
@@ -1274,7 +1274,7 @@ std::string netchToQuanX(std::vector<nodeInfo> &nodes, extra_settings &ext)
|
|||||||
remark = x.remarks;
|
remark = x.remarks;
|
||||||
|
|
||||||
hostname = GetMember(json, "Hostname");
|
hostname = GetMember(json, "Hostname");
|
||||||
port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
port = std::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
||||||
method = GetMember(json, "EncryptMethod");
|
method = GetMember(json, "EncryptMethod");
|
||||||
|
|
||||||
switch(x.linkType)
|
switch(x.linkType)
|
||||||
@@ -1498,7 +1498,7 @@ void netchToMellow(std::vector<nodeInfo> &nodes, INIReader &ini, std::vector<rul
|
|||||||
while(std::count(remarks_list.begin(), remarks_list.end(), remark) > 0)
|
while(std::count(remarks_list.begin(), remarks_list.end(), remark) > 0)
|
||||||
remark = x.remarks = x.remarks + "$";
|
remark = x.remarks = x.remarks + "$";
|
||||||
hostname = GetMember(json, "Hostname");
|
hostname = GetMember(json, "Hostname");
|
||||||
port = std::__cxx11::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
port = std::to_string((unsigned short)stoi(GetMember(json, "Port")));
|
||||||
username = GetMember(json, "Username");
|
username = GetMember(json, "Username");
|
||||||
password = GetMember(json, "Password");
|
password = GetMember(json, "Password");
|
||||||
method = GetMember(json, "EncryptMethod");
|
method = GetMember(json, "EncryptMethod");
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ std::string curlGet(std::string url, std::string proxy)
|
|||||||
std::string buildSocks5ProxyString(std::string addr, int port, std::string username, std::string password)
|
std::string buildSocks5ProxyString(std::string addr, int port, std::string username, std::string password)
|
||||||
{
|
{
|
||||||
std::string authstr = username != "" && password != "" ? username + ":" + password + "@" : "";
|
std::string authstr = username != "" && password != "" ? username + ":" + password + "@" : "";
|
||||||
std::string proxystr = "socks5://" + authstr + addr + ":" + std::__cxx11::to_string(port);
|
std::string proxystr = "socks5://" + authstr + addr + ":" + std::to_string(port);
|
||||||
return proxystr;
|
return proxystr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user