Enhancements

Add support for SOCKS5 nodes in Quantumult X configs.
Fix GHA Windows build error.
This commit is contained in:
Tindy X
2022-08-05 18:38:13 +08:00
parent e34add21d2
commit f9713b43b9
2 changed files with 24 additions and 11 deletions

View File

@@ -3,7 +3,7 @@ set -xe
git clone https://github.com/curl/curl --depth=1
cd curl
cmake -DCMAKE_BUILD_TYPE=Release -DCURL_USE_LIBSSH2=OFF -DHTTP_ONLY=ON -DCURL_USE_SCHANNEL=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CURL_EXE=OFF -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" -DHAVE_LIBIDN2=OFF .
cmake -DCMAKE_BUILD_TYPE=Release -DCURL_USE_LIBSSH2=OFF -DHTTP_ONLY=ON -DCURL_USE_SCHANNEL=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CURL_EXE=OFF -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" -DHAVE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF .
make install -j4
cd ..
@@ -52,5 +52,5 @@ rm -f C:/Strawberry/perl/bin/pkg-config C:/Strawberry/perl/bin/pkg-config.bat
cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" .
make -j4
rm subconverter.exe
g++ $(find CMakeFiles/subconverter.dir/src -name "*.obj") curl/lib/libcurl.a -o base/subconverter.exe -static -levent -lpcre2-8 -lquickjs -llibcron -lyaml-cpp -liphlpapi -lcrypt32 -lws2_32 -lwsock32 -lz -s
g++ $(find CMakeFiles/subconverter.dir/src -name "*.obj") curl/lib/libcurl.a -o base/subconverter.exe -static -lbcrypt -levent -lpcre2-8 -lquickjs -llibcron -lyaml-cpp -liphlpapi -lcrypt32 -lws2_32 -lwsock32 -lz -s
mv base subconverter

View File

@@ -1386,6 +1386,23 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
proxyStr += ", over-tls=false";
}
break;
case ProxyType::SOCKS5:
proxyStr = "socks5 = " + hostname + ":" + port;
if(!username.empty() && !password.empty())
{
proxyStr += ", username=" + username + ", password=" + password;
if(tlssecure)
{
proxyStr += ", over-tls=true, tls-host=" + host;
if(!tls13.is_undef())
proxyStr += ", tls13=" + std::string(tls13 ? "true" : "false");
}
else
{
proxyStr += ", over-tls=false";
}
}
break;
default:
continue;
}
@@ -1393,7 +1410,7 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
proxyStr += ", fast-open=" + tfo.get_str();
if(!udp.is_undef())
proxyStr += ", udp-relay=" + udp.get_str();
if(tlssecure && !scv.is_undef() && (x.Type == ProxyType::HTTP || x.Type == ProxyType::Trojan))
if(tlssecure && !scv.is_undef() && (x.Type != ProxyType::Shadowsocks && x.Type != ProxyType::ShadowsocksR))
proxyStr += ", tls-verification=" + scv.reverse().get_str();
proxyStr += ", tag=" + remark;
@@ -1406,17 +1423,13 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
return;
string_multimap original_groups;
string_array filtered_nodelist;
ini.SetCurrentSection("policy");
ini.GetItems(original_groups);
ini.EraseSection();
std::string singlegroup;
std::string proxies;
string_array vArray;
for(const ProxyGroupConfig &x : extra_proxy_group)
{
eraseElements(filtered_nodelist);
string_array filtered_nodelist;
switch(x.Type)
{
@@ -1464,7 +1477,7 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
});
if(iter != original_groups.end())
{
vArray = split(iter->second, ",");
string_array vArray = split(iter->second, ",");
if(vArray.size() > 1)
{
if(trim(vArray[vArray.size() - 1]).find("img-url") == 0)
@@ -1472,9 +1485,9 @@ void proxyToQuanX(std::vector<Proxy> &nodes, INIReader &ini, std::vector<Ruleset
}
}
proxies = join(filtered_nodelist, ", ");
std::string proxies = join(filtered_nodelist, ", ");
singlegroup = type + "=" + x.Name + ", " + proxies;
std::string singlegroup = type + "=" + x.Name + ", " + proxies;
ini.Set("{NONAME}", singlegroup);
}