Skip to content

Commit

Permalink
add quic
Browse files Browse the repository at this point in the history
  • Loading branch information
next-autumn committed Nov 23, 2022
1 parent 4c0d3a0 commit e86db63
Show file tree
Hide file tree
Showing 43 changed files with 983 additions and 292 deletions.
4 changes: 3 additions & 1 deletion ProxySuper.Core/Models/Projects/RayType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ public enum RayType
VLESS_WS = 102,
VLESS_H2 = 103,
VLESS_KCP = 104,
VLESS_QUIC = 105,
VLESS_gRPC = 110,

// VMESS 201开头
VMESS_TCP = 201,
VMESS_WS = 202,
VMESS_H2 = 203,
VMESS_KCP = 204,
VMESS_QUIC = 205,

// Trojan 301开头
Trojan_TCP = 301,
Expand All @@ -26,5 +28,5 @@ public enum RayType
ShadowsocksAEAD = 401
}


}
19 changes: 18 additions & 1 deletion ProxySuper.Core/Models/Projects/V2raySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,27 @@ namespace ProxySuper.Core.Models.Projects
{
public partial class V2raySettings : IProjectSettings
{
public static List<string> DisguiseTypes = new List<string> {
"none",
"srtp",
"utp",
"wechat-video",
"dtls",
"wireguard",
};

public V2raySettings()
{
WithTLS = true;

var guid = Guid.NewGuid().ToString();
Port = 443;
VLESS_KCP_Port = 2001;
VLESS_gRPC_Port = 2002;
VLESS_QUIC_Port = 2002;
VLESS_gRPC_Port = 2003;

VMESS_KCP_Port = 3001;
VMESS_QUIC_Port = 3002;
ShadowSocksPort = 4001;

UUID = guid;
Expand All @@ -26,12 +38,17 @@ public V2raySettings()
VLESS_WS_Path = "/" + Utils.RandomString(6);
VLESS_KCP_Type = "none";
VLESS_KCP_Seed = guid;
VLESS_QUIC_Type = "none";
VLESS_QUIC_Security = "none";
VLESS_QUIC_Type = "none";
VLESS_gRPC_ServiceName = "/" + Utils.RandomString(7);

VMESS_WS_Path = "/" + Utils.RandomString(8);
VMESS_TCP_Path = "/" + Utils.RandomString(9);
VMESS_KCP_Seed = guid;
VMESS_KCP_Type = "none";
VMESS_QUIC_Security = "none";
VMESS_QUIC_Type = "none";

TrojanPassword = guid;

Expand Down
3 changes: 3 additions & 0 deletions ProxySuper.Core/Models/Projects/V2raySettings_SS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public partial class V2raySettings
/// </summary>
public int ShadowSocksPort { get; set; }

/// <summary>
/// share link
/// </summary>
public string ShadowSocksShareLink
{
get
Expand Down
34 changes: 34 additions & 0 deletions ProxySuper.Core/Models/Projects/V2raySettings_VLESS.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using ProxySuper.Core.Services;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Documents;

namespace ProxySuper.Core.Models.Projects
{
Expand Down Expand Up @@ -57,6 +60,37 @@ public string VLESS_KCP_ShareLink
}
}

/// <summary>
/// vless quic security
/// </summary>
public string VLESS_QUIC_Security { get; set; }

/// <summary>
/// vless quic type
/// </summary>
public string VLESS_QUIC_Type { get; set; }

/// <summary>
/// vless quic port
/// </summary>
public int VLESS_QUIC_Port { get; set; }

/// <summary>
/// vless quic key
/// </summary>
public string VLESS_QUIC_Key { get; set; }

/// <summary>
/// vless quic ShareLink
/// </summary>
public string VLESS_QUIC_ShareLink
{
get
{
return ShareLink.Build(RayType.VLESS_QUIC, this);
}
}

/// <summary>
/// grpc port
/// </summary>
Expand Down
31 changes: 31 additions & 0 deletions ProxySuper.Core/Models/Projects/V2raySettings_VMESS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,36 @@ public string VMESS_KCP_ShareLink
return ShareLink.Build(RayType.VMESS_KCP, this);
}
}

/// <summary>
/// vmess quic security
/// </summary>
public string VMESS_QUIC_Security { get; set; }

/// <summary>
/// vmess quic type
/// </summary>
public string VMESS_QUIC_Type { get; set; }

/// <summary>
/// vmess quic port
/// </summary>
public int VMESS_QUIC_Port { get; set; }

/// <summary>
/// vmess quic key
/// </summary>
public string VMESS_QUIC_Key { get; set; }

/// <summary>
/// vmess quic ShareLink
/// </summary>
public string VMESS_QUIC_ShareLink
{
get
{
return ShareLink.Build(RayType.VMESS_QUIC, this);
}
}
}
}
3 changes: 3 additions & 0 deletions ProxySuper.Core/Models/Projects/XraySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ namespace ProxySuper.Core.Models.Projects
{
public class XraySettings : V2raySettings
{
public static List<string> FlowList = new List<string> { "xtls-rprx-origin", "xtls-rprx-origin-udp443", "xtls-rprx-direct", "xtls-rprx-direct-udp443", "xtls-rprx-splice", "xtls-rprx-splice-udp443" };
public static List<string> UTLSList = new List<string> { "", "chrome", "firefox", "safari", "randomized" };

public string UTLS { get; set; } = UTLSList[1];

public string Flow { get; set; } = FlowList[2];

/// <summary>
/// vless xtls shareLink
/// </summary>
Expand Down
5 changes: 3 additions & 2 deletions ProxySuper.Core/Services/ShareLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,10 @@ private static string BuildVlessShareLink(RayType xrayType, V2raySettings settin
}

// 4.4 TLS 相关段
if (xrayType == RayType.VLESS_TCP_XTLS)
if (settings is XraySettings)
{
parametersURL += "&flow=xtls-rprx-direct";
var xraySettings = settings as XraySettings;
parametersURL += $"&flow={xraySettings.Flow}";
}


Expand Down
6 changes: 3 additions & 3 deletions ProxySuper.Core/Services/XrayConfigBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static string BuildCaddyConfig(XraySettings parameters, bool useCustomWeb
return caddyStr;
}

private static void SetClients(dynamic bound, List<string> uuidList, bool withXtls = false)
private static void SetClients(dynamic bound, List<string> uuidList, bool withXtls = false, string flow = "")
{
bound.settings.clients.Clear();
uuidList.ForEach(id =>
Expand All @@ -103,7 +103,7 @@ private static void SetClients(dynamic bound, List<string> uuidList, bool withXt
}
else
{
obj = new { id = id, flow = "xtls-rprx-direct" };
obj = new { id = id, flow = flow };
}

bound.settings.clients.Add(JToken.FromObject(obj));
Expand All @@ -126,7 +126,7 @@ public static string BuildXrayConfig(XraySettings parameters)
dest = FullbackPort
}));
xrayConfig.inbounds.Add(baseBound);
SetClients(baseBound, uuidList, withXtls: true);
SetClients(baseBound, uuidList, withXtls: true, flow: parameters.Flow);

#region Fullbacks

Expand Down
Loading

0 comments on commit e86db63

Please sign in to comment.