mirror of https://github.com/2dust/v2rayN
Add obfs=http support for sing-box ss
parent
11ec27147a
commit
6eee2c2342
|
@ -238,6 +238,14 @@ namespace v2rayN.Handler
|
||||||
outbound.method = LazyConfig.Instance.GetShadowsocksSecurities(node).Contains(node.security) ? node.security : Global.None;
|
outbound.method = LazyConfig.Instance.GetShadowsocksSecurities(node).Contains(node.security) ? node.security : Global.None;
|
||||||
outbound.password = node.id;
|
outbound.password = node.id;
|
||||||
|
|
||||||
|
if (node.network == Global.DefaultNetwork
|
||||||
|
&& node.headerType == Global.TcpHeaderHttp
|
||||||
|
&& node.requestHost.IsNullOrEmpty() == false)
|
||||||
|
{
|
||||||
|
outbound.plugin = "obfs-local";
|
||||||
|
outbound.plugin_opts = $"obfs=http;obfs-host={node.requestHost};";
|
||||||
|
}
|
||||||
|
|
||||||
GenOutboundMux(node, outbound);
|
GenOutboundMux(node, outbound);
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Socks)
|
else if (node.configType == EConfigType.Socks)
|
||||||
|
|
|
@ -686,13 +686,13 @@ namespace v2rayN.Handler
|
||||||
if (queryParameters["plugin"] != null)
|
if (queryParameters["plugin"] != null)
|
||||||
{
|
{
|
||||||
//obfs-host exists
|
//obfs-host exists
|
||||||
var obfsHost = queryParameters["plugin"].Split(';').FirstOrDefault(t => t.Contains("obfs-host"));
|
var obfsHost = queryParameters["plugin"]?.Split(';').FirstOrDefault(t => t.Contains("obfs-host"));
|
||||||
if (queryParameters["plugin"].Contains("obfs=http") && !Utile.IsNullOrEmpty(obfsHost))
|
if (queryParameters["plugin"].Contains("obfs=http") && !Utile.IsNullOrEmpty(obfsHost))
|
||||||
{
|
{
|
||||||
obfsHost = obfsHost.Replace("obfs-host=", "");
|
obfsHost = obfsHost?.Replace("obfs-host=", "");
|
||||||
server.network = Global.DefaultNetwork;
|
server.network = Global.DefaultNetwork;
|
||||||
server.headerType = Global.TcpHeaderHttp;
|
server.headerType = Global.TcpHeaderHttp;
|
||||||
server.requestHost = obfsHost;
|
server.requestHost = obfsHost ?? "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -118,6 +118,8 @@
|
||||||
public string? peer_public_key { get; set; }
|
public string? peer_public_key { get; set; }
|
||||||
public int[]? reserved { get; set; }
|
public int[]? reserved { get; set; }
|
||||||
public int? mtu { get; set; }
|
public int? mtu { get; set; }
|
||||||
|
public string? plugin { get; set; }
|
||||||
|
public string? plugin_opts { get; set; }
|
||||||
public Tls4Sbox tls { get; set; }
|
public Tls4Sbox tls { get; set; }
|
||||||
public Multiplex4Sbox multiplex { get; set; }
|
public Multiplex4Sbox multiplex { get; set; }
|
||||||
public Transport4Sbox transport { get; set; }
|
public Transport4Sbox transport { get; set; }
|
||||||
|
|
Loading…
Reference in New Issue