mirror of
https://github.com/2dust/v2rayN.git
synced 2025-11-29 03:02:53 +00:00
Compare commits
No commits in common. "34fc4de0c22c18849a86ce7029b9a5c7eba9d8e6" and "6b87c09a96a6319f1bdd284b67134b2368507f73" have entirely different histories.
34fc4de0c2
...
6b87c09a96
4 changed files with 4 additions and 31 deletions
|
|
@ -216,8 +216,6 @@ public class Transport4Sbox
|
||||||
public string? idle_timeout { get; set; }
|
public string? idle_timeout { get; set; }
|
||||||
public string? ping_timeout { get; set; }
|
public string? ping_timeout { get; set; }
|
||||||
public bool? permit_without_stream { get; set; }
|
public bool? permit_without_stream { get; set; }
|
||||||
public int? max_early_data { get; set; }
|
|
||||||
public string? early_data_header_name { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Headers4Sbox
|
public class Headers4Sbox
|
||||||
|
|
|
||||||
|
|
@ -411,6 +411,8 @@ public class WsSettings4Ray
|
||||||
|
|
||||||
public class Headers4Ray
|
public class Headers4Ray
|
||||||
{
|
{
|
||||||
|
public string Host { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("User-Agent")]
|
[JsonPropertyName("User-Agent")]
|
||||||
public string UserAgent { get; set; }
|
public string UserAgent { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -364,35 +364,7 @@ public partial class CoreConfigSingboxService
|
||||||
|
|
||||||
case nameof(ETransport.ws):
|
case nameof(ETransport.ws):
|
||||||
transport.type = nameof(ETransport.ws);
|
transport.type = nameof(ETransport.ws);
|
||||||
var wsPath = node.Path;
|
transport.path = node.Path.IsNullOrEmpty() ? null : node.Path;
|
||||||
|
|
||||||
// Parse eh and ed parameters from path using regex
|
|
||||||
if (!wsPath.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
var edRegex = new Regex(@"[?&]ed=(\d+)");
|
|
||||||
var edMatch = edRegex.Match(wsPath);
|
|
||||||
if (edMatch.Success && int.TryParse(edMatch.Groups[1].Value, out var edValue))
|
|
||||||
{
|
|
||||||
transport.max_early_data = edValue;
|
|
||||||
transport.early_data_header_name = "Sec-WebSocket-Protocol";
|
|
||||||
|
|
||||||
wsPath = edRegex.Replace(wsPath, "");
|
|
||||||
wsPath = wsPath.Replace("?&", "?");
|
|
||||||
if (wsPath.EndsWith('?'))
|
|
||||||
{
|
|
||||||
wsPath = wsPath.TrimEnd('?');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var ehRegex = new Regex(@"[?&]eh=([^&]+)");
|
|
||||||
var ehMatch = ehRegex.Match(wsPath);
|
|
||||||
if (ehMatch.Success)
|
|
||||||
{
|
|
||||||
transport.early_data_header_name = Uri.UnescapeDataString(ehMatch.Groups[1].Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transport.path = wsPath.IsNullOrEmpty() ? null : wsPath;
|
|
||||||
if (node.RequestHost.IsNotEmpty())
|
if (node.RequestHost.IsNotEmpty())
|
||||||
{
|
{
|
||||||
transport.headers = new()
|
transport.headers = new()
|
||||||
|
|
|
||||||
|
|
@ -351,6 +351,7 @@ public partial class CoreConfigV2rayService
|
||||||
if (host.IsNotEmpty())
|
if (host.IsNotEmpty())
|
||||||
{
|
{
|
||||||
wsSettings.host = host;
|
wsSettings.host = host;
|
||||||
|
wsSettings.headers.Host = host;
|
||||||
}
|
}
|
||||||
if (path.IsNotEmpty())
|
if (path.IsNotEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue