mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-05 03:02:06 +00:00
Enhancements
Add Snell version to Surge configs. Optimize codes.
This commit is contained in:
1 file changed
+8
-5
@@ -645,7 +645,7 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
tls13.define(x.TLS13);
|
tls13.define(x.TLS13);
|
||||||
|
|
||||||
std::string proxy;
|
std::string proxy;
|
||||||
string_array args;
|
string_array args, headers;
|
||||||
|
|
||||||
switch(x.Type)
|
switch(x.Type)
|
||||||
{
|
{
|
||||||
@@ -683,12 +683,13 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
case "tcp"_hash:
|
case "tcp"_hash:
|
||||||
break;
|
break;
|
||||||
case "ws"_hash:
|
case "ws"_hash:
|
||||||
if(host.empty())
|
|
||||||
proxy += ", ws=true, ws-path=" + path + ", sni=" + hostname;
|
proxy += ", ws=true, ws-path=" + path + ", sni=" + hostname;
|
||||||
else
|
if(!host.empty())
|
||||||
proxy += ", ws=true, ws-path=" + path + ", sni=" + hostname + ", ws-headers=Host:" + host;
|
headers.push_back("Host:" + host);
|
||||||
if(!edge.empty())
|
if(!edge.empty())
|
||||||
proxy += "|Edge:" + edge;
|
headers.push_back("Edge:" + edge);
|
||||||
|
if(!headers.empty())
|
||||||
|
proxy += ", ws-headers=" + join(headers, "|");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
@@ -766,6 +767,8 @@ std::string proxyToSurge(std::vector<Proxy> &nodes, const std::string &base_conf
|
|||||||
if(!host.empty())
|
if(!host.empty())
|
||||||
proxy += ", obfs-host=" + host;
|
proxy += ", obfs-host=" + host;
|
||||||
}
|
}
|
||||||
|
if(x.SnellVersion != 0)
|
||||||
|
proxy += ", version=" + std::to_string(x.SnellVersion);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in new issue
Block a user