mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-24 22:26:07 +03:00
v2ray
This commit is contained in:
parent
b0d0e761de
commit
995d9ff435
@ -22,7 +22,7 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 类型
|
/// 类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ProjectType Type { get; set; }
|
//ProjectType Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 邮箱
|
/// 邮箱
|
||||||
|
@ -6,5 +6,6 @@
|
|||||||
TrojanGo = 1,
|
TrojanGo = 1,
|
||||||
NaiveProxy = 2,
|
NaiveProxy = 2,
|
||||||
Brook = 3,
|
Brook = 3,
|
||||||
|
V2ray = 4,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace ProxySuper.Core.Models.Projects
|
namespace ProxySuper.Core.Models.Projects
|
||||||
{
|
{
|
||||||
public enum XrayType
|
public enum RayType
|
||||||
{
|
{
|
||||||
// 入口
|
// 入口
|
||||||
VLESS_TCP_XTLS = 100,
|
VLESS_TCP_XTLS = 100,
|
||||||
@ -25,4 +25,6 @@
|
|||||||
// SS
|
// SS
|
||||||
ShadowsocksAEAD = 401
|
ShadowsocksAEAD = 401
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
160
ProxySuper.Core/Models/Projects/V2raySettings.cs
Normal file
160
ProxySuper.Core/Models/Projects/V2raySettings.cs
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using ProxySuper.Core.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace ProxySuper.Core.Models.Projects
|
||||||
|
{
|
||||||
|
public partial class V2raySettings : IProjectSettings
|
||||||
|
{
|
||||||
|
public V2raySettings()
|
||||||
|
{
|
||||||
|
WithTLS = true;
|
||||||
|
|
||||||
|
var guid = Guid.NewGuid().ToString();
|
||||||
|
Port = 443;
|
||||||
|
VLESS_KCP_Port = 2001;
|
||||||
|
VLESS_gRPC_Port = 2002;
|
||||||
|
VMESS_KCP_Port = 3001;
|
||||||
|
ShadowSocksPort = 4001;
|
||||||
|
|
||||||
|
UUID = guid;
|
||||||
|
Types = new List<RayType>();
|
||||||
|
|
||||||
|
VLESS_WS_Path = "/" + Utils.RandomString(6);
|
||||||
|
VLESS_KCP_Type = "none";
|
||||||
|
VLESS_KCP_Seed = guid;
|
||||||
|
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";
|
||||||
|
|
||||||
|
TrojanPassword = guid;
|
||||||
|
|
||||||
|
ShadowSocksPassword = guid;
|
||||||
|
ShadowSocksMethod = "aes-128-gcm";
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public bool IsIPAddress
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return IPAddress.TryParse(Domain, out _);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public List<int> FreePorts
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var list = new List<int>();
|
||||||
|
list.Add(80);
|
||||||
|
list.Add(Port);
|
||||||
|
|
||||||
|
if (Types.Contains(RayType.VLESS_KCP))
|
||||||
|
{
|
||||||
|
list.Add(VLESS_KCP_Port);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Types.Contains(RayType.VMESS_KCP))
|
||||||
|
{
|
||||||
|
list.Add(VMESS_KCP_Port);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Types.Contains(RayType.ShadowsocksAEAD))
|
||||||
|
{
|
||||||
|
list.Add(ShadowSocksPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Types.Contains(RayType.VLESS_gRPC))
|
||||||
|
{
|
||||||
|
list.Add(VLESS_gRPC_Port);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list.Distinct().ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//public ProjectType Type { get; set; } = ProjectType.Xray;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否安装证书,
|
||||||
|
/// 上传自有证书时选False,则不会自动安装证书。
|
||||||
|
/// </summary>
|
||||||
|
public bool WithTLS { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 端口
|
||||||
|
/// </summary>
|
||||||
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 域名
|
||||||
|
/// </summary>
|
||||||
|
public string Domain { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// UUID
|
||||||
|
/// </summary>
|
||||||
|
public string UUID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多用户
|
||||||
|
/// </summary>
|
||||||
|
public List<string> MulitUUID { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 伪装域名
|
||||||
|
/// </summary>
|
||||||
|
public string MaskDomain { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public string Email
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(Domain))
|
||||||
|
{
|
||||||
|
var arr = Domain.Split('.');
|
||||||
|
if (arr.Length == 3)
|
||||||
|
{
|
||||||
|
return $"{arr[0]}@{arr[1]}.{arr[2]}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"{UUID.Substring(2, 6)}@gmail.com";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 安装类型
|
||||||
|
/// </summary>
|
||||||
|
public List<RayType> Types { get; set; } = new List<RayType>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据xray类型获取路径
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string GetPath(RayType type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case RayType.VLESS_WS:
|
||||||
|
return VLESS_WS_Path;
|
||||||
|
case RayType.VMESS_TCP:
|
||||||
|
return VMESS_TCP_Path;
|
||||||
|
case RayType.VMESS_WS:
|
||||||
|
return VMESS_WS_Path;
|
||||||
|
default:
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace ProxySuper.Core.Models.Projects
|
namespace ProxySuper.Core.Models.Projects
|
||||||
{
|
{
|
||||||
public partial class XraySettings
|
public partial class V2raySettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ss password
|
/// ss password
|
||||||
@ -23,7 +23,7 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ShareLink.Build(XrayType.ShadowsocksAEAD, this);
|
return ShareLink.Build(RayType.ShadowsocksAEAD, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace ProxySuper.Core.Models.Projects
|
namespace ProxySuper.Core.Models.Projects
|
||||||
{
|
{
|
||||||
public partial class XraySettings
|
public partial class V2raySettings
|
||||||
{
|
{
|
||||||
public string TrojanPassword { get; set; }
|
public string TrojanPassword { get; set; }
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ShareLink.Build(XrayType.Trojan_TCP, this);
|
return ShareLink.Build(RayType.Trojan_TCP, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,19 +2,8 @@
|
|||||||
|
|
||||||
namespace ProxySuper.Core.Models.Projects
|
namespace ProxySuper.Core.Models.Projects
|
||||||
{
|
{
|
||||||
public partial class XraySettings
|
public partial class V2raySettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// vless xtls shareLink
|
|
||||||
/// </summary>
|
|
||||||
public string VLESS_TCP_XTLS_ShareLink
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ShareLink.Build(XrayType.VLESS_TCP_XTLS, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// vless tcp shareLink
|
/// vless tcp shareLink
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -22,7 +11,7 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ShareLink.Build(XrayType.VLESS_TCP, this);
|
return ShareLink.Build(RayType.VLESS_TCP, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +27,7 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ShareLink.Build(XrayType.VLESS_WS, this);
|
return ShareLink.Build(RayType.VLESS_WS, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +53,7 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ShareLink.Build(XrayType.VLESS_KCP, this);
|
return ShareLink.Build(RayType.VLESS_KCP, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +74,7 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ShareLink.Build(XrayType.VLESS_gRPC, this);
|
return ShareLink.Build(RayType.VLESS_gRPC, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace ProxySuper.Core.Models.Projects
|
namespace ProxySuper.Core.Models.Projects
|
||||||
{
|
{
|
||||||
public partial class XraySettings
|
public partial class V2raySettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// vmess websocket path
|
/// vmess websocket path
|
||||||
@ -16,7 +16,7 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ShareLink.Build(XrayType.VMESS_WS, this);
|
return ShareLink.Build(RayType.VMESS_WS, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ShareLink.Build(XrayType.VMESS_TCP, this);
|
return ShareLink.Build(RayType.VMESS_TCP, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ShareLink.Build(XrayType.VMESS_KCP, this);
|
return ShareLink.Build(RayType.VMESS_KCP, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,159 +1,22 @@
|
|||||||
using Newtonsoft.Json;
|
using ProxySuper.Core.Services;
|
||||||
using ProxySuper.Core.Services;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ProxySuper.Core.Models.Projects
|
namespace ProxySuper.Core.Models.Projects
|
||||||
{
|
{
|
||||||
public partial class XraySettings : IProjectSettings
|
public class XraySettings : V2raySettings
|
||||||
{
|
{
|
||||||
public XraySettings()
|
/// <summary>
|
||||||
{
|
/// vless xtls shareLink
|
||||||
WithTLS = true;
|
/// </summary>
|
||||||
|
public string VLESS_TCP_XTLS_ShareLink
|
||||||
var guid = Guid.NewGuid().ToString();
|
|
||||||
Port = 443;
|
|
||||||
VLESS_KCP_Port = 2001;
|
|
||||||
VLESS_gRPC_Port = 2002;
|
|
||||||
VMESS_KCP_Port = 3001;
|
|
||||||
ShadowSocksPort = 4001;
|
|
||||||
|
|
||||||
UUID = guid;
|
|
||||||
Types = new List<XrayType>();
|
|
||||||
|
|
||||||
VLESS_WS_Path = "/" + Utils.RandomString(6);
|
|
||||||
VLESS_KCP_Type = "none";
|
|
||||||
VLESS_KCP_Seed = guid;
|
|
||||||
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";
|
|
||||||
|
|
||||||
TrojanPassword = guid;
|
|
||||||
|
|
||||||
ShadowSocksPassword = guid;
|
|
||||||
ShadowSocksMethod = "aes-128-gcm";
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public bool IsIPAddress
|
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return IPAddress.TryParse(Domain, out _);
|
return ShareLink.Build(RayType.VLESS_TCP_XTLS, this);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public List<int> FreePorts
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var list = new List<int>();
|
|
||||||
list.Add(80);
|
|
||||||
list.Add(Port);
|
|
||||||
|
|
||||||
if (Types.Contains(XrayType.VLESS_KCP))
|
|
||||||
{
|
|
||||||
list.Add(VLESS_KCP_Port);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Types.Contains(XrayType.VMESS_KCP))
|
|
||||||
{
|
|
||||||
list.Add(VMESS_KCP_Port);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Types.Contains(XrayType.ShadowsocksAEAD))
|
|
||||||
{
|
|
||||||
list.Add(ShadowSocksPort);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Types.Contains(XrayType.VLESS_gRPC))
|
|
||||||
{
|
|
||||||
list.Add(VLESS_gRPC_Port);
|
|
||||||
}
|
|
||||||
|
|
||||||
return list.Distinct().ToList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProjectType Type { get; set; } = ProjectType.Xray;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否安装证书,
|
|
||||||
/// 上传自有证书时选False,则不会自动安装证书。
|
|
||||||
/// </summary>
|
|
||||||
public bool WithTLS { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 端口
|
|
||||||
/// </summary>
|
|
||||||
public int Port { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 域名
|
|
||||||
/// </summary>
|
|
||||||
public string Domain { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// UUID
|
|
||||||
/// </summary>
|
|
||||||
public string UUID { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 多用户
|
|
||||||
/// </summary>
|
|
||||||
public List<string> MulitUUID { get; set; } = new List<string>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 伪装域名
|
|
||||||
/// </summary>
|
|
||||||
public string MaskDomain { get; set; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public string Email
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(Domain))
|
|
||||||
{
|
|
||||||
var arr = Domain.Split('.');
|
|
||||||
if (arr.Length == 3)
|
|
||||||
{
|
|
||||||
return $"{arr[0]}@{arr[1]}.{arr[2]}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $"{UUID.Substring(2, 6)}@gmail.com";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 安装类型
|
|
||||||
/// </summary>
|
|
||||||
public List<XrayType> Types { get; set; } = new List<XrayType>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 根据xray类型获取路径
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public string GetPath(XrayType type)
|
|
||||||
{
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case XrayType.VLESS_WS:
|
|
||||||
return VLESS_WS_Path;
|
|
||||||
case XrayType.VMESS_TCP:
|
|
||||||
return VMESS_TCP_Path;
|
|
||||||
case XrayType.VMESS_WS:
|
|
||||||
return VMESS_WS_Path;
|
|
||||||
default:
|
|
||||||
return string.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,9 @@ namespace ProxySuper.Core.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonProperty("v2raySettings")]
|
||||||
|
public V2raySettings V2raySettings { get; set; }
|
||||||
|
|
||||||
[JsonProperty("settings")]
|
[JsonProperty("settings")]
|
||||||
public XraySettings XraySettings { get; set; }
|
public XraySettings XraySettings { get; set; }
|
||||||
|
|
||||||
@ -52,6 +55,8 @@ namespace ProxySuper.Core.Models
|
|||||||
{
|
{
|
||||||
if (XraySettings != null) return ProjectType.Xray;
|
if (XraySettings != null) return ProjectType.Xray;
|
||||||
|
|
||||||
|
if (V2raySettings != null) return ProjectType.V2ray;
|
||||||
|
|
||||||
if (TrojanGoSettings != null) return ProjectType.TrojanGo;
|
if (TrojanGoSettings != null) return ProjectType.TrojanGo;
|
||||||
|
|
||||||
if (NaiveProxySettings != null) return ProjectType.NaiveProxy;
|
if (NaiveProxySettings != null) return ProjectType.NaiveProxy;
|
||||||
@ -76,6 +81,17 @@ namespace ProxySuper.Core.Models
|
|||||||
|
|
||||||
public string GetShareLink()
|
public string GetShareLink()
|
||||||
{
|
{
|
||||||
|
if (Type == ProjectType.V2ray)
|
||||||
|
{
|
||||||
|
StringBuilder strBuilder = new StringBuilder();
|
||||||
|
XraySettings.Types.ForEach(type =>
|
||||||
|
{
|
||||||
|
var link = ShareLink.Build(type, V2raySettings);
|
||||||
|
strBuilder.AppendLine(link);
|
||||||
|
});
|
||||||
|
return strBuilder.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
if (Type == ProjectType.Xray)
|
if (Type == ProjectType.Xray)
|
||||||
{
|
{
|
||||||
StringBuilder strBuilder = new StringBuilder();
|
StringBuilder strBuilder = new StringBuilder();
|
||||||
|
@ -78,12 +78,13 @@
|
|||||||
<Compile Include="Models\Projects\NaiveProxySettings.cs" />
|
<Compile Include="Models\Projects\NaiveProxySettings.cs" />
|
||||||
<Compile Include="Models\Projects\ProjectType.cs" />
|
<Compile Include="Models\Projects\ProjectType.cs" />
|
||||||
<Compile Include="Models\Projects\TrojanGoSettings.cs" />
|
<Compile Include="Models\Projects\TrojanGoSettings.cs" />
|
||||||
<Compile Include="Models\Projects\XraySettings_SS.cs" />
|
<Compile Include="Models\Projects\V2raySettings_SS.cs" />
|
||||||
<Compile Include="Models\Projects\XraySettings_Trojan.cs" />
|
<Compile Include="Models\Projects\V2raySettings_Trojan.cs" />
|
||||||
<Compile Include="Models\Projects\XraySettings_VLESS.cs" />
|
<Compile Include="Models\Projects\V2raySettings_VLESS.cs" />
|
||||||
|
<Compile Include="Models\Projects\V2raySettings.cs" />
|
||||||
|
<Compile Include="Models\Projects\V2raySettings_VMESS.cs" />
|
||||||
<Compile Include="Models\Projects\XraySettings.cs" />
|
<Compile Include="Models\Projects\XraySettings.cs" />
|
||||||
<Compile Include="Models\Projects\XraySettings_VMESS.cs" />
|
<Compile Include="Models\Projects\RayType.cs" />
|
||||||
<Compile Include="Models\Projects\XrayType.cs" />
|
|
||||||
<Compile Include="Models\Record.cs" />
|
<Compile Include="Models\Record.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Helpers\Utils.cs" />
|
<Compile Include="Helpers\Utils.cs" />
|
||||||
@ -93,6 +94,8 @@
|
|||||||
<Compile Include="Services\ShareLink.cs" />
|
<Compile Include="Services\ShareLink.cs" />
|
||||||
<Compile Include="Services\TrojanGoConfigBuilder.cs" />
|
<Compile Include="Services\TrojanGoConfigBuilder.cs" />
|
||||||
<Compile Include="Services\TrojanGoService.cs" />
|
<Compile Include="Services\TrojanGoService.cs" />
|
||||||
|
<Compile Include="Services\V2rayConfigBuilder.cs" />
|
||||||
|
<Compile Include="Services\V2rayService.cs" />
|
||||||
<Compile Include="Services\XrayConfigBuilder.cs" />
|
<Compile Include="Services\XrayConfigBuilder.cs" />
|
||||||
<Compile Include="Services\XrayService.cs" />
|
<Compile Include="Services\XrayService.cs" />
|
||||||
<Compile Include="ViewModels\BrookConfigViewModel.cs" />
|
<Compile Include="ViewModels\BrookConfigViewModel.cs" />
|
||||||
@ -107,6 +110,9 @@
|
|||||||
<Compile Include="ViewModels\TrojanGoConfigViewModel.cs" />
|
<Compile Include="ViewModels\TrojanGoConfigViewModel.cs" />
|
||||||
<Compile Include="ViewModels\TrojanGoEditorViewModel.cs" />
|
<Compile Include="ViewModels\TrojanGoEditorViewModel.cs" />
|
||||||
<Compile Include="ViewModels\TrojanGoInstallViewModel.cs" />
|
<Compile Include="ViewModels\TrojanGoInstallViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\V2rayConfigViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\V2rayEditorViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\V2rayInstallViewModel.cs" />
|
||||||
<Compile Include="ViewModels\XrayConfigViewModel.cs" />
|
<Compile Include="ViewModels\XrayConfigViewModel.cs" />
|
||||||
<Compile Include="ViewModels\XrayEditorViewModel.cs" />
|
<Compile Include="ViewModels\XrayEditorViewModel.cs" />
|
||||||
<Compile Include="ViewModels\XrayInstallViewModel.cs" />
|
<Compile Include="ViewModels\XrayInstallViewModel.cs" />
|
||||||
|
@ -69,30 +69,30 @@ namespace ProxySuper.Core.Services
|
|||||||
return strBuilder.ToString();
|
return strBuilder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Build(XrayType xrayType, XraySettings settings)
|
public static string Build(RayType xrayType, V2raySettings settings)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (xrayType)
|
switch (xrayType)
|
||||||
{
|
{
|
||||||
case XrayType.VLESS_TCP:
|
case RayType.VLESS_TCP:
|
||||||
case XrayType.VLESS_TCP_XTLS:
|
case RayType.VLESS_TCP_XTLS:
|
||||||
case XrayType.VLESS_WS:
|
case RayType.VLESS_WS:
|
||||||
case XrayType.VLESS_KCP:
|
case RayType.VLESS_KCP:
|
||||||
case XrayType.VLESS_gRPC:
|
case RayType.VLESS_gRPC:
|
||||||
case XrayType.Trojan_TCP:
|
case RayType.Trojan_TCP:
|
||||||
return BuildVlessShareLink(xrayType, settings);
|
return BuildVlessShareLink(xrayType, settings);
|
||||||
case XrayType.VMESS_TCP:
|
case RayType.VMESS_TCP:
|
||||||
case XrayType.VMESS_WS:
|
case RayType.VMESS_WS:
|
||||||
case XrayType.VMESS_KCP:
|
case RayType.VMESS_KCP:
|
||||||
return BuildVmessShareLink(xrayType, settings);
|
return BuildVmessShareLink(xrayType, settings);
|
||||||
case XrayType.ShadowsocksAEAD:
|
case RayType.ShadowsocksAEAD:
|
||||||
return BuildShadowSocksShareLink(settings);
|
return BuildShadowSocksShareLink(settings);
|
||||||
default:
|
default:
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string BuildShadowSocksShareLink(XraySettings settings)
|
private static string BuildShadowSocksShareLink(V2raySettings settings)
|
||||||
{
|
{
|
||||||
var _method = settings.ShadowSocksMethod;
|
var _method = settings.ShadowSocksMethod;
|
||||||
var _password = settings.ShadowSocksPassword;
|
var _password = settings.ShadowSocksPassword;
|
||||||
@ -103,7 +103,7 @@ namespace ProxySuper.Core.Services
|
|||||||
return "ss://" + base64URL + "#ShadowSocks";
|
return "ss://" + base64URL + "#ShadowSocks";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string BuildVmessShareLink(XrayType xrayType, XraySettings settings)
|
private static string BuildVmessShareLink(RayType xrayType, V2raySettings settings)
|
||||||
{
|
{
|
||||||
var vmess = new Vmess
|
var vmess = new Vmess
|
||||||
{
|
{
|
||||||
@ -122,19 +122,19 @@ namespace ProxySuper.Core.Services
|
|||||||
|
|
||||||
switch (xrayType)
|
switch (xrayType)
|
||||||
{
|
{
|
||||||
case XrayType.VMESS_TCP:
|
case RayType.VMESS_TCP:
|
||||||
vmess.ps = "vmess-tcp-tls";
|
vmess.ps = "vmess-tcp-tls";
|
||||||
vmess.net = "tcp";
|
vmess.net = "tcp";
|
||||||
vmess.type = "http";
|
vmess.type = "http";
|
||||||
vmess.path = settings.VMESS_TCP_Path;
|
vmess.path = settings.VMESS_TCP_Path;
|
||||||
break;
|
break;
|
||||||
case XrayType.VMESS_WS:
|
case RayType.VMESS_WS:
|
||||||
vmess.ps = "vmess-ws-tls";
|
vmess.ps = "vmess-ws-tls";
|
||||||
vmess.net = "ws";
|
vmess.net = "ws";
|
||||||
vmess.type = "none";
|
vmess.type = "none";
|
||||||
vmess.path = settings.VMESS_WS_Path;
|
vmess.path = settings.VMESS_WS_Path;
|
||||||
break;
|
break;
|
||||||
case XrayType.VMESS_KCP:
|
case RayType.VMESS_KCP:
|
||||||
vmess.ps = "vmess-mKCP";
|
vmess.ps = "vmess-mKCP";
|
||||||
vmess.port = settings.VMESS_KCP_Port.ToString();
|
vmess.port = settings.VMESS_KCP_Port.ToString();
|
||||||
vmess.net = "kcp";
|
vmess.net = "kcp";
|
||||||
@ -150,7 +150,7 @@ namespace ProxySuper.Core.Services
|
|||||||
return $"vmess://" + base64Url;
|
return $"vmess://" + base64Url;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string BuildVlessShareLink(XrayType xrayType, XraySettings settings)
|
private static string BuildVlessShareLink(RayType xrayType, V2raySettings settings)
|
||||||
{
|
{
|
||||||
var _protocol = string.Empty;
|
var _protocol = string.Empty;
|
||||||
var _uuid = settings.UUID;
|
var _uuid = settings.UUID;
|
||||||
@ -167,24 +167,24 @@ namespace ProxySuper.Core.Services
|
|||||||
|
|
||||||
switch (xrayType)
|
switch (xrayType)
|
||||||
{
|
{
|
||||||
case XrayType.VLESS_TCP:
|
case RayType.VLESS_TCP:
|
||||||
_protocol = "vless";
|
_protocol = "vless";
|
||||||
_type = "tcp";
|
_type = "tcp";
|
||||||
_descriptiveText = "vless-tcp-tls";
|
_descriptiveText = "vless-tcp-tls";
|
||||||
break;
|
break;
|
||||||
case XrayType.VLESS_TCP_XTLS:
|
case RayType.VLESS_TCP_XTLS:
|
||||||
_protocol = "vless";
|
_protocol = "vless";
|
||||||
_type = "tcp";
|
_type = "tcp";
|
||||||
_security = "xtls";
|
_security = "xtls";
|
||||||
_descriptiveText = "vless-tcp-xtls";
|
_descriptiveText = "vless-tcp-xtls";
|
||||||
break;
|
break;
|
||||||
case XrayType.VLESS_WS:
|
case RayType.VLESS_WS:
|
||||||
_protocol = "vless";
|
_protocol = "vless";
|
||||||
_type = "ws";
|
_type = "ws";
|
||||||
_path = settings.VLESS_WS_Path;
|
_path = settings.VLESS_WS_Path;
|
||||||
_descriptiveText = "vless-ws-tls";
|
_descriptiveText = "vless-ws-tls";
|
||||||
break;
|
break;
|
||||||
case XrayType.VLESS_KCP:
|
case RayType.VLESS_KCP:
|
||||||
_protocol = "vless";
|
_protocol = "vless";
|
||||||
_type = "kcp";
|
_type = "kcp";
|
||||||
_headerType = settings.VLESS_KCP_Type;
|
_headerType = settings.VLESS_KCP_Type;
|
||||||
@ -193,13 +193,13 @@ namespace ProxySuper.Core.Services
|
|||||||
_security = "none";
|
_security = "none";
|
||||||
_descriptiveText = "vless-mKCP";
|
_descriptiveText = "vless-mKCP";
|
||||||
break;
|
break;
|
||||||
case XrayType.VLESS_gRPC:
|
case RayType.VLESS_gRPC:
|
||||||
_protocol = "vless";
|
_protocol = "vless";
|
||||||
_type = "grpc";
|
_type = "grpc";
|
||||||
_port = settings.VLESS_gRPC_Port;
|
_port = settings.VLESS_gRPC_Port;
|
||||||
_descriptiveText = "vless-gRPC";
|
_descriptiveText = "vless-gRPC";
|
||||||
break;
|
break;
|
||||||
case XrayType.Trojan_TCP:
|
case RayType.Trojan_TCP:
|
||||||
_protocol = "trojan";
|
_protocol = "trojan";
|
||||||
_uuid = settings.TrojanPassword;
|
_uuid = settings.TrojanPassword;
|
||||||
_descriptiveText = "trojan-tcp";
|
_descriptiveText = "trojan-tcp";
|
||||||
@ -210,25 +210,25 @@ namespace ProxySuper.Core.Services
|
|||||||
|
|
||||||
|
|
||||||
string parametersURL = string.Empty;
|
string parametersURL = string.Empty;
|
||||||
if (xrayType != XrayType.Trojan_TCP)
|
if (xrayType != RayType.Trojan_TCP)
|
||||||
{
|
{
|
||||||
// 4.3 传输层相关段
|
// 4.3 传输层相关段
|
||||||
parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&path={HttpUtility.UrlEncode(_path)}&headerType={_headerType}";
|
parametersURL = $"?type={_type}&encryption={_encryption}&security={_security}&path={HttpUtility.UrlEncode(_path)}&headerType={_headerType}";
|
||||||
|
|
||||||
// kcp
|
// kcp
|
||||||
if (xrayType == XrayType.VLESS_KCP)
|
if (xrayType == RayType.VLESS_KCP)
|
||||||
{
|
{
|
||||||
parametersURL += $"&seed={_seed}";
|
parametersURL += $"&seed={_seed}";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4.4 TLS 相关段
|
// 4.4 TLS 相关段
|
||||||
if (xrayType == XrayType.VLESS_TCP_XTLS)
|
if (xrayType == RayType.VLESS_TCP_XTLS)
|
||||||
{
|
{
|
||||||
parametersURL += "&flow=xtls-rprx-direct";
|
parametersURL += "&flow=xtls-rprx-direct";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (xrayType == XrayType.VLESS_gRPC)
|
if (xrayType == RayType.VLESS_gRPC)
|
||||||
{
|
{
|
||||||
parametersURL += $"&serviceName={settings.VLESS_gRPC_ServiceName}&mode=gun";
|
parametersURL += $"&serviceName={settings.VLESS_gRPC_ServiceName}&mode=gun";
|
||||||
}
|
}
|
||||||
|
252
ProxySuper.Core/Services/V2rayConfigBuilder.cs
Normal file
252
ProxySuper.Core/Services/V2rayConfigBuilder.cs
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using ProxySuper.Core.Models.Projects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProxySuper.Core.Services
|
||||||
|
{
|
||||||
|
public class V2rayConfigBuilder
|
||||||
|
{
|
||||||
|
private const string ServerLogDir = @"Templates\v2ray\server\00_log";
|
||||||
|
private const string ServerApiDir = @"Templates\v2ray\server\01_api";
|
||||||
|
private const string ServerDnsDir = @"Templates\v2ray\server\02_dns";
|
||||||
|
private const string ServerRoutingDir = @"Templates\v2ray\server\03_routing";
|
||||||
|
private const string ServerPolicyDir = @"Templates\v2ray\server\04_policy";
|
||||||
|
private const string ServerInboundsDir = @"Templates\v2ray\server\05_inbounds";
|
||||||
|
private const string ServerOutboundsDir = @"Templates\v2ray\server\06_outbounds";
|
||||||
|
private const string ServerTransportDir = @"Templates\v2ray\server\07_transport";
|
||||||
|
private const string ServerStatsDir = @"Templates\v2ray\server\08_stats";
|
||||||
|
private const string ServerReverseDir = @"Templates\v2ray\server\09_reverse";
|
||||||
|
private const string CaddyFileDir = @"Templates\v2ray\caddy";
|
||||||
|
|
||||||
|
public static int VLESS_TCP_Port = 1110;
|
||||||
|
public static int VLESS_WS_Port = 1111;
|
||||||
|
public static int VLESS_H2_Port = 1112;
|
||||||
|
|
||||||
|
public static int VMESS_TCP_Port = 1210;
|
||||||
|
public static int VMESS_WS_Port = 1211;
|
||||||
|
public static int VMESS_H2_Port = 1212;
|
||||||
|
|
||||||
|
public static int Trojan_TCP_Port = 1310;
|
||||||
|
public static int Trojan_WS_Port = 1311;
|
||||||
|
|
||||||
|
public static int FullbackPort = 8080;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static dynamic LoadV2rayConfig()
|
||||||
|
{
|
||||||
|
dynamic logObj = LoadJsonObj(Path.Combine(ServerLogDir, "00_log.json"));
|
||||||
|
dynamic apiObj = LoadJsonObj(Path.Combine(ServerApiDir, "01_api.json"));
|
||||||
|
dynamic dnsObj = LoadJsonObj(Path.Combine(ServerDnsDir, "02_dns.json"));
|
||||||
|
dynamic routingObj = LoadJsonObj(Path.Combine(ServerRoutingDir, "03_routing.json"));
|
||||||
|
dynamic policyObj = LoadJsonObj(Path.Combine(ServerPolicyDir, "04_policy.json"));
|
||||||
|
dynamic inboundsObj = LoadJsonObj(Path.Combine(ServerInboundsDir, "05_inbounds.json"));
|
||||||
|
dynamic outboundsObj = LoadJsonObj(Path.Combine(ServerOutboundsDir, "06_outbounds.json"));
|
||||||
|
dynamic transportObj = LoadJsonObj(Path.Combine(ServerTransportDir, "07_transport.json"));
|
||||||
|
dynamic statsObj = LoadJsonObj(Path.Combine(ServerStatsDir, "08_stats.json"));
|
||||||
|
dynamic reverseObj = LoadJsonObj(Path.Combine(ServerReverseDir, "09_reverse.json"));
|
||||||
|
|
||||||
|
return new
|
||||||
|
{
|
||||||
|
log = logObj["log"],
|
||||||
|
//api = apiObj["api"], api不能为空
|
||||||
|
dns = dnsObj["dns"],
|
||||||
|
routing = routingObj["routing"],
|
||||||
|
policy = policyObj["policy"],
|
||||||
|
inbounds = inboundsObj["inbounds"],
|
||||||
|
outbounds = outboundsObj["outbounds"],
|
||||||
|
transport = transportObj["transport"],
|
||||||
|
stats = statsObj["stats"],
|
||||||
|
reverse = reverseObj["reverse"]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string BuildCaddyConfig(V2raySettings parameters, bool useCustomWeb = false)
|
||||||
|
{
|
||||||
|
var caddyStr = File.ReadAllText(Path.Combine(CaddyFileDir, "base.caddyfile"));
|
||||||
|
caddyStr = caddyStr.Replace("##domain##", parameters.IsIPAddress ? "" : parameters.Domain);
|
||||||
|
caddyStr = caddyStr.Replace("##port##", FullbackPort.ToString());
|
||||||
|
|
||||||
|
if (!useCustomWeb && !string.IsNullOrEmpty(parameters.MaskDomain))
|
||||||
|
{
|
||||||
|
var prefix = "http://";
|
||||||
|
if (parameters.MaskDomain.StartsWith("https://"))
|
||||||
|
{
|
||||||
|
prefix = "https://";
|
||||||
|
}
|
||||||
|
var domain = parameters.MaskDomain
|
||||||
|
.TrimStart("http://".ToCharArray())
|
||||||
|
.TrimStart("https://".ToCharArray());
|
||||||
|
|
||||||
|
caddyStr = caddyStr.Replace("##reverse_proxy##", $"reverse_proxy {prefix}{domain} {{ \n header_up Host {domain} \n }}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
caddyStr = caddyStr.Replace("##reverse_proxy##", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
return caddyStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetClients(dynamic bound, List<string> uuidList)
|
||||||
|
{
|
||||||
|
bound.settings.clients.Clear();
|
||||||
|
uuidList.ForEach(id =>
|
||||||
|
{
|
||||||
|
object obj;
|
||||||
|
|
||||||
|
obj = new { id = id };
|
||||||
|
|
||||||
|
bound.settings.clients.Add(JToken.FromObject(obj));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static string BuildV2rayConfig(V2raySettings parameters)
|
||||||
|
{
|
||||||
|
var uuidList = parameters.MulitUUID;
|
||||||
|
uuidList.Insert(0, parameters.UUID);
|
||||||
|
|
||||||
|
var xrayConfig = LoadV2rayConfig();
|
||||||
|
|
||||||
|
var baseBound = GetBound("VLESS_TCP_TLS.json");
|
||||||
|
baseBound.port = parameters.Port;
|
||||||
|
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||||
|
{
|
||||||
|
dest = FullbackPort
|
||||||
|
}));
|
||||||
|
xrayConfig.inbounds.Add(baseBound);
|
||||||
|
SetClients(baseBound, uuidList);
|
||||||
|
|
||||||
|
#region Fullbacks
|
||||||
|
|
||||||
|
if (parameters.Types.Contains(RayType.VLESS_WS))
|
||||||
|
{
|
||||||
|
var wsInbound = GetBound("VLESS_WS.json");
|
||||||
|
wsInbound.port = VLESS_WS_Port;
|
||||||
|
SetClients(wsInbound, uuidList);
|
||||||
|
wsInbound.streamSettings.wsSettings.path = parameters.VLESS_WS_Path;
|
||||||
|
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||||
|
{
|
||||||
|
dest = VLESS_WS_Port,
|
||||||
|
path = parameters.VLESS_WS_Path,
|
||||||
|
xver = 1,
|
||||||
|
}));
|
||||||
|
xrayConfig.inbounds.Add(JToken.FromObject(wsInbound));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameters.Types.Contains(RayType.VMESS_TCP))
|
||||||
|
{
|
||||||
|
var mtcpBound = GetBound("VMESS_TCP.json");
|
||||||
|
mtcpBound.port = VMESS_TCP_Port;
|
||||||
|
SetClients(mtcpBound, uuidList);
|
||||||
|
mtcpBound.streamSettings.tcpSettings.header.request.path = parameters.VMESS_TCP_Path;
|
||||||
|
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||||
|
{
|
||||||
|
dest = VMESS_TCP_Port,
|
||||||
|
path = parameters.VMESS_TCP_Path,
|
||||||
|
xver = 1,
|
||||||
|
}));
|
||||||
|
xrayConfig.inbounds.Add(JToken.FromObject(mtcpBound));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameters.Types.Contains(RayType.VMESS_WS))
|
||||||
|
{
|
||||||
|
var mwsBound = GetBound("VMESS_WS.json");
|
||||||
|
mwsBound.port = VMESS_WS_Port;
|
||||||
|
SetClients(mwsBound, uuidList);
|
||||||
|
mwsBound.streamSettings.wsSettings.path = parameters.VMESS_WS_Path;
|
||||||
|
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||||
|
{
|
||||||
|
dest = VMESS_WS_Port,
|
||||||
|
path = parameters.VMESS_WS_Path,
|
||||||
|
xver = 1,
|
||||||
|
}));
|
||||||
|
xrayConfig.inbounds.Add(JToken.FromObject(mwsBound));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameters.Types.Contains(RayType.Trojan_TCP))
|
||||||
|
{
|
||||||
|
var trojanTcpBound = GetBound("Trojan_TCP.json");
|
||||||
|
trojanTcpBound.port = Trojan_TCP_Port;
|
||||||
|
trojanTcpBound.settings.clients[0].password = parameters.TrojanPassword;
|
||||||
|
trojanTcpBound.settings.fallbacks[0].dest = FullbackPort;
|
||||||
|
baseBound.settings.fallbacks[0] = JToken.FromObject(new
|
||||||
|
{
|
||||||
|
dest = Trojan_TCP_Port,
|
||||||
|
xver = 1,
|
||||||
|
});
|
||||||
|
xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
if (parameters.Types.Contains(RayType.VLESS_gRPC))
|
||||||
|
{
|
||||||
|
var gRPCInBound = GetBound("VLESS_gRPC.json");
|
||||||
|
gRPCInBound.port = parameters.VLESS_gRPC_Port;
|
||||||
|
SetClients(gRPCInBound, uuidList);
|
||||||
|
gRPCInBound.streamSettings.grpcSettings.serviceName = parameters.VLESS_gRPC_ServiceName;
|
||||||
|
gRPCInBound.streamSettings.tlsSettings.serverName = parameters.Domain;
|
||||||
|
xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameters.Types.Contains(RayType.VLESS_KCP))
|
||||||
|
{
|
||||||
|
var kcpBound = GetBound("VLESS_KCP.json");
|
||||||
|
kcpBound.port = parameters.VLESS_KCP_Port;
|
||||||
|
SetClients(kcpBound, uuidList);
|
||||||
|
kcpBound.streamSettings.kcpSettings.header.type = parameters.VLESS_KCP_Type;
|
||||||
|
kcpBound.streamSettings.kcpSettings.seed = parameters.VLESS_KCP_Seed;
|
||||||
|
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameters.Types.Contains(RayType.VMESS_KCP))
|
||||||
|
{
|
||||||
|
var kcpBound = GetBound("VMESS_KCP.json");
|
||||||
|
kcpBound.port = parameters.VMESS_KCP_Port;
|
||||||
|
SetClients(kcpBound, uuidList);
|
||||||
|
kcpBound.streamSettings.kcpSettings.header.type = parameters.VMESS_KCP_Type;
|
||||||
|
kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed;
|
||||||
|
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameters.Types.Contains(RayType.ShadowsocksAEAD))
|
||||||
|
{
|
||||||
|
var ssBound = GetBound("Shadowsocks-AEAD.json");
|
||||||
|
ssBound.port = parameters.ShadowSocksPort;
|
||||||
|
ssBound.settings.clients[0].password = parameters.ShadowSocksPassword;
|
||||||
|
ssBound.settings.clients[0].method = parameters.ShadowSocksMethod;
|
||||||
|
xrayConfig.inbounds.Add(JToken.FromObject(ssBound));
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonConvert.SerializeObject(
|
||||||
|
xrayConfig,
|
||||||
|
Formatting.Indented,
|
||||||
|
new JsonSerializerSettings()
|
||||||
|
{
|
||||||
|
NullValueHandling = NullValueHandling.Ignore
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static dynamic GetBound(string name)
|
||||||
|
{
|
||||||
|
return LoadJsonObj(Path.Combine(ServerInboundsDir, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static dynamic LoadJsonObj(string path)
|
||||||
|
{
|
||||||
|
if (File.Exists(path))
|
||||||
|
{
|
||||||
|
var jsonStr = File.ReadAllText(path, Encoding.UTF8);
|
||||||
|
return JToken.FromObject(JsonConvert.DeserializeObject(jsonStr));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
433
ProxySuper.Core/Services/V2rayService.cs
Normal file
433
ProxySuper.Core/Services/V2rayService.cs
Normal file
@ -0,0 +1,433 @@
|
|||||||
|
using Microsoft.Win32;
|
||||||
|
using ProxySuper.Core.Models.Hosts;
|
||||||
|
using ProxySuper.Core.Models.Projects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace ProxySuper.Core.Services
|
||||||
|
{
|
||||||
|
public class V2rayService : ServiceBase<V2raySettings>
|
||||||
|
{
|
||||||
|
public V2rayService(Host host, V2raySettings settings) : base(host, settings)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Install()
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int index = 1;
|
||||||
|
EnsureRootUser();
|
||||||
|
|
||||||
|
if (FileExists("/usr/local/bin/v2ray"))
|
||||||
|
{
|
||||||
|
var btnResult = MessageBox.Show("已经安装v2ray,是否需要重装?", "提示", MessageBoxButton.YesNo);
|
||||||
|
if (btnResult == MessageBoxResult.No)
|
||||||
|
{
|
||||||
|
MessageBox.Show("安装终止", "提示");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 检测系统环境";
|
||||||
|
EnsureSystemEnv();
|
||||||
|
Progress.Percentage = 5;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 安装必要的系统工具";
|
||||||
|
InstallSystemTools();
|
||||||
|
Progress.Percentage = 15;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 配置防火墙";
|
||||||
|
ConfigFirewalld();
|
||||||
|
Progress.Percentage = 20;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 检测网络环境";
|
||||||
|
EnsureNetwork();
|
||||||
|
if (Settings.IsIPAddress)
|
||||||
|
{
|
||||||
|
Progress.Desc = ("检查域名是否解析正确");
|
||||||
|
ValidateDomain();
|
||||||
|
}
|
||||||
|
Progress.Percentage = 25;
|
||||||
|
|
||||||
|
Progress.Step = $"{index}. 同步系统和本地时间";
|
||||||
|
SyncTimeDiff();
|
||||||
|
Progress.Percentage = 30;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 安装Caddy服务器";
|
||||||
|
InstallCaddy();
|
||||||
|
Progress.Percentage = 50;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 安装V2ray-Core";
|
||||||
|
InstallV2ray();
|
||||||
|
Progress.Percentage = 80;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 上传Web服务器配置";
|
||||||
|
UploadCaddyFile();
|
||||||
|
Progress.Percentage = 90;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 启动BBR";
|
||||||
|
EnableBBR();
|
||||||
|
|
||||||
|
Progress.Desc = "重启V2ray服务";
|
||||||
|
RunCmd("systemctl restart caddy");
|
||||||
|
RunCmd("systemctl restart V2ray");
|
||||||
|
|
||||||
|
Progress.Percentage = 100;
|
||||||
|
Progress.Step = "安装成功";
|
||||||
|
Progress.Desc = string.Empty;
|
||||||
|
|
||||||
|
if (!Settings.WithTLS)
|
||||||
|
{
|
||||||
|
Progress.Step = "安装成功,请上传您的 TLS 证书。";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateSettings()
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Progress.Step = "更新V2ray配置";
|
||||||
|
Progress.Percentage = 0;
|
||||||
|
EnsureRootUser();
|
||||||
|
var index = 0;
|
||||||
|
|
||||||
|
Progress.Desc = $"{index++}. 检测系统环境";
|
||||||
|
EnsureSystemEnv();
|
||||||
|
Progress.Percentage = 20;
|
||||||
|
|
||||||
|
Progress.Desc = $"{index++}. 配置防火墙";
|
||||||
|
RunCmd("systemctl stop v2ray");
|
||||||
|
RunCmd("systemctl stop caddy");
|
||||||
|
ConfigFirewalld();
|
||||||
|
Progress.Percentage = 40;
|
||||||
|
|
||||||
|
Progress.Desc = $"{index++}. 上传V2ray配置文件";
|
||||||
|
var configJson = V2rayConfigBuilder.BuildV2rayConfig(Settings);
|
||||||
|
WriteToFile(configJson, "/usr/local/etc/v2ray/config.json");
|
||||||
|
Progress.Percentage = 70;
|
||||||
|
|
||||||
|
Progress.Desc = $"{index++}. 上传Caddy配置文件";
|
||||||
|
UploadCaddyFile();
|
||||||
|
Progress.Percentage = 90;
|
||||||
|
|
||||||
|
Progress.Desc = $"{index++}. 重启v2ray服务";
|
||||||
|
RunCmd("systemctl restart caddy");
|
||||||
|
RunCmd("systemctl restart v2ray");
|
||||||
|
Progress.Percentage = 100;
|
||||||
|
|
||||||
|
Progress.Desc = ("更新配置成功");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateV2rayCore()
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Progress.Step = "更新V2ray-Core";
|
||||||
|
Progress.Percentage = 0;
|
||||||
|
|
||||||
|
EnsureRootUser();
|
||||||
|
Progress.Percentage = 20;
|
||||||
|
|
||||||
|
Progress.Desc = "下载最新版本V2ray-Core";
|
||||||
|
EnsureSystemEnv();
|
||||||
|
Progress.Percentage = 40;
|
||||||
|
|
||||||
|
RunCmd("bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)");
|
||||||
|
RunCmd("systemctl restart v2ray");
|
||||||
|
Progress.Percentage = 100;
|
||||||
|
|
||||||
|
Progress.Desc = "更新V2ray-Core成功";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Uninstall()
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
EnsureRootUser();
|
||||||
|
|
||||||
|
var index = 1;
|
||||||
|
Progress.Percentage = 0;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 检测系统环境";
|
||||||
|
Progress.Desc = "检测系统环境";
|
||||||
|
EnsureSystemEnv();
|
||||||
|
Progress.Percentage = 20;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 卸载Caddy服务";
|
||||||
|
UninstallCaddy();
|
||||||
|
Progress.Percentage = 40;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 卸载V2ray服务";
|
||||||
|
UninstallV2ray();
|
||||||
|
Progress.Percentage = 60;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 卸载Acme证书申请服务";
|
||||||
|
UninstallAcme();
|
||||||
|
Progress.Percentage = 80;
|
||||||
|
|
||||||
|
Progress.Step = $"{index++}. 重置防火墙端口";
|
||||||
|
ResetFirewalld();
|
||||||
|
Progress.Percentage = 100;
|
||||||
|
|
||||||
|
Progress.Step = "卸载完成";
|
||||||
|
Progress.Desc = "卸载完成";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UploadCert()
|
||||||
|
{
|
||||||
|
var fileDialog = new OpenFileDialog();
|
||||||
|
fileDialog.Filter = "压缩文件|*.zip";
|
||||||
|
fileDialog.FileOk += DoUploadCert;
|
||||||
|
fileDialog.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UploadWeb()
|
||||||
|
{
|
||||||
|
var fileDialog = new OpenFileDialog();
|
||||||
|
fileDialog.Filter = "压缩文件|*.zip";
|
||||||
|
fileDialog.FileOk += DoUploadWeb;
|
||||||
|
fileDialog.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ApplyForCert()
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Progress.Percentage = 0;
|
||||||
|
Progress.Step = "续签证书";
|
||||||
|
|
||||||
|
InstallCert(
|
||||||
|
dirPath: "/usr/local/etc/v2ray/ssl",
|
||||||
|
certName: "v2ray_ssl.crt",
|
||||||
|
keyName: "v2ray_ssl.key");
|
||||||
|
|
||||||
|
Progress.Percentage = 90;
|
||||||
|
Progress.Desc = "重启服务";
|
||||||
|
RunCmd("systemctl restart v2ray");
|
||||||
|
|
||||||
|
Progress.Percentage = 100;
|
||||||
|
Progress.Desc = "续签证书成功";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region 似有方法
|
||||||
|
|
||||||
|
private void DoUploadCert(object sender, CancelEventArgs e)
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
EnsureRootUser();
|
||||||
|
|
||||||
|
Progress.Percentage = 0;
|
||||||
|
Progress.Step = "上传自有证书";
|
||||||
|
Progress.Desc = "检测系统环境";
|
||||||
|
|
||||||
|
EnsureSystemEnv();
|
||||||
|
Progress.Percentage = 20;
|
||||||
|
|
||||||
|
Progress.Desc = "正在上传文件";
|
||||||
|
var file = sender as OpenFileDialog;
|
||||||
|
using (var stream = file.OpenFile())
|
||||||
|
{
|
||||||
|
var oldFileName = $"ssl_{DateTime.Now.Ticks}";
|
||||||
|
RunCmd($"mv /usr/local/etc/v2ray/ssl /usr/local/etc/v2ray/{oldFileName}");
|
||||||
|
|
||||||
|
RunCmd("mkdir /usr/local/etc/v2ray/ssl");
|
||||||
|
UploadFile(stream, "/usr/local/etc/v2ray/ssl/ssl.zip");
|
||||||
|
RunCmd("unzip /usr/local/etc/v2ray/ssl/ssl.zip -d /usr/local/etc/v2ray/ssl");
|
||||||
|
}
|
||||||
|
|
||||||
|
var crtFiles = RunCmd("find /usr/local/etc/v2ray/ssl/*.crt").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
var keyFiles = RunCmd("find /usr/local/etc/v2ray/ssl/*.key").Split("\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (crtFiles.Length > 0 && keyFiles.Length > 0)
|
||||||
|
{
|
||||||
|
RunCmd($"mv {crtFiles[0]} /usr/local/etc/v2ray/ssl/v2ray_ssl.crt");
|
||||||
|
RunCmd($"mv {keyFiles[0]} /usr/local/etc/v2ray/ssl/v2ray_ssl.key");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Progress.Step = "上传失败";
|
||||||
|
Progress.Desc = "上传证书失败,缺少 .crt 和 .key 文件";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Progress.Desc = "重启V2ray服务";
|
||||||
|
RunCmd("systemctl restart v2ray");
|
||||||
|
|
||||||
|
Progress.Percentage = 100;
|
||||||
|
Progress.Desc = "上传证书完成";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DoUploadWeb(object sender, CancelEventArgs e)
|
||||||
|
{
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
EnsureRootUser();
|
||||||
|
|
||||||
|
Progress.Step = "上传静态网站";
|
||||||
|
Progress.Desc = "上传静态网站";
|
||||||
|
Progress.Percentage = 0;
|
||||||
|
|
||||||
|
Progress.Desc = "检测系统环境";
|
||||||
|
EnsureSystemEnv();
|
||||||
|
Progress.Percentage = 20;
|
||||||
|
|
||||||
|
Progress.Desc = "创建网站目录";
|
||||||
|
if (!FileExists("/usr/share/caddy"))
|
||||||
|
{
|
||||||
|
RunCmd("mkdir /usr/share/caddy");
|
||||||
|
}
|
||||||
|
RunCmd("rm -rf /usr/share/caddy/*");
|
||||||
|
Progress.Percentage = 40;
|
||||||
|
|
||||||
|
Progress.Desc = "正在上传文件";
|
||||||
|
var file = sender as OpenFileDialog;
|
||||||
|
using (var stream = file.OpenFile())
|
||||||
|
{
|
||||||
|
UploadFile(stream, "/usr/share/caddy/caddy.zip");
|
||||||
|
RunCmd("unzip /usr/share/caddy/caddy.zip -d /usr/share/caddy");
|
||||||
|
}
|
||||||
|
RunCmd("chmod -R 777 /usr/share/caddy");
|
||||||
|
Progress.Percentage = 80;
|
||||||
|
|
||||||
|
Progress.Desc = "上传Web配置文件";
|
||||||
|
UploadCaddyFile(useCustomWeb: true);
|
||||||
|
Progress.Percentage = 100;
|
||||||
|
|
||||||
|
Progress.Desc = "上传静态网站成功";
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InstallV2ray()
|
||||||
|
{
|
||||||
|
Progress.Desc = ("开始安装V2ray-Core");
|
||||||
|
RunCmd("bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)");
|
||||||
|
|
||||||
|
if (!FileExists("/usr/local/bin/v2ray"))
|
||||||
|
{
|
||||||
|
Progress.Desc = ("V2ray-Core安装失败,请联系开发者");
|
||||||
|
throw new Exception("V2ray-Core安装失败,请联系开发者");
|
||||||
|
}
|
||||||
|
|
||||||
|
Progress.Desc = ("设置V2ray-Core权限");
|
||||||
|
RunCmd($"sed -i 's/User=nobody/User=root/g' /etc/systemd/system/v2ray.service");
|
||||||
|
RunCmd($"sed -i 's/CapabilityBoundingSet=/#CapabilityBoundingSet=/g' /etc/systemd/system/v2ray.service");
|
||||||
|
RunCmd($"sed -i 's/AmbientCapabilities=/#AmbientCapabilities=/g' /etc/systemd/system/v2ray.service");
|
||||||
|
RunCmd($"systemctl daemon-reload");
|
||||||
|
|
||||||
|
if (FileExists("/usr/local/etc/v2ray/config.json"))
|
||||||
|
{
|
||||||
|
RunCmd(@"mv /usr/local/etc/v2ray/config.json /usr/local/etc/v2ray/config.json.1");
|
||||||
|
}
|
||||||
|
Progress.Percentage = 60;
|
||||||
|
|
||||||
|
if (Settings.WithTLS && !Settings.IsIPAddress)
|
||||||
|
{
|
||||||
|
Progress.Desc = ("安装TLS证书");
|
||||||
|
InstallCert(
|
||||||
|
dirPath: "/usr/local/etc/v2ray/ssl",
|
||||||
|
certName: "v2ray_ssl.crt",
|
||||||
|
keyName: "v2ray_ssl.key");
|
||||||
|
Progress.Percentage = 75;
|
||||||
|
}
|
||||||
|
|
||||||
|
Progress.Desc = ("生成v2ray服务器配置文件");
|
||||||
|
var configJson = V2rayConfigBuilder.BuildV2rayConfig(Settings);
|
||||||
|
WriteToFile(configJson, "/usr/local/etc/v2ray/config.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UploadCaddyFile(bool useCustomWeb = false)
|
||||||
|
{
|
||||||
|
var configJson = V2rayConfigBuilder.BuildCaddyConfig(Settings, useCustomWeb);
|
||||||
|
|
||||||
|
if (FileExists("/etc/caddy/Caddyfile"))
|
||||||
|
{
|
||||||
|
RunCmd("mv /etc/caddy/Caddyfile /etc/caddy/Caddyfile.back");
|
||||||
|
}
|
||||||
|
WriteToFile(configJson, "/etc/caddy/Caddyfile");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void UninstallV2ray()
|
||||||
|
{
|
||||||
|
Progress.Desc = "关闭V2ray服务";
|
||||||
|
RunCmd("systemctl stop v2ray");
|
||||||
|
RunCmd("systemctl disable v2ray");
|
||||||
|
|
||||||
|
Progress.Desc = "卸载V2ray";
|
||||||
|
RunCmd("bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) --remove");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UninstallAcme()
|
||||||
|
{
|
||||||
|
Progress.Desc = "卸载 acme.sh";
|
||||||
|
RunCmd("acme.sh --uninstall");
|
||||||
|
|
||||||
|
Progress.Desc = "删除 acme.sh 相关文件";
|
||||||
|
RunCmd("rm -rf ~/.acme.sh");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -129,7 +129,7 @@ namespace ProxySuper.Core.Services
|
|||||||
|
|
||||||
#region Fullbacks
|
#region Fullbacks
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.VLESS_WS))
|
if (parameters.Types.Contains(RayType.VLESS_WS))
|
||||||
{
|
{
|
||||||
var wsInbound = GetBound("VLESS_WS.json");
|
var wsInbound = GetBound("VLESS_WS.json");
|
||||||
wsInbound.port = VLESS_WS_Port;
|
wsInbound.port = VLESS_WS_Port;
|
||||||
@ -144,7 +144,7 @@ namespace ProxySuper.Core.Services
|
|||||||
xrayConfig.inbounds.Add(JToken.FromObject(wsInbound));
|
xrayConfig.inbounds.Add(JToken.FromObject(wsInbound));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.VMESS_TCP))
|
if (parameters.Types.Contains(RayType.VMESS_TCP))
|
||||||
{
|
{
|
||||||
var mtcpBound = GetBound("VMESS_TCP.json");
|
var mtcpBound = GetBound("VMESS_TCP.json");
|
||||||
mtcpBound.port = VMESS_TCP_Port;
|
mtcpBound.port = VMESS_TCP_Port;
|
||||||
@ -159,7 +159,7 @@ namespace ProxySuper.Core.Services
|
|||||||
xrayConfig.inbounds.Add(JToken.FromObject(mtcpBound));
|
xrayConfig.inbounds.Add(JToken.FromObject(mtcpBound));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.VMESS_WS))
|
if (parameters.Types.Contains(RayType.VMESS_WS))
|
||||||
{
|
{
|
||||||
var mwsBound = GetBound("VMESS_WS.json");
|
var mwsBound = GetBound("VMESS_WS.json");
|
||||||
mwsBound.port = VMESS_WS_Port;
|
mwsBound.port = VMESS_WS_Port;
|
||||||
@ -174,7 +174,7 @@ namespace ProxySuper.Core.Services
|
|||||||
xrayConfig.inbounds.Add(JToken.FromObject(mwsBound));
|
xrayConfig.inbounds.Add(JToken.FromObject(mwsBound));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.Trojan_TCP))
|
if (parameters.Types.Contains(RayType.Trojan_TCP))
|
||||||
{
|
{
|
||||||
var trojanTcpBound = GetBound("Trojan_TCP.json");
|
var trojanTcpBound = GetBound("Trojan_TCP.json");
|
||||||
trojanTcpBound.port = Trojan_TCP_Port;
|
trojanTcpBound.port = Trojan_TCP_Port;
|
||||||
@ -189,7 +189,7 @@ namespace ProxySuper.Core.Services
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.VLESS_gRPC))
|
if (parameters.Types.Contains(RayType.VLESS_gRPC))
|
||||||
{
|
{
|
||||||
var gRPCInBound = GetBound("VLESS_gRPC.json");
|
var gRPCInBound = GetBound("VLESS_gRPC.json");
|
||||||
gRPCInBound.port = parameters.VLESS_gRPC_Port;
|
gRPCInBound.port = parameters.VLESS_gRPC_Port;
|
||||||
@ -199,7 +199,7 @@ namespace ProxySuper.Core.Services
|
|||||||
xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound));
|
xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.VLESS_KCP))
|
if (parameters.Types.Contains(RayType.VLESS_KCP))
|
||||||
{
|
{
|
||||||
var kcpBound = GetBound("VLESS_KCP.json");
|
var kcpBound = GetBound("VLESS_KCP.json");
|
||||||
kcpBound.port = parameters.VLESS_KCP_Port;
|
kcpBound.port = parameters.VLESS_KCP_Port;
|
||||||
@ -209,7 +209,7 @@ namespace ProxySuper.Core.Services
|
|||||||
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.VMESS_KCP))
|
if (parameters.Types.Contains(RayType.VMESS_KCP))
|
||||||
{
|
{
|
||||||
var kcpBound = GetBound("VMESS_KCP.json");
|
var kcpBound = GetBound("VMESS_KCP.json");
|
||||||
kcpBound.port = parameters.VMESS_KCP_Port;
|
kcpBound.port = parameters.VMESS_KCP_Port;
|
||||||
@ -219,7 +219,7 @@ namespace ProxySuper.Core.Services
|
|||||||
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameters.Types.Contains(XrayType.ShadowsocksAEAD))
|
if (parameters.Types.Contains(RayType.ShadowsocksAEAD))
|
||||||
{
|
{
|
||||||
var ssBound = GetBound("Shadowsocks-AEAD.json");
|
var ssBound = GetBound("Shadowsocks-AEAD.json");
|
||||||
ssBound.port = parameters.ShadowSocksPort;
|
ssBound.port = parameters.ShadowSocksPort;
|
||||||
|
@ -58,6 +58,8 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
|
|
||||||
public MvxObservableCollection<Record> Records { get; set; }
|
public MvxObservableCollection<Record> Records { get; set; }
|
||||||
|
|
||||||
|
public IMvxCommand AddV2rayCommand => new MvxAsyncCommand(AddV2rayRecord);
|
||||||
|
|
||||||
public IMvxCommand AddXrayCommand => new MvxAsyncCommand(AddXrayRecord);
|
public IMvxCommand AddXrayCommand => new MvxAsyncCommand(AddXrayRecord);
|
||||||
|
|
||||||
public IMvxCommand AddTrojanGoCommand => new MvxAsyncCommand(AddTrojanGoRecord);
|
public IMvxCommand AddTrojanGoCommand => new MvxAsyncCommand(AddTrojanGoRecord);
|
||||||
@ -74,6 +76,20 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
|
|
||||||
public IMvxCommand InstallCommand => new MvxAsyncCommand<string>(GoToInstall);
|
public IMvxCommand InstallCommand => new MvxAsyncCommand<string>(GoToInstall);
|
||||||
|
|
||||||
|
public async Task AddV2rayRecord()
|
||||||
|
{
|
||||||
|
Record record = new Record();
|
||||||
|
record.Id = Utils.GetTickID();
|
||||||
|
record.Host = new Host();
|
||||||
|
record.V2raySettings = new V2raySettings();
|
||||||
|
|
||||||
|
var result = await _navigationService.Navigate<V2rayEditorViewModel, Record, Record>(record);
|
||||||
|
if (result == null) return;
|
||||||
|
|
||||||
|
Records.Add(result);
|
||||||
|
SaveToJson();
|
||||||
|
}
|
||||||
|
|
||||||
public async Task AddXrayRecord()
|
public async Task AddXrayRecord()
|
||||||
{
|
{
|
||||||
Record record = new Record();
|
Record record = new Record();
|
||||||
@ -140,6 +156,14 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
if (record == null) return;
|
if (record == null) return;
|
||||||
|
|
||||||
Record result = null;
|
Record result = null;
|
||||||
|
if (record.Type == ProjectType.V2ray)
|
||||||
|
{
|
||||||
|
result = await _navigationService.Navigate<V2rayEditorViewModel, Record, Record>(record);
|
||||||
|
if (result == null) return;
|
||||||
|
|
||||||
|
record.Host = result.Host;
|
||||||
|
record.V2raySettings = result.V2raySettings;
|
||||||
|
}
|
||||||
if (record.Type == ProjectType.Xray)
|
if (record.Type == ProjectType.Xray)
|
||||||
{
|
{
|
||||||
result = await _navigationService.Navigate<XrayEditorViewModel, Record, Record>(record);
|
result = await _navigationService.Navigate<XrayEditorViewModel, Record, Record>(record);
|
||||||
@ -196,6 +220,10 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
var record = Records.FirstOrDefault(x => x.Id == id);
|
var record = Records.FirstOrDefault(x => x.Id == id);
|
||||||
if (record == null) return;
|
if (record == null) return;
|
||||||
|
|
||||||
|
if (record.Type == ProjectType.V2ray)
|
||||||
|
{
|
||||||
|
await _navigationService.Navigate<V2rayConfigViewModel, V2raySettings>(record.V2raySettings);
|
||||||
|
}
|
||||||
if (record.Type == ProjectType.Xray)
|
if (record.Type == ProjectType.Xray)
|
||||||
{
|
{
|
||||||
await _navigationService.Navigate<XrayConfigViewModel, XraySettings>(record.XraySettings);
|
await _navigationService.Navigate<XrayConfigViewModel, XraySettings>(record.XraySettings);
|
||||||
@ -219,6 +247,10 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
var record = Records.FirstOrDefault(x => x.Id == id);
|
var record = Records.FirstOrDefault(x => x.Id == id);
|
||||||
if (record == null) return;
|
if (record == null) return;
|
||||||
|
|
||||||
|
if (record.Type == ProjectType.V2ray)
|
||||||
|
{
|
||||||
|
await _navigationService.Navigate<V2rayInstallViewModel, Record>(record);
|
||||||
|
}
|
||||||
if (record.Type == ProjectType.Xray)
|
if (record.Type == ProjectType.Xray)
|
||||||
{
|
{
|
||||||
await _navigationService.Navigate<XrayInstallViewModel, Record>(record);
|
await _navigationService.Navigate<XrayInstallViewModel, Record>(record);
|
||||||
|
93
ProxySuper.Core/ViewModels/V2rayConfigViewModel.cs
Normal file
93
ProxySuper.Core/ViewModels/V2rayConfigViewModel.cs
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
using MvvmCross.ViewModels;
|
||||||
|
using ProxySuper.Core.Models.Projects;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProxySuper.Core.ViewModels
|
||||||
|
{
|
||||||
|
public class V2rayConfigViewModel : MvxViewModel<V2raySettings>
|
||||||
|
{
|
||||||
|
public V2raySettings Settings { get; set; }
|
||||||
|
|
||||||
|
public override void Prepare(V2raySettings parameter)
|
||||||
|
{
|
||||||
|
Settings = parameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool Checked_VLESS_TCP
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Types.Contains(RayType.VLESS_TCP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Checked_VLESS_WS
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Types.Contains(RayType.VLESS_WS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Checked_VLESS_KCP
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Types.Contains(RayType.VLESS_KCP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Checked_VLESS_gRPC
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Types.Contains(RayType.VLESS_gRPC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Checked_VMESS_TCP
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Types.Contains(RayType.VMESS_TCP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Checked_VMESS_WS
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Types.Contains(RayType.VMESS_WS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Checked_VMESS_KCP
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Types.Contains(RayType.VMESS_KCP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Checked_Trojan_TCP
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Types.Contains(RayType.Trojan_TCP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CheckedShadowSocks
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Types.Contains(RayType.ShadowsocksAEAD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
442
ProxySuper.Core/ViewModels/V2rayEditorViewModel.cs
Normal file
442
ProxySuper.Core/ViewModels/V2rayEditorViewModel.cs
Normal file
@ -0,0 +1,442 @@
|
|||||||
|
using MvvmCross.Commands;
|
||||||
|
using MvvmCross.Navigation;
|
||||||
|
using MvvmCross.ViewModels;
|
||||||
|
using ProxySuper.Core.Models;
|
||||||
|
using ProxySuper.Core.Models.Hosts;
|
||||||
|
using ProxySuper.Core.Models.Projects;
|
||||||
|
using ProxySuper.Core.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace ProxySuper.Core.ViewModels
|
||||||
|
{
|
||||||
|
public partial class V2rayEditorViewModel : MvxViewModel<Record, Record>
|
||||||
|
{
|
||||||
|
public V2rayEditorViewModel(IMvxNavigationService navigationService)
|
||||||
|
{
|
||||||
|
NavigationService = navigationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
public Host Host { get; set; }
|
||||||
|
|
||||||
|
public V2raySettings Settings { get; set; }
|
||||||
|
|
||||||
|
public IMvxCommand SaveCommand => new MvxCommand(Save);
|
||||||
|
|
||||||
|
public IMvxCommand SaveAndInstallCommand => new MvxCommand(SaveAndInstall);
|
||||||
|
|
||||||
|
public IMvxNavigationService NavigationService { get; }
|
||||||
|
|
||||||
|
public override void Prepare(Record parameter)
|
||||||
|
{
|
||||||
|
var record = Utils.DeepClone(parameter);
|
||||||
|
Id = record.Id;
|
||||||
|
Host = record.Host;
|
||||||
|
Settings = record.V2raySettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Save()
|
||||||
|
{
|
||||||
|
NavigationService.Close(this, new Record()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
Host = Host,
|
||||||
|
V2raySettings = Settings,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveAndInstall()
|
||||||
|
{
|
||||||
|
var record = new Record()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
Host = Host,
|
||||||
|
V2raySettings = Settings,
|
||||||
|
};
|
||||||
|
NavigationService.Close(this, record);
|
||||||
|
NavigationService.Navigate<V2rayInstallViewModel, Record>(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public partial class V2rayEditorViewModel
|
||||||
|
{
|
||||||
|
public IMvxCommand RandomUuid => new MvxCommand(() => GetUuid());
|
||||||
|
|
||||||
|
public bool WithTLS
|
||||||
|
{
|
||||||
|
get => Settings.WithTLS;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Settings.WithTLS = value;
|
||||||
|
RaisePropertyChanged("Port");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Port
|
||||||
|
{
|
||||||
|
get => Settings.Port;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Settings.Port = value;
|
||||||
|
RaisePropertyChanged("Port");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int VLESS_KCP_Port
|
||||||
|
{
|
||||||
|
get => Settings.VLESS_KCP_Port;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Settings.VLESS_KCP_Port = value;
|
||||||
|
RaisePropertyChanged("VLESS_KCP_Port");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int VMESS_KCP_Port
|
||||||
|
{
|
||||||
|
get => Settings.VMESS_KCP_Port;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Settings.VMESS_KCP_Port = value;
|
||||||
|
RaisePropertyChanged("VMESS_KCP_Port");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ShadowSocksPort
|
||||||
|
{
|
||||||
|
get => Settings.ShadowSocksPort;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Settings.ShadowSocksPort = value;
|
||||||
|
RaisePropertyChanged("ShadowSocksPort");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public string UUID
|
||||||
|
{
|
||||||
|
get => Settings.UUID;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Settings.UUID = value;
|
||||||
|
RaisePropertyChanged("UUID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string MultiUUID
|
||||||
|
{
|
||||||
|
get => string.Join(",", Settings.MulitUUID);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var input = value.Replace(',', ',');
|
||||||
|
var arr = input.Split(',').ToList();
|
||||||
|
Settings.MulitUUID = arr;
|
||||||
|
RaisePropertyChanged("MultiUUID");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Domain
|
||||||
|
{
|
||||||
|
get => Settings.Domain;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Settings.Domain = value;
|
||||||
|
RaisePropertyChanged("Domain");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string MaskDomain
|
||||||
|
{
|
||||||
|
get => Settings.MaskDomain;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Settings.MaskDomain = value;
|
||||||
|
RaisePropertyChanged("MaskDomain");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string TrojanPassword
|
||||||
|
{
|
||||||
|
get => Settings.TrojanPassword;
|
||||||
|
set => Settings.TrojanPassword = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Checked_Trojan_TCP
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Types.Contains(RayType.Trojan_TCP);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == true)
|
||||||
|
{
|
||||||
|
if (!Settings.Types.Contains(RayType.Trojan_TCP))
|
||||||
|
Settings.Types.Add(RayType.Trojan_TCP);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Settings.Types.Remove(RayType.Trojan_TCP);
|
||||||
|
}
|
||||||
|
RaisePropertyChanged("Checked_Trojan_TCP");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string Trojan_TCP_ShareLink
|
||||||
|
{
|
||||||
|
get => ShareLink.Build(RayType.Trojan_TCP, Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<string> _ssMethods = new List<string> { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305" };
|
||||||
|
public List<string> ShadowSocksMethods => _ssMethods;
|
||||||
|
public bool CheckedShadowSocks
|
||||||
|
{
|
||||||
|
|
||||||
|
get => Settings.Types.Contains(RayType.ShadowsocksAEAD);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CheckBoxChanged(value, RayType.ShadowsocksAEAD);
|
||||||
|
RaisePropertyChanged("CheckedShadowSocks");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string ShadowSocksPassword
|
||||||
|
{
|
||||||
|
get => Settings.ShadowSocksPassword;
|
||||||
|
set => Settings.ShadowSocksPassword = value;
|
||||||
|
}
|
||||||
|
public string ShadowSocksMethod
|
||||||
|
{
|
||||||
|
get => Settings.ShadowSocksMethod;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var namespaceStr = typeof(ComboBoxItem).FullName + ":";
|
||||||
|
var trimValue = value.Replace(namespaceStr, "");
|
||||||
|
trimValue = trimValue.Trim();
|
||||||
|
Settings.ShadowSocksMethod = trimValue;
|
||||||
|
RaisePropertyChanged("ShadowSocksMethod");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string ShadowSocksShareLink
|
||||||
|
{
|
||||||
|
get => ShareLink.Build(RayType.ShadowsocksAEAD, Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void CheckBoxChanged(bool value, RayType type)
|
||||||
|
{
|
||||||
|
if (value == true)
|
||||||
|
{
|
||||||
|
if (!Settings.Types.Contains(type))
|
||||||
|
{
|
||||||
|
Settings.Types.Add(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Settings.Types.RemoveAll(x => x == type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void GetUuid()
|
||||||
|
{
|
||||||
|
UUID = Guid.NewGuid().ToString();
|
||||||
|
RaisePropertyChanged("UUID");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// VMESS
|
||||||
|
/// </summary>
|
||||||
|
public partial class V2rayEditorViewModel
|
||||||
|
{
|
||||||
|
// vmess tcp
|
||||||
|
public bool Checked_VMESS_TCP
|
||||||
|
{
|
||||||
|
get => Settings.Types.Contains(RayType.VMESS_TCP);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CheckBoxChanged(value, RayType.VMESS_TCP);
|
||||||
|
RaisePropertyChanged("Checked_VMESS_TCP");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string VMESS_TCP_Path
|
||||||
|
{
|
||||||
|
get => Settings.VMESS_TCP_Path;
|
||||||
|
set => Settings.VMESS_TCP_Path = value;
|
||||||
|
}
|
||||||
|
public string VMESS_TCP_ShareLink
|
||||||
|
{
|
||||||
|
get => ShareLink.Build(RayType.VMESS_TCP, Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vmess ws
|
||||||
|
public bool Checked_VMESS_WS
|
||||||
|
{
|
||||||
|
get => Settings.Types.Contains(RayType.VMESS_WS);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CheckBoxChanged(value, RayType.VMESS_WS);
|
||||||
|
RaisePropertyChanged("Checked_VMESS_WS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string VMESS_WS_Path
|
||||||
|
{
|
||||||
|
get => Settings.VMESS_WS_Path;
|
||||||
|
set => Settings.VMESS_WS_Path = value;
|
||||||
|
}
|
||||||
|
public string VMESS_WS_ShareLink
|
||||||
|
{
|
||||||
|
get => ShareLink.Build(RayType.VMESS_WS, Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vmess kcp
|
||||||
|
public string VMESS_KCP_Seed
|
||||||
|
{
|
||||||
|
get => Settings.VMESS_KCP_Seed;
|
||||||
|
set => Settings.VMESS_KCP_Seed = value;
|
||||||
|
}
|
||||||
|
public string VMESS_KCP_Type
|
||||||
|
{
|
||||||
|
get => Settings.VMESS_KCP_Type;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var namespaceStr = typeof(ComboBoxItem).FullName + ":";
|
||||||
|
var trimValue = value.Replace(namespaceStr, "");
|
||||||
|
trimValue = trimValue.Trim();
|
||||||
|
Settings.VMESS_KCP_Type = trimValue;
|
||||||
|
RaisePropertyChanged("VMESS_KCP_Type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool Checked_VMESS_KCP
|
||||||
|
{
|
||||||
|
get => Settings.Types.Contains(RayType.VMESS_KCP);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CheckBoxChanged(value, RayType.VMESS_KCP);
|
||||||
|
RaisePropertyChanged("Checked_VMESS_KCP");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string VMESS_KCP_ShareLink
|
||||||
|
{
|
||||||
|
get => ShareLink.Build(RayType.VMESS_KCP, Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private List<string> _kcpTypes = new List<string> { "none", "srtp", "utp", "wechat-video", "dtls", "wireguard", };
|
||||||
|
public List<string> KcpTypes => _kcpTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// VLESS
|
||||||
|
/// </summary>
|
||||||
|
public partial class V2rayEditorViewModel
|
||||||
|
{
|
||||||
|
// vless tcp
|
||||||
|
public bool Checked_VLESS_TCP
|
||||||
|
{
|
||||||
|
get => Settings.Types.Contains(RayType.VLESS_TCP);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CheckBoxChanged(value, RayType.VLESS_TCP);
|
||||||
|
RaisePropertyChanged("Checked_VLESS_TCP");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string VLESS_TCP_ShareLink
|
||||||
|
{
|
||||||
|
get => ShareLink.Build(RayType.VLESS_TCP, Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// vless ws
|
||||||
|
public string VLESS_WS_Path
|
||||||
|
{
|
||||||
|
get => Settings.VLESS_WS_Path;
|
||||||
|
set => Settings.VLESS_WS_Path = value;
|
||||||
|
}
|
||||||
|
public bool Checked_VLESS_WS
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Types.Contains(RayType.VLESS_WS);
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CheckBoxChanged(value, RayType.VLESS_WS);
|
||||||
|
RaisePropertyChanged("Checked_VLESS_WS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string VLESS_WS_ShareLink
|
||||||
|
{
|
||||||
|
get => ShareLink.Build(RayType.VLESS_WS, Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vless kcp
|
||||||
|
public string VLESS_KCP_Seed
|
||||||
|
{
|
||||||
|
get => Settings.VLESS_KCP_Seed;
|
||||||
|
set => Settings.VLESS_KCP_Seed = value;
|
||||||
|
}
|
||||||
|
public string VLESS_KCP_Type
|
||||||
|
{
|
||||||
|
get => Settings.VLESS_KCP_Type;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var namespaceStr = typeof(ComboBoxItem).FullName + ":";
|
||||||
|
var trimValue = value.Replace(namespaceStr, "");
|
||||||
|
trimValue = trimValue.Trim();
|
||||||
|
Settings.VLESS_KCP_Type = trimValue;
|
||||||
|
RaisePropertyChanged("VLESS_KCP_Type");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool Checked_VLESS_KCP
|
||||||
|
{
|
||||||
|
get => Settings.Types.Contains(RayType.VLESS_KCP);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CheckBoxChanged(value, RayType.VLESS_KCP);
|
||||||
|
RaisePropertyChanged("Checked_VLESS_KCP");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string VLESS_KCP_ShareLink
|
||||||
|
{
|
||||||
|
get => ShareLink.Build(RayType.VLESS_KCP, Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
// vless grpc
|
||||||
|
public string VLESS_gRPC_ServiceName
|
||||||
|
{
|
||||||
|
get => Settings.VLESS_gRPC_ServiceName;
|
||||||
|
set => Settings.VLESS_gRPC_ServiceName = value;
|
||||||
|
}
|
||||||
|
public int VLESS_gRPC_Port
|
||||||
|
{
|
||||||
|
get => Settings.VLESS_gRPC_Port;
|
||||||
|
set => Settings.VLESS_gRPC_Port = value;
|
||||||
|
}
|
||||||
|
public bool Checked_VLESS_gRPC
|
||||||
|
{
|
||||||
|
get => Settings.Types.Contains(RayType.VLESS_gRPC);
|
||||||
|
set
|
||||||
|
{
|
||||||
|
CheckBoxChanged(value, RayType.VLESS_gRPC);
|
||||||
|
RaisePropertyChanged("Checked_VLESS_gRPC");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string VLESS_gRPC_ShareLink
|
||||||
|
{
|
||||||
|
get => ShareLink.Build(RayType.VLESS_gRPC, Settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
88
ProxySuper.Core/ViewModels/V2rayInstallViewModel.cs
Normal file
88
ProxySuper.Core/ViewModels/V2rayInstallViewModel.cs
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
using MvvmCross.Commands;
|
||||||
|
using MvvmCross.ViewModels;
|
||||||
|
using ProxySuper.Core.Models;
|
||||||
|
using ProxySuper.Core.Models.Hosts;
|
||||||
|
using ProxySuper.Core.Models.Projects;
|
||||||
|
using ProxySuper.Core.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProxySuper.Core.ViewModels
|
||||||
|
{
|
||||||
|
public class V2rayInstallViewModel : MvxViewModel<Record>
|
||||||
|
{
|
||||||
|
Host _host;
|
||||||
|
|
||||||
|
V2raySettings _settings;
|
||||||
|
|
||||||
|
V2rayService _service;
|
||||||
|
|
||||||
|
public override void ViewDestroy(bool viewFinishing = true)
|
||||||
|
{
|
||||||
|
_service.Disconnect();
|
||||||
|
this.SaveInstallLog();
|
||||||
|
base.ViewDestroy(viewFinishing);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Prepare(Record parameter)
|
||||||
|
{
|
||||||
|
this._host = parameter.Host;
|
||||||
|
this._settings = parameter.V2raySettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task Initialize()
|
||||||
|
{
|
||||||
|
_service = new V2rayService(_host, _settings);
|
||||||
|
_service.Progress.StepUpdate = () => RaisePropertyChanged("Progress");
|
||||||
|
_service.Progress.LogsUpdate = () => RaisePropertyChanged("Logs");
|
||||||
|
_service.Connect();
|
||||||
|
|
||||||
|
return base.Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectProgress Progress
|
||||||
|
{
|
||||||
|
get => _service.Progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Logs
|
||||||
|
{
|
||||||
|
get => _service.Progress.Logs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region Command
|
||||||
|
|
||||||
|
public IMvxCommand InstallCommand => new MvxCommand(_service.Install);
|
||||||
|
|
||||||
|
public IMvxCommand UpdateSettingsCommand => new MvxCommand(_service.UpdateSettings);
|
||||||
|
|
||||||
|
public IMvxCommand UpdateV2rayCoreCommand => new MvxCommand(_service.UpdateV2rayCore);
|
||||||
|
|
||||||
|
public IMvxCommand UninstallCommand => new MvxCommand(_service.Uninstall);
|
||||||
|
|
||||||
|
public IMvxCommand UploadCertCommand => new MvxCommand(_service.UploadCert);
|
||||||
|
|
||||||
|
public IMvxCommand UploadWebCommand => new MvxCommand(_service.UploadWeb);
|
||||||
|
|
||||||
|
public IMvxCommand ApplyForCertCommand => new MvxCommand(_service.ApplyForCert);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private void SaveInstallLog()
|
||||||
|
{
|
||||||
|
if (!Directory.Exists("Logs"))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory("Logs");
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileName = Path.Combine("Logs", DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".xary.txt");
|
||||||
|
File.WriteAllText(fileName, Logs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,7 +17,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.VLESS_TCP_XTLS);
|
return Settings.Types.Contains(RayType.VLESS_TCP_XTLS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.VLESS_TCP);
|
return Settings.Types.Contains(RayType.VLESS_TCP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.VLESS_WS);
|
return Settings.Types.Contains(RayType.VLESS_WS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.VLESS_KCP);
|
return Settings.Types.Contains(RayType.VLESS_KCP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.VLESS_gRPC);
|
return Settings.Types.Contains(RayType.VLESS_gRPC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.VMESS_TCP);
|
return Settings.Types.Contains(RayType.VMESS_TCP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.VMESS_WS);
|
return Settings.Types.Contains(RayType.VMESS_WS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.VMESS_KCP);
|
return Settings.Types.Contains(RayType.VMESS_KCP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.Trojan_TCP);
|
return Settings.Types.Contains(RayType.Trojan_TCP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.ShadowsocksAEAD);
|
return Settings.Types.Contains(RayType.ShadowsocksAEAD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,25 +170,25 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.Trojan_TCP);
|
return Settings.Types.Contains(RayType.Trojan_TCP);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == true)
|
if (value == true)
|
||||||
{
|
{
|
||||||
if (!Settings.Types.Contains(XrayType.Trojan_TCP))
|
if (!Settings.Types.Contains(RayType.Trojan_TCP))
|
||||||
Settings.Types.Add(XrayType.Trojan_TCP);
|
Settings.Types.Add(RayType.Trojan_TCP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Settings.Types.Remove(XrayType.Trojan_TCP);
|
Settings.Types.Remove(RayType.Trojan_TCP);
|
||||||
}
|
}
|
||||||
RaisePropertyChanged("Checked_Trojan_TCP");
|
RaisePropertyChanged("Checked_Trojan_TCP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string Trojan_TCP_ShareLink
|
public string Trojan_TCP_ShareLink
|
||||||
{
|
{
|
||||||
get => ShareLink.Build(XrayType.Trojan_TCP, Settings);
|
get => ShareLink.Build(RayType.Trojan_TCP, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<string> _ssMethods = new List<string> { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305" };
|
private List<string> _ssMethods = new List<string> { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305" };
|
||||||
@ -196,10 +196,10 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
public bool CheckedShadowSocks
|
public bool CheckedShadowSocks
|
||||||
{
|
{
|
||||||
|
|
||||||
get => Settings.Types.Contains(XrayType.ShadowsocksAEAD);
|
get => Settings.Types.Contains(RayType.ShadowsocksAEAD);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CheckBoxChanged(value, XrayType.ShadowsocksAEAD);
|
CheckBoxChanged(value, RayType.ShadowsocksAEAD);
|
||||||
RaisePropertyChanged("CheckedShadowSocks");
|
RaisePropertyChanged("CheckedShadowSocks");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,11 +222,11 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
}
|
}
|
||||||
public string ShadowSocksShareLink
|
public string ShadowSocksShareLink
|
||||||
{
|
{
|
||||||
get => ShareLink.Build(XrayType.ShadowsocksAEAD, Settings);
|
get => ShareLink.Build(RayType.ShadowsocksAEAD, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CheckBoxChanged(bool value, XrayType type)
|
private void CheckBoxChanged(bool value, RayType type)
|
||||||
{
|
{
|
||||||
if (value == true)
|
if (value == true)
|
||||||
{
|
{
|
||||||
@ -259,10 +259,10 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
// vmess tcp
|
// vmess tcp
|
||||||
public bool Checked_VMESS_TCP
|
public bool Checked_VMESS_TCP
|
||||||
{
|
{
|
||||||
get => Settings.Types.Contains(XrayType.VMESS_TCP);
|
get => Settings.Types.Contains(RayType.VMESS_TCP);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CheckBoxChanged(value, XrayType.VMESS_TCP);
|
CheckBoxChanged(value, RayType.VMESS_TCP);
|
||||||
RaisePropertyChanged("Checked_VMESS_TCP");
|
RaisePropertyChanged("Checked_VMESS_TCP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -273,16 +273,16 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
}
|
}
|
||||||
public string VMESS_TCP_ShareLink
|
public string VMESS_TCP_ShareLink
|
||||||
{
|
{
|
||||||
get => ShareLink.Build(XrayType.VMESS_TCP, Settings);
|
get => ShareLink.Build(RayType.VMESS_TCP, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vmess ws
|
// vmess ws
|
||||||
public bool Checked_VMESS_WS
|
public bool Checked_VMESS_WS
|
||||||
{
|
{
|
||||||
get => Settings.Types.Contains(XrayType.VMESS_WS);
|
get => Settings.Types.Contains(RayType.VMESS_WS);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CheckBoxChanged(value, XrayType.VMESS_WS);
|
CheckBoxChanged(value, RayType.VMESS_WS);
|
||||||
RaisePropertyChanged("Checked_VMESS_WS");
|
RaisePropertyChanged("Checked_VMESS_WS");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
}
|
}
|
||||||
public string VMESS_WS_ShareLink
|
public string VMESS_WS_ShareLink
|
||||||
{
|
{
|
||||||
get => ShareLink.Build(XrayType.VMESS_WS, Settings);
|
get => ShareLink.Build(RayType.VMESS_WS, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vmess kcp
|
// vmess kcp
|
||||||
@ -316,16 +316,16 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
}
|
}
|
||||||
public bool Checked_VMESS_KCP
|
public bool Checked_VMESS_KCP
|
||||||
{
|
{
|
||||||
get => Settings.Types.Contains(XrayType.VMESS_KCP);
|
get => Settings.Types.Contains(RayType.VMESS_KCP);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CheckBoxChanged(value, XrayType.VMESS_KCP);
|
CheckBoxChanged(value, RayType.VMESS_KCP);
|
||||||
RaisePropertyChanged("Checked_VMESS_KCP");
|
RaisePropertyChanged("Checked_VMESS_KCP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string VMESS_KCP_ShareLink
|
public string VMESS_KCP_ShareLink
|
||||||
{
|
{
|
||||||
get => ShareLink.Build(XrayType.VMESS_KCP, Settings);
|
get => ShareLink.Build(RayType.VMESS_KCP, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -342,31 +342,31 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
// vless xtls
|
// vless xtls
|
||||||
public bool Checked_VLESS_TCP_XTLS
|
public bool Checked_VLESS_TCP_XTLS
|
||||||
{
|
{
|
||||||
get => Settings.Types.Contains(XrayType.VLESS_TCP_XTLS);
|
get => Settings.Types.Contains(RayType.VLESS_TCP_XTLS);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CheckBoxChanged(value, XrayType.VLESS_TCP_XTLS);
|
CheckBoxChanged(value, RayType.VLESS_TCP_XTLS);
|
||||||
RaisePropertyChanged("Checked_VLESS_TCP_XTLS");
|
RaisePropertyChanged("Checked_VLESS_TCP_XTLS");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string VLESS_TCP_XTLS_ShareLink
|
public string VLESS_TCP_XTLS_ShareLink
|
||||||
{
|
{
|
||||||
get => ShareLink.Build(XrayType.VLESS_TCP_XTLS, Settings);
|
get => ShareLink.Build(RayType.VLESS_TCP_XTLS, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vless tcp
|
// vless tcp
|
||||||
public bool Checked_VLESS_TCP
|
public bool Checked_VLESS_TCP
|
||||||
{
|
{
|
||||||
get => Settings.Types.Contains(XrayType.VLESS_TCP);
|
get => Settings.Types.Contains(RayType.VLESS_TCP);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CheckBoxChanged(value, XrayType.VLESS_TCP);
|
CheckBoxChanged(value, RayType.VLESS_TCP);
|
||||||
RaisePropertyChanged("Checked_VLESS_TCP");
|
RaisePropertyChanged("Checked_VLESS_TCP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string VLESS_TCP_ShareLink
|
public string VLESS_TCP_ShareLink
|
||||||
{
|
{
|
||||||
get => ShareLink.Build(XrayType.VLESS_TCP, Settings);
|
get => ShareLink.Build(RayType.VLESS_TCP, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -380,17 +380,17 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Settings.Types.Contains(XrayType.VLESS_WS);
|
return Settings.Types.Contains(RayType.VLESS_WS);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CheckBoxChanged(value, XrayType.VLESS_WS);
|
CheckBoxChanged(value, RayType.VLESS_WS);
|
||||||
RaisePropertyChanged("Checked_VLESS_WS");
|
RaisePropertyChanged("Checked_VLESS_WS");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string VLESS_WS_ShareLink
|
public string VLESS_WS_ShareLink
|
||||||
{
|
{
|
||||||
get => ShareLink.Build(XrayType.VLESS_WS, Settings);
|
get => ShareLink.Build(RayType.VLESS_WS, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vless kcp
|
// vless kcp
|
||||||
@ -413,16 +413,16 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
}
|
}
|
||||||
public bool Checked_VLESS_KCP
|
public bool Checked_VLESS_KCP
|
||||||
{
|
{
|
||||||
get => Settings.Types.Contains(XrayType.VLESS_KCP);
|
get => Settings.Types.Contains(RayType.VLESS_KCP);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CheckBoxChanged(value, XrayType.VLESS_KCP);
|
CheckBoxChanged(value, RayType.VLESS_KCP);
|
||||||
RaisePropertyChanged("Checked_VLESS_KCP");
|
RaisePropertyChanged("Checked_VLESS_KCP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string VLESS_KCP_ShareLink
|
public string VLESS_KCP_ShareLink
|
||||||
{
|
{
|
||||||
get => ShareLink.Build(XrayType.VLESS_KCP, Settings);
|
get => ShareLink.Build(RayType.VLESS_KCP, Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vless grpc
|
// vless grpc
|
||||||
@ -438,16 +438,16 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
}
|
}
|
||||||
public bool Checked_VLESS_gRPC
|
public bool Checked_VLESS_gRPC
|
||||||
{
|
{
|
||||||
get => Settings.Types.Contains(XrayType.VLESS_gRPC);
|
get => Settings.Types.Contains(RayType.VLESS_gRPC);
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
CheckBoxChanged(value, XrayType.VLESS_gRPC);
|
CheckBoxChanged(value, RayType.VLESS_gRPC);
|
||||||
RaisePropertyChanged("Checked_VLESS_gRPC");
|
RaisePropertyChanged("Checked_VLESS_gRPC");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string VLESS_gRPC_ShareLink
|
public string VLESS_gRPC_ShareLink
|
||||||
{
|
{
|
||||||
get => ShareLink.Build(XrayType.VLESS_gRPC, Settings);
|
get => ShareLink.Build(RayType.VLESS_gRPC, Settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
332
ProxySuper.WPF/Controls/V2raySettingsControl.xaml
Normal file
332
ProxySuper.WPF/Controls/V2raySettingsControl.xaml
Normal file
@ -0,0 +1,332 @@
|
|||||||
|
<UserControl x:Class="ProxySuper.WPF.Controls.V2raySettingsControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:ProxySuper.WPF.Controls"
|
||||||
|
xmlns:convert="clr-namespace:ProxySuper.Core.Converters;assembly=ProxySuper.Core"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<convert:VisibleConverter x:Key="VisibleConverter" />
|
||||||
|
</UserControl.Resources>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<StackPanel Width="220">
|
||||||
|
<!--TCP-->
|
||||||
|
<CheckBox Margin="0,15,0,0"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
IsChecked="{Binding Path=Checked_VLESS_TCP}">
|
||||||
|
<Label Content="{DynamicResource VlessTcpDesc}" FontSize="13" Foreground="LimeGreen" />
|
||||||
|
</CheckBox>
|
||||||
|
|
||||||
|
<!--WebSocket-->
|
||||||
|
<CheckBox Margin="0,15,0,0"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
IsChecked="{Binding Path=Checked_VLESS_WS}">
|
||||||
|
<Label Content="{DynamicResource VlessWsDesc}" FontSize="13" Foreground="LimeGreen" />
|
||||||
|
</CheckBox>
|
||||||
|
|
||||||
|
<!--mKCP-->
|
||||||
|
<CheckBox Margin="0,15,0,0"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
Foreground="LimeGreen"
|
||||||
|
IsChecked="{Binding Path=Checked_VLESS_KCP}">
|
||||||
|
<Label Content="{DynamicResource VlessKcpDesc}" FontSize="13" Foreground="LimeGreen" />
|
||||||
|
</CheckBox>
|
||||||
|
|
||||||
|
<!--gRPC-->
|
||||||
|
<CheckBox Margin="0,15,0,0"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
Foreground="LimeGreen"
|
||||||
|
IsChecked="{Binding Path=Checked_VLESS_gRPC}">
|
||||||
|
<Label Content="VLESS gRPC
基于http2,多路复用。" FontSize="13" Foreground="LimeGreen" />
|
||||||
|
</CheckBox>
|
||||||
|
|
||||||
|
<!--TCP-->
|
||||||
|
<!--<CheckBox Content="VMESS over TCP with TLS
不推荐"
|
||||||
|
Margin="0,15,0,0"
|
||||||
|
FontSize="13"
|
||||||
|
Style="{StaticResource MahApps.Styles.CheckBox}"
|
||||||
|
IsChecked="{Binding Path=Checked_VMESS_TCP}" />-->
|
||||||
|
|
||||||
|
<!--WebSocket-->
|
||||||
|
<CheckBox Margin="0,15,0,0"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
IsChecked="{Binding Path=Checked_VMESS_WS}">
|
||||||
|
<Label Content="{DynamicResource VmessWsDesc}" FontSize="13" Foreground="Blue" />
|
||||||
|
</CheckBox>
|
||||||
|
|
||||||
|
<!--mKCP-->
|
||||||
|
<CheckBox Margin="0,15,0,0"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
IsChecked="{Binding Path=Checked_VMESS_KCP}">
|
||||||
|
<Label Foreground="Blue" FontSize="13" Content="{DynamicResource VmessKcpDesc}" />
|
||||||
|
</CheckBox>
|
||||||
|
|
||||||
|
<!--ss-->
|
||||||
|
<CheckBox Margin="0,15,0,0"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
IsChecked="{Binding Path=CheckedShadowSocks}">
|
||||||
|
<Label Content="{DynamicResource SSDesc}" FontSize="13" Foreground="Fuchsia" />
|
||||||
|
</CheckBox>
|
||||||
|
|
||||||
|
<!--Trojan-->
|
||||||
|
<CheckBox Margin="0,15,0,0"
|
||||||
|
Foreground="CadetBlue"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
IsChecked="{Binding Path=Checked_Trojan_TCP}">
|
||||||
|
<Label Content="{DynamicResource TrojanDesc}" FontSize="13" Foreground="CadetBlue" />
|
||||||
|
</CheckBox>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--************************** 参数 **************************-->
|
||||||
|
|
||||||
|
<StackPanel>
|
||||||
|
|
||||||
|
<!--Domain-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<Label Content="{DynamicResource XrayDomain}" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=Domain}" Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--Mask Domain-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<Label Content="{DynamicResource XrayMarkDomain}" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=MaskDomain}" Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<Label Content="{DynamicResource XrayWithTLS}" Width="120" />
|
||||||
|
<CheckBox IsChecked="{Binding Path=WithTLS}"
|
||||||
|
Content="{DynamicResource XrayWithTLSDesc}"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--UUID-->
|
||||||
|
<StackPanel Margin="30,10,0,0"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<Label Content="{DynamicResource XrayUUID}" Width="120" />
|
||||||
|
|
||||||
|
<TextBox Text="{Binding Path=UUID}"
|
||||||
|
Width="200" />
|
||||||
|
|
||||||
|
<Button Margin="5,0,0,0"
|
||||||
|
Padding="12,3"
|
||||||
|
Command="{Binding Path=RandomUuid}"
|
||||||
|
Content="{DynamicResource Random}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--WebSocket Path-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_VLESS_WS,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource VlessWsPath}" Foreground="LimeGreen" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=VLESS_WS_Path}"
|
||||||
|
Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--seed-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_VLESS_KCP,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource VlessKcpSeed}" Foreground="LimeGreen" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=VLESS_KCP_Seed}" Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--kcp type-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_VLESS_KCP,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}" Orientation="Horizontal">
|
||||||
|
|
||||||
|
<Label Content="{DynamicResource VlessKcpType}" Foreground="LimeGreen" Width="120" />
|
||||||
|
<ComboBox Width="200"
|
||||||
|
ItemsSource="{Binding Path=KcpTypes}"
|
||||||
|
SelectedValue="{Binding VLESS_KCP_Type,Mode=TwoWay}">
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--kcp port-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_VLESS_KCP,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<Label Content="{DynamicResource VlessKcpPort}" Width="120" Foreground="LimeGreen" />
|
||||||
|
<TextBox Text="{Binding Path=VLESS_KCP_Port}" Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--gRPC Port-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_VLESS_gRPC,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource VlessRPCPort}" Width="120" Foreground="LimeGreen" />
|
||||||
|
<TextBox Text="{Binding Path=VLESS_gRPC_Port}" Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_VLESS_gRPC,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource VlessRPCName}" Width="120" Foreground="LimeGreen" />
|
||||||
|
<TextBox Text="{Binding Path=VLESS_gRPC_ServiceName}" Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--Tcp Path
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_VMESS_TCP,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="VMESS WS路径" Foreground="Blue" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=VMESS_TCP_Path}"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Width="200" />
|
||||||
|
</StackPanel>-->
|
||||||
|
|
||||||
|
<!--WebSocket Path-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_VMESS_WS,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource VmessWsPath}" Foreground="Blue" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=VMESS_WS_Path}"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--seed-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_VMESS_KCP,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource VmessKcpSeed}" Foreground="Blue" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=VMESS_KCP_Seed}" Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--kcp type-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_VMESS_KCP,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource VmessKcpType}" Foreground="Blue" Width="120" VerticalAlignment="Bottom"/>
|
||||||
|
<ComboBox Width="200"
|
||||||
|
VerticalAlignment="Bottom"
|
||||||
|
ItemsSource="{Binding Path=KcpTypes}"
|
||||||
|
SelectedValue="{Binding VMESS_KCP_Type,Mode=TwoWay}">
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--kcp port-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_VMESS_KCP,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource VmessKcpPort}" Foreground="Blue" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=VMESS_KCP_Port}" Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--ss密码-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=CheckedShadowSocks,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource SSPassword}" Foreground="Fuchsia" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=ShadowSocksPassword}"
|
||||||
|
Width="200"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--ss加密方式-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=CheckedShadowSocks,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource SSMethods}" Foreground="Fuchsia" Width="120" />
|
||||||
|
<ComboBox Width="200"
|
||||||
|
ItemsSource="{Binding ShadowSocksMethods}"
|
||||||
|
SelectedValue="{Binding ShadowSocksMethod}">
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--ss端口-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=CheckedShadowSocks,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource SSPort}" Foreground="Fuchsia" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=ShadowSocksPort}" Width="200"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--Trojan密码-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Visibility="{
|
||||||
|
Binding Path=Checked_Trojan_TCP,
|
||||||
|
Converter={StaticResource VisibleConverter}
|
||||||
|
}">
|
||||||
|
<Label Content="{DynamicResource TrojanPassword}" Foreground="CadetBlue" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=TrojanPassword}"
|
||||||
|
Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--xray prot-->
|
||||||
|
<StackPanel Margin="30,15,0,0"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<Label Content="{DynamicResource XrayPort}" Foreground="Gray" Width="120" />
|
||||||
|
<TextBox Text="{Binding Path=Port}" Width="120" />
|
||||||
|
<Label Content="{DynamicResource XrayPortDefault}" Foreground="Red" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!--多用户-->
|
||||||
|
<StackPanel Margin="30,10,0,0"
|
||||||
|
Orientation="Vertical">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Label Content="{DynamicResource MultiUser}" Width="120" />
|
||||||
|
|
||||||
|
<TextBox Text="{Binding Path=MultiUUID}"
|
||||||
|
Height="60"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
Width="200" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Margin="120,3,0,0" Text="{DynamicResource MultiUserHelp}" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</UserControl>
|
28
ProxySuper.WPF/Controls/V2raySettingsControl.xaml.cs
Normal file
28
ProxySuper.WPF/Controls/V2raySettingsControl.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace ProxySuper.WPF.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// V2raySettingsControl.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class V2raySettingsControl : UserControl
|
||||||
|
{
|
||||||
|
public V2raySettingsControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -87,6 +87,9 @@
|
|||||||
<Compile Include="Controls\Trojan_TCP_Control.xaml.cs">
|
<Compile Include="Controls\Trojan_TCP_Control.xaml.cs">
|
||||||
<DependentUpon>Trojan_TCP_Control.xaml</DependentUpon>
|
<DependentUpon>Trojan_TCP_Control.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Controls\V2raySettingsControl.xaml.cs">
|
||||||
|
<DependentUpon>V2raySettingsControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Controls\VLESS_gRPC_Control.xaml.cs">
|
<Compile Include="Controls\VLESS_gRPC_Control.xaml.cs">
|
||||||
<DependentUpon>VLESS_gRPC_Control.xaml</DependentUpon>
|
<DependentUpon>VLESS_gRPC_Control.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -153,6 +156,15 @@
|
|||||||
<Compile Include="Views\TrojanGo\TrojanGoInstallView.xaml.cs">
|
<Compile Include="Views\TrojanGo\TrojanGoInstallView.xaml.cs">
|
||||||
<DependentUpon>TrojanGoInstallView.xaml</DependentUpon>
|
<DependentUpon>TrojanGoInstallView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\V2ray\V2rayConfigView.xaml.cs">
|
||||||
|
<DependentUpon>V2rayConfigView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\V2ray\V2rayEditorView.xaml.cs">
|
||||||
|
<DependentUpon>V2rayEditorView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Views\V2ray\V2rayInstallView.xaml.cs">
|
||||||
|
<DependentUpon>V2rayInstallView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\Xray\XrayEditorView.xaml.cs">
|
<Compile Include="Views\Xray\XrayEditorView.xaml.cs">
|
||||||
<DependentUpon>XrayEditorView.xaml</DependentUpon>
|
<DependentUpon>XrayEditorView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -178,6 +190,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Controls\V2raySettingsControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Controls\VLESS_gRPC_Control.xaml">
|
<Page Include="Controls\VLESS_gRPC_Control.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@ -290,6 +306,18 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\V2ray\V2rayConfigView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\V2ray\V2rayEditorView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Views\V2ray\V2rayInstallView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\Xray\XrayEditorView.xaml">
|
<Page Include="Views\Xray\XrayEditorView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@ -335,6 +363,114 @@
|
|||||||
<None Include="Templates\trojan-go\trojan-go.json">
|
<None Include="Templates\trojan-go\trojan-go.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="Templates\v2ray\base.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\caddy\base.caddyfile">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\00_log\00_log.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\01_api\01_api.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\02_dns\02_dns.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\03_routing\03_routing.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\04_policy\04_policy.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\05_inbounds\05_inbounds.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\06_outbounds\06_outbounds.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\06_outbounds\VLESS_HTTP2_TLS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\06_outbounds\VLESS_TCP_TLS_WS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\07_transport\07_transport.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\08_stats\08_stats.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\client\09_reverse\09_reverse.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\00_log\00_log.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\01_api\01_api.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\02_dns\02_dns.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\03_routing\03_routing.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\04_policy\04_policy.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\05_inbounds.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\Shadowsocks-AEAD.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\Trojan_TCP.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\Trojan_WS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\VLESS_gRPC.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\VLESS_HTTP2.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\VLESS_KCP.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\VLESS_TCP_TLS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\VLESS_WS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\VMESS_HTTP2.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\VMESS_KCP.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\VMESS_TCP.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\05_inbounds\VMESS_WS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\06_outbounds\06_outbounds.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\07_transport\07_transport.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\08_stats\08_stats.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\v2ray\server\09_reverse\09_reverse.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="Templates\xray\base.json">
|
<None Include="Templates\xray\base.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
12
ProxySuper.WPF/Templates/v2ray/base.json
Normal file
12
ProxySuper.WPF/Templates/v2ray/base.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"log": {},
|
||||||
|
"api": {},
|
||||||
|
"dns": {},
|
||||||
|
"routing": {},
|
||||||
|
"policy": {},
|
||||||
|
"inbounds": [],
|
||||||
|
"outbounds": [],
|
||||||
|
"transport": {},
|
||||||
|
"stats": {},
|
||||||
|
"reverse": {}
|
||||||
|
}
|
9
ProxySuper.WPF/Templates/v2ray/caddy/base.caddyfile
Normal file
9
ProxySuper.WPF/Templates/v2ray/caddy/base.caddyfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
:##port## {
|
||||||
|
root * /usr/share/caddy
|
||||||
|
file_server
|
||||||
|
##reverse_proxy##
|
||||||
|
}
|
||||||
|
|
||||||
|
##domain##:80 {
|
||||||
|
redir https://##domain##{uri}
|
||||||
|
}
|
5
ProxySuper.WPF/Templates/v2ray/client/00_log/00_log.json
Normal file
5
ProxySuper.WPF/Templates/v2ray/client/00_log/00_log.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"log": {
|
||||||
|
"loglevel": "warning"
|
||||||
|
}
|
||||||
|
}
|
3
ProxySuper.WPF/Templates/v2ray/client/01_api/01_api.json
Normal file
3
ProxySuper.WPF/Templates/v2ray/client/01_api/01_api.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"api": null
|
||||||
|
}
|
3
ProxySuper.WPF/Templates/v2ray/client/02_dns/02_dns.json
Normal file
3
ProxySuper.WPF/Templates/v2ray/client/02_dns/02_dns.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"dns": {}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"routing": {}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"policy": {}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"inbounds": [
|
||||||
|
{
|
||||||
|
"protocol": "http",
|
||||||
|
"port": 1081
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"port": 1080,
|
||||||
|
"protocol": "socks",
|
||||||
|
"sniffing": {
|
||||||
|
"enabled": true,
|
||||||
|
"destOverride": [
|
||||||
|
"http",
|
||||||
|
"tls"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"settings": {
|
||||||
|
"udp": true,
|
||||||
|
"auth": "noauth"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"outbounds": []
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"protocol": "vless",
|
||||||
|
"settings": {
|
||||||
|
"vnext": [
|
||||||
|
{
|
||||||
|
"address": "",
|
||||||
|
"port": 443,
|
||||||
|
"users": [
|
||||||
|
{
|
||||||
|
"id": "",
|
||||||
|
"encryption": "none"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "h2",
|
||||||
|
"security": "tls",
|
||||||
|
"httpSettings": {
|
||||||
|
"host": [
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"path": null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"protocol": "vless",
|
||||||
|
"settings": {
|
||||||
|
"vnext": [
|
||||||
|
{
|
||||||
|
"address": "",
|
||||||
|
"port": 443,
|
||||||
|
"users": [
|
||||||
|
{
|
||||||
|
"id": "",
|
||||||
|
"encryption": "none",
|
||||||
|
"level": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "ws",
|
||||||
|
"security": "tls",
|
||||||
|
"tlsSettings": {
|
||||||
|
"serverName": ""
|
||||||
|
},
|
||||||
|
"wsSettings": {
|
||||||
|
"path": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"transport": {}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"stats": null
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"reverse": {}
|
||||||
|
}
|
6
ProxySuper.WPF/Templates/v2ray/server/00_log/00_log.json
Normal file
6
ProxySuper.WPF/Templates/v2ray/server/00_log/00_log.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"log": {
|
||||||
|
"access": "none",
|
||||||
|
"loglevel": "none"
|
||||||
|
}
|
||||||
|
}
|
3
ProxySuper.WPF/Templates/v2ray/server/01_api/01_api.json
Normal file
3
ProxySuper.WPF/Templates/v2ray/server/01_api/01_api.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"api": {}
|
||||||
|
}
|
3
ProxySuper.WPF/Templates/v2ray/server/02_dns/02_dns.json
Normal file
3
ProxySuper.WPF/Templates/v2ray/server/02_dns/02_dns.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"dns": {}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"routing": {
|
||||||
|
"domainStrategy": "AsIs",
|
||||||
|
"rules": [
|
||||||
|
{
|
||||||
|
"type": "field",
|
||||||
|
"ip": [
|
||||||
|
"geoip:private"
|
||||||
|
],
|
||||||
|
"outboundTag": "block"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"policy": {}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"inbounds": []
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"port": 12345,
|
||||||
|
"protocol": "shadowsocks",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"password": "",
|
||||||
|
"method": "aes-128-gcm"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"network": "tcp,udp"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"port": 1310,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "trojan",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"password": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fallbacks": [
|
||||||
|
{
|
||||||
|
"dest": 8080
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "tcp",
|
||||||
|
"security": "none",
|
||||||
|
"tcpSettings": {
|
||||||
|
"acceptProxyProtocol": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"port": 1320,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "trojan",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"password": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"fallbacks": [
|
||||||
|
{
|
||||||
|
"dest": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "ws",
|
||||||
|
"security": "none",
|
||||||
|
"wsSettings": {
|
||||||
|
"acceptProxyProtocol": true,
|
||||||
|
"path": "/trojanws"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"port": 1234,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "vmess",
|
||||||
|
"settings": {
|
||||||
|
"decryption": "none",
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "h2",
|
||||||
|
"httpSettings": {
|
||||||
|
"path": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"port": 3456,
|
||||||
|
"protocol": "vless",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"decryption": "none"
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "mkcp",
|
||||||
|
"kcpSettings": {
|
||||||
|
"uplinkCapacity": 100,
|
||||||
|
"downlinkCapacity": 100,
|
||||||
|
"congestion": true,
|
||||||
|
"header": {
|
||||||
|
"type": "none"
|
||||||
|
},
|
||||||
|
"seed": null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"port": 443,
|
||||||
|
"protocol": "vless",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": "",
|
||||||
|
"level": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"decryption": "none",
|
||||||
|
"fallbacks": []
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "tcp",
|
||||||
|
"security": "tls",
|
||||||
|
"tlsSettings": {
|
||||||
|
"alpn": [
|
||||||
|
"h2",
|
||||||
|
"http/1.1"
|
||||||
|
],
|
||||||
|
"certificates": [
|
||||||
|
{
|
||||||
|
"certificateFile": "/usr/local/etc/v2ray/ssl/xray_ssl.crt",
|
||||||
|
"keyFile": "/usr/local/etc/v2ray/ssl/xray_ssl.key"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"port": 1234,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "vless",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"decryption": "none"
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "ws",
|
||||||
|
"security": "none",
|
||||||
|
"wsSettings": {
|
||||||
|
"acceptProxyProtocol": true,
|
||||||
|
"path": "/websocket"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"port": 2002,
|
||||||
|
"listen": "0.0.0.0",
|
||||||
|
"protocol": "vless",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"decryption": "none"
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "gun",
|
||||||
|
"security": "tls",
|
||||||
|
"tlsSettings": {
|
||||||
|
"serverName": "domain",
|
||||||
|
"alpn": [
|
||||||
|
"h2"
|
||||||
|
],
|
||||||
|
"certificates": [
|
||||||
|
{
|
||||||
|
"certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
|
||||||
|
"keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"grpcSettings": {
|
||||||
|
"serviceName": "service_name"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"port": 1234,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "vmess",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "h2",
|
||||||
|
"httpSettings": {
|
||||||
|
"path": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"port": 3456,
|
||||||
|
"protocol": "vmess",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "mkcp",
|
||||||
|
"kcpSettings": {
|
||||||
|
"uplinkCapacity": 100,
|
||||||
|
"downlinkCapacity": 100,
|
||||||
|
"congestion": true,
|
||||||
|
"header": {
|
||||||
|
"type": "none"
|
||||||
|
},
|
||||||
|
"seed": null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"port": 443,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "vmess",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "tcp",
|
||||||
|
"security": "none",
|
||||||
|
"tcpSettings": {
|
||||||
|
"acceptProxyProtocol": true,
|
||||||
|
"header": {
|
||||||
|
"type": "http",
|
||||||
|
"request": {
|
||||||
|
"path": [
|
||||||
|
"/vmesstcp"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"port": 3456,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "vmess",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "ws",
|
||||||
|
"security": "none",
|
||||||
|
"wsSettings": {
|
||||||
|
"acceptProxyProtocol": true,
|
||||||
|
"path": "/vmessws"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"protocol": "freedom",
|
||||||
|
"tag": "direct"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"protocol": "blackhole",
|
||||||
|
"tag": "block"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"transport": {}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"stats": {}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"reverse": {}
|
||||||
|
}
|
@ -16,6 +16,7 @@
|
|||||||
<Menu Background="White" Grid.Row="0" BorderThickness="0,0,0,2" BorderBrush="#eee">
|
<Menu Background="White" Grid.Row="0" BorderThickness="0,0,0,2" BorderBrush="#eee">
|
||||||
<MenuItem Header="{DynamicResource MainMenuAddHost}" Padding="10,3">
|
<MenuItem Header="{DynamicResource MainMenuAddHost}" Padding="10,3">
|
||||||
<MenuItem Padding="0,5" Header="Xray" Command="{Binding AddXrayCommand}"></MenuItem>
|
<MenuItem Padding="0,5" Header="Xray" Command="{Binding AddXrayCommand}"></MenuItem>
|
||||||
|
<MenuItem Padding="0,5" Header="V2ray" Command="{Binding AddV2rayCommand}"></MenuItem>
|
||||||
<MenuItem Padding="0,5" Header="Trojan-Go" Command="{Binding AddTrojanGoCommand}"></MenuItem>
|
<MenuItem Padding="0,5" Header="Trojan-Go" Command="{Binding AddTrojanGoCommand}"></MenuItem>
|
||||||
<MenuItem Padding="0,5" Header="NaiveProxy" Command="{Binding AddNaiveProxyCommand}"></MenuItem>
|
<MenuItem Padding="0,5" Header="NaiveProxy" Command="{Binding AddNaiveProxyCommand}"></MenuItem>
|
||||||
<MenuItem Padding="0,5" Header="Brook" Command="{Binding AddBrookCommand}"></MenuItem>
|
<MenuItem Padding="0,5" Header="Brook" Command="{Binding AddBrookCommand}"></MenuItem>
|
||||||
|
96
ProxySuper.WPF/Views/V2ray/V2rayConfigView.xaml
Normal file
96
ProxySuper.WPF/Views/V2ray/V2rayConfigView.xaml
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<views:MvxWindow x:Class="ProxySuper.WPF.Views.V2ray.V2rayConfigView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:ProxySuper.WPF.Views.V2ray"
|
||||||
|
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
|
||||||
|
xmlns:ctrl="clr-namespace:ProxySuper.WPF.Controls"
|
||||||
|
xmlns:models="clr-namespace:ProxySuper.Core.Models.Projects;assembly=ProxySuper.Core"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Title="V2ray节点配置" Height="600" Width="1000">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="220" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TabControl Grid.Column="0"
|
||||||
|
Padding="10"
|
||||||
|
BorderThickness="1,0,1,0"
|
||||||
|
BorderBrush="#DDD"
|
||||||
|
TabStripPlacement="Left"
|
||||||
|
SelectionChanged="BuildQrCode">
|
||||||
|
<TabItem Width="200" Height="40"
|
||||||
|
Tag="{x:Static models:RayType.VLESS_TCP}"
|
||||||
|
IsEnabled="{Binding Checked_VLESS_TCP}"
|
||||||
|
Header="VLESS-TCP-TLS">
|
||||||
|
<ctrl:VLESS_TCP_TLS_Control />
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
<TabItem Width="200" Height="40"
|
||||||
|
Tag="{x:Static models:RayType.VLESS_WS}"
|
||||||
|
IsEnabled="{Binding Checked_VLESS_WS}"
|
||||||
|
Header="VLESS-WebSocket-TLS">
|
||||||
|
<ctrl:VLESS_WS_TLS_Control />
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
<TabItem Width="200" Height="40"
|
||||||
|
Tag="{x:Static models:RayType.VLESS_KCP}"
|
||||||
|
IsEnabled="{Binding Checked_VLESS_KCP}"
|
||||||
|
Header="VLESS-mKCP">
|
||||||
|
<ctrl:VLESS_KCP_Control />
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
<TabItem Width="200" Height="40"
|
||||||
|
Tag="{x:Static models:RayType.VLESS_gRPC}"
|
||||||
|
IsEnabled="{Binding Checked_VLESS_gRPC}"
|
||||||
|
Header="VLESS-gRPC">
|
||||||
|
<ctrl:VLESS_gRPC_Control />
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
<!--<TabItem Width="200" Height="40"
|
||||||
|
Tag="{x:Static models:XrayType.VMESS_TCP}"
|
||||||
|
IsEnabled="{Binding Checked_VMESS_TCP}"
|
||||||
|
Header="VMESS-TCP-TLS">
|
||||||
|
<ctrl:VMESS_TCP_TLS_Control />
|
||||||
|
</TabItem>-->
|
||||||
|
|
||||||
|
<TabItem Width="200" Height="40"
|
||||||
|
Tag="{x:Static models:RayType.VMESS_WS}"
|
||||||
|
IsEnabled="{Binding Checked_VMESS_WS}"
|
||||||
|
Header="VMESS-WebSocket-TLS">
|
||||||
|
<ctrl:VMESS_WS_TLS_Control />
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
<TabItem Width="200" Height="40"
|
||||||
|
Tag="{x:Static models:RayType.VMESS_KCP}"
|
||||||
|
IsEnabled="{Binding Checked_VMESS_KCP}"
|
||||||
|
Header="VMESS-mKCP">
|
||||||
|
<ctrl:VMESS_KCP_Control />
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
<TabItem Width="200" Height="40"
|
||||||
|
Tag="{x:Static models:RayType.Trojan_TCP}"
|
||||||
|
IsEnabled="{Binding Checked_Trojan_TCP}"
|
||||||
|
Header="Trojan-TCP">
|
||||||
|
<ctrl:Trojan_TCP_Control />
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
<TabItem Width="200" Height="40"
|
||||||
|
Tag="{x:Static models:RayType.ShadowsocksAEAD}"
|
||||||
|
IsEnabled="{Binding CheckedShadowSocks}"
|
||||||
|
Header="ShadowSocks">
|
||||||
|
<ctrl:ShadowSocksControl />
|
||||||
|
</TabItem>
|
||||||
|
|
||||||
|
</TabControl>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="1" >
|
||||||
|
<Image Width="200" Height="200" x:Name="QrImage" />
|
||||||
|
<Button Click="SaveImage" Width="100" Content="{DynamicResource SaveAs}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</views:MvxWindow>
|
128
ProxySuper.WPF/Views/V2ray/V2rayConfigView.xaml.cs
Normal file
128
ProxySuper.WPF/Views/V2ray/V2rayConfigView.xaml.cs
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
using Microsoft.Win32;
|
||||||
|
using MvvmCross.Platforms.Wpf.Views;
|
||||||
|
using ProxySuper.Core.Models.Projects;
|
||||||
|
using ProxySuper.Core.ViewModels;
|
||||||
|
using QRCoder;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace ProxySuper.WPF.Views.V2ray
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// V2rayConfigView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class V2rayConfigView : MvxWindow
|
||||||
|
{
|
||||||
|
public V2rayConfigView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public V2raySettings Settings
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ((V2rayConfigViewModel)ViewModel).Settings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void BuildQrCode(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var tabControl = e.Source as TabControl;
|
||||||
|
var item = (tabControl.SelectedItem as TabItem);
|
||||||
|
if (item == null) return;
|
||||||
|
var type = (RayType)item.Tag;
|
||||||
|
BuildQrCode(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SaveImage(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SaveFileDialog sfd = new SaveFileDialog();
|
||||||
|
sfd.FileName += QrImage.Tag;
|
||||||
|
sfd.Filter = "Image Files (*.bmp, *.png, *.jpg)|*.bmp;*.png;*.jpg | All Files | *.*";
|
||||||
|
sfd.RestoreDirectory = true;//保存对话框是否记忆上次打开的目录
|
||||||
|
if (sfd.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
var encoder = new PngBitmapEncoder();
|
||||||
|
encoder.Frames.Add(BitmapFrame.Create((BitmapSource)QrImage.Source));
|
||||||
|
using (FileStream stream = new FileStream(sfd.FileName, FileMode.Create))
|
||||||
|
encoder.Save(stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BuildQrCode(RayType type)
|
||||||
|
{
|
||||||
|
string shareLink = string.Empty;
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case RayType.VLESS_TCP:
|
||||||
|
shareLink = Settings.VLESS_TCP_ShareLink;
|
||||||
|
break;
|
||||||
|
case RayType.VLESS_WS:
|
||||||
|
shareLink = Settings.VLESS_WS_ShareLink;
|
||||||
|
break;
|
||||||
|
case RayType.VLESS_H2:
|
||||||
|
break;
|
||||||
|
case RayType.VLESS_KCP:
|
||||||
|
shareLink = Settings.VLESS_KCP_ShareLink;
|
||||||
|
break;
|
||||||
|
case RayType.VLESS_gRPC:
|
||||||
|
shareLink = Settings.VLESS_gRPC_ShareLink;
|
||||||
|
break;
|
||||||
|
case RayType.VMESS_TCP:
|
||||||
|
shareLink = Settings.VMESS_TCP_ShareLink;
|
||||||
|
break;
|
||||||
|
case RayType.VMESS_WS:
|
||||||
|
shareLink = Settings.VMESS_WS_ShareLink;
|
||||||
|
break;
|
||||||
|
case RayType.VMESS_H2:
|
||||||
|
break;
|
||||||
|
case RayType.VMESS_KCP:
|
||||||
|
shareLink = Settings.VMESS_KCP_ShareLink;
|
||||||
|
break;
|
||||||
|
case RayType.Trojan_TCP:
|
||||||
|
shareLink = Settings.Trojan_TCP_ShareLink;
|
||||||
|
break;
|
||||||
|
case RayType.Trojan_WS:
|
||||||
|
break;
|
||||||
|
case RayType.ShadowsocksAEAD:
|
||||||
|
shareLink = Settings.ShadowSocksShareLink;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QRCodeGenerator qrGenerator = new QRCodeGenerator();
|
||||||
|
QRCodeData qrCodeData = qrGenerator.CreateQrCode(shareLink, QRCodeGenerator.ECCLevel.Q);
|
||||||
|
QRCode qrCode = new QRCode(qrCodeData);
|
||||||
|
|
||||||
|
Bitmap qrCodeImage = qrCode.GetGraphic(20);
|
||||||
|
MemoryStream ms = new MemoryStream();
|
||||||
|
qrCodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
|
||||||
|
byte[] bytes = ms.GetBuffer();
|
||||||
|
ms.Close();
|
||||||
|
BitmapImage image = new BitmapImage();
|
||||||
|
image.BeginInit();
|
||||||
|
image.StreamSource = new MemoryStream(bytes);
|
||||||
|
image.EndInit();
|
||||||
|
QrImage.Source = image;
|
||||||
|
QrImage.Tag = type.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
65
ProxySuper.WPF/Views/V2ray/V2rayEditorView.xaml
Normal file
65
ProxySuper.WPF/Views/V2ray/V2rayEditorView.xaml
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<views:MvxWindow x:Class="ProxySuper.WPF.Views.V2ray.V2rayEditorView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:ProxySuper.WPF.Views.V2ray"
|
||||||
|
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
|
||||||
|
xmlns:ctrl="clr-namespace:ProxySuper.WPF.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Icon="/Resources/ProxySU.ico"
|
||||||
|
BorderThickness="0,1,0,0"
|
||||||
|
BorderBrush="#EEE"
|
||||||
|
Title="V2ray编辑配置" Height="610" Width="1015">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="310" />
|
||||||
|
<ColumnDefinition Width="1" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="0" Margin="10">
|
||||||
|
<ctrl:HostControl />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="1" Background="#EEE"></StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="2">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="500" />
|
||||||
|
<RowDefinition Height="80" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<ScrollViewer Name="scroll"
|
||||||
|
Padding="10"
|
||||||
|
Height="500"
|
||||||
|
Grid.Row="0"
|
||||||
|
HorizontalScrollBarVisibility="Auto"
|
||||||
|
VerticalScrollBarVisibility="Auto" >
|
||||||
|
<ctrl:V2raySettingsControl />
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
<Border Grid.Row="1"
|
||||||
|
BorderBrush="#eee"
|
||||||
|
BorderThickness="0,1,0,0">
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button Content="{DynamicResource Save}"
|
||||||
|
Command="{Binding SaveCommand}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Padding="10,5" />
|
||||||
|
|
||||||
|
<Button Content="{DynamicResource SaveAndInstall}"
|
||||||
|
Command="{Binding SaveAndInstallCommand}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Padding="10,5"
|
||||||
|
Margin="20,0,40,0" />
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</views:MvxWindow>
|
28
ProxySuper.WPF/Views/V2ray/V2rayEditorView.xaml.cs
Normal file
28
ProxySuper.WPF/Views/V2ray/V2rayEditorView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using MvvmCross.Platforms.Wpf.Views;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace ProxySuper.WPF.Views.V2ray
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// V2rayEditorView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class V2rayEditorView : MvxWindow
|
||||||
|
{
|
||||||
|
public V2rayEditorView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
69
ProxySuper.WPF/Views/V2ray/V2rayInstallView.xaml
Normal file
69
ProxySuper.WPF/Views/V2ray/V2rayInstallView.xaml
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<views:MvxWindow x:Class="ProxySuper.WPF.Views.V2ray.V2rayInstallView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:ProxySuper.WPF.Views.V2ray"
|
||||||
|
xmlns:ctrl="clr-namespace:ProxySuper.WPF.Controls"
|
||||||
|
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Title="V2ray安装" Height="600" Width="1000">
|
||||||
|
<StackPanel>
|
||||||
|
<ctrl:ProgressControl />
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="20,0,0,0">
|
||||||
|
<Label Content="{DynamicResource Install}" FontWeight="Bold" FontSize="14" />
|
||||||
|
|
||||||
|
<Button Content="{DynamicResource XrayInstallerInstall}"
|
||||||
|
Command="{Binding Path=InstallCommand}"
|
||||||
|
Padding="10,3"
|
||||||
|
Margin="10,0,0,0" />
|
||||||
|
|
||||||
|
<Button Content="{DynamicResource XrayInstallerUpdateSettings}"
|
||||||
|
Command="{Binding Path=UpdateSettingsCommand}"
|
||||||
|
Padding="10,3"
|
||||||
|
Margin="10,0,0,0" />
|
||||||
|
|
||||||
|
<Button Content="{DynamicResource XrayInstallerUpdateCore}"
|
||||||
|
Command="{Binding Path=UpdateV2rayCoreCommand}"
|
||||||
|
Padding="10,3"
|
||||||
|
Margin="10,0,0,0" />
|
||||||
|
|
||||||
|
<Button Content="{DynamicResource XrayInstallerUninstall}"
|
||||||
|
Command="{Binding Path=UninstallCommand}"
|
||||||
|
Padding="10,3"
|
||||||
|
Margin="10,0,0,0" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="20,15,0,0">
|
||||||
|
<Label Content="{DynamicResource Settings}" FontWeight="Bold" FontSize="14" />
|
||||||
|
|
||||||
|
<Button Content="{DynamicResource XrayInstallerUploadCert}"
|
||||||
|
Command="{Binding Path=UploadCertCommand}"
|
||||||
|
Padding="10,3"
|
||||||
|
Margin="10,0,0,0" />
|
||||||
|
|
||||||
|
<Button Content="{DynamicResource XrayInstallerInstallCert}"
|
||||||
|
Command="{Binding Path=ApplyForCertCommand}"
|
||||||
|
Padding="10,3"
|
||||||
|
Margin="10,0,0,0" />
|
||||||
|
|
||||||
|
<Button Content="{DynamicResource XrayInstallerUploadWeb}"
|
||||||
|
Command="{Binding Path=UploadWebCommand}"
|
||||||
|
Padding="10,3"
|
||||||
|
Margin="10,0,0,0" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<StackPanel Margin="20,10,0,0" Orientation="Horizontal">
|
||||||
|
<Label Content="说明" FontWeight="Bold" FontSize="14" VerticalAlignment="Top" />
|
||||||
|
<StackPanel Margin="10,0,0,0">
|
||||||
|
<Label Content="1.【更新配置】 修改V2ray参数后,只需使用此功能即可,不需要重新安装。" FontSize="14" />
|
||||||
|
<Label Content="2.【更新内核】 官方V2ray修补漏洞或新功能,可用此更新V2ray内核。" FontSize="14" />
|
||||||
|
<Label Content="3.【上传自有证书】 将 (.crt和.key) 文件打包成.zip,文件名称随意,后缀名不能变。" FontSize="14" />
|
||||||
|
<Label Content="4.【手动续签证书】 ProxySU会在证书到期时间,自动续期,此功能可手动提前续期。" FontSize="14" />
|
||||||
|
<Label Content="5.【上传伪装网站】 将根目录包含 (index.html) 的文件夹,打包为.zip文件。" FontSize="14" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</views:MvxWindow>
|
28
ProxySuper.WPF/Views/V2ray/V2rayInstallView.xaml.cs
Normal file
28
ProxySuper.WPF/Views/V2ray/V2rayInstallView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using MvvmCross.Platforms.Wpf.Views;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace ProxySuper.WPF.Views.V2ray
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// V2rayInstallView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class V2rayInstallView : MvxWindow
|
||||||
|
{
|
||||||
|
public V2rayInstallView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,7 +9,7 @@
|
|||||||
xmlns:models="clr-namespace:ProxySuper.Core.Models.Projects;assembly=ProxySuper.Core"
|
xmlns:models="clr-namespace:ProxySuper.Core.Models.Projects;assembly=ProxySuper.Core"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Title="XrayInfoView" Height="600" Width="1000">
|
Title="Xray节点配置" Height="600" Width="1000">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@ -24,35 +24,35 @@
|
|||||||
TabStripPlacement="Left"
|
TabStripPlacement="Left"
|
||||||
SelectionChanged="BuildQrCode">
|
SelectionChanged="BuildQrCode">
|
||||||
<TabItem Width="200" Height="40"
|
<TabItem Width="200" Height="40"
|
||||||
Tag="{x:Static models:XrayType.VLESS_TCP_XTLS}"
|
Tag="{x:Static models:RayType.VLESS_TCP_XTLS}"
|
||||||
IsEnabled="{Binding Checked_VLESS_TCP_XTLS}"
|
IsEnabled="{Binding Checked_VLESS_TCP_XTLS}"
|
||||||
Header="VLESS-TCP-XTLS">
|
Header="VLESS-TCP-XTLS">
|
||||||
<ctrl:VLESS_XTLS_Control />
|
<ctrl:VLESS_XTLS_Control />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Width="200" Height="40"
|
<TabItem Width="200" Height="40"
|
||||||
Tag="{x:Static models:XrayType.VLESS_TCP}"
|
Tag="{x:Static models:RayType.VLESS_TCP}"
|
||||||
IsEnabled="{Binding Checked_VLESS_TCP}"
|
IsEnabled="{Binding Checked_VLESS_TCP}"
|
||||||
Header="VLESS-TCP-TLS">
|
Header="VLESS-TCP-TLS">
|
||||||
<ctrl:VLESS_TCP_TLS_Control />
|
<ctrl:VLESS_TCP_TLS_Control />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Width="200" Height="40"
|
<TabItem Width="200" Height="40"
|
||||||
Tag="{x:Static models:XrayType.VLESS_WS}"
|
Tag="{x:Static models:RayType.VLESS_WS}"
|
||||||
IsEnabled="{Binding Checked_VLESS_WS}"
|
IsEnabled="{Binding Checked_VLESS_WS}"
|
||||||
Header="VLESS-WebSocket-TLS">
|
Header="VLESS-WebSocket-TLS">
|
||||||
<ctrl:VLESS_WS_TLS_Control />
|
<ctrl:VLESS_WS_TLS_Control />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Width="200" Height="40"
|
<TabItem Width="200" Height="40"
|
||||||
Tag="{x:Static models:XrayType.VLESS_KCP}"
|
Tag="{x:Static models:RayType.VLESS_KCP}"
|
||||||
IsEnabled="{Binding Checked_VLESS_KCP}"
|
IsEnabled="{Binding Checked_VLESS_KCP}"
|
||||||
Header="VLESS-mKCP">
|
Header="VLESS-mKCP">
|
||||||
<ctrl:VLESS_KCP_Control />
|
<ctrl:VLESS_KCP_Control />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Width="200" Height="40"
|
<TabItem Width="200" Height="40"
|
||||||
Tag="{x:Static models:XrayType.VLESS_gRPC}"
|
Tag="{x:Static models:RayType.VLESS_gRPC}"
|
||||||
IsEnabled="{Binding Checked_VLESS_gRPC}"
|
IsEnabled="{Binding Checked_VLESS_gRPC}"
|
||||||
Header="VLESS-gRPC">
|
Header="VLESS-gRPC">
|
||||||
<ctrl:VLESS_gRPC_Control />
|
<ctrl:VLESS_gRPC_Control />
|
||||||
@ -66,28 +66,28 @@
|
|||||||
</TabItem>-->
|
</TabItem>-->
|
||||||
|
|
||||||
<TabItem Width="200" Height="40"
|
<TabItem Width="200" Height="40"
|
||||||
Tag="{x:Static models:XrayType.VMESS_WS}"
|
Tag="{x:Static models:RayType.VMESS_WS}"
|
||||||
IsEnabled="{Binding Checked_VMESS_WS}"
|
IsEnabled="{Binding Checked_VMESS_WS}"
|
||||||
Header="VMESS-WebSocket-TLS">
|
Header="VMESS-WebSocket-TLS">
|
||||||
<ctrl:VMESS_WS_TLS_Control />
|
<ctrl:VMESS_WS_TLS_Control />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Width="200" Height="40"
|
<TabItem Width="200" Height="40"
|
||||||
Tag="{x:Static models:XrayType.VMESS_KCP}"
|
Tag="{x:Static models:RayType.VMESS_KCP}"
|
||||||
IsEnabled="{Binding Checked_VMESS_KCP}"
|
IsEnabled="{Binding Checked_VMESS_KCP}"
|
||||||
Header="VMESS-mKCP">
|
Header="VMESS-mKCP">
|
||||||
<ctrl:VMESS_KCP_Control />
|
<ctrl:VMESS_KCP_Control />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Width="200" Height="40"
|
<TabItem Width="200" Height="40"
|
||||||
Tag="{x:Static models:XrayType.Trojan_TCP}"
|
Tag="{x:Static models:RayType.Trojan_TCP}"
|
||||||
IsEnabled="{Binding Checked_Trojan_TCP}"
|
IsEnabled="{Binding Checked_Trojan_TCP}"
|
||||||
Header="Trojan-TCP">
|
Header="Trojan-TCP">
|
||||||
<ctrl:Trojan_TCP_Control />
|
<ctrl:Trojan_TCP_Control />
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Width="200" Height="40"
|
<TabItem Width="200" Height="40"
|
||||||
Tag="{x:Static models:XrayType.ShadowsocksAEAD}"
|
Tag="{x:Static models:RayType.ShadowsocksAEAD}"
|
||||||
IsEnabled="{Binding CheckedShadowSocks}"
|
IsEnabled="{Binding CheckedShadowSocks}"
|
||||||
Header="ShadowSocks">
|
Header="ShadowSocks">
|
||||||
<ctrl:ShadowSocksControl />
|
<ctrl:ShadowSocksControl />
|
||||||
|
@ -36,7 +36,7 @@ namespace ProxySuper.WPF.Views
|
|||||||
var tabControl = e.Source as TabControl;
|
var tabControl = e.Source as TabControl;
|
||||||
var item = (tabControl.SelectedItem as TabItem);
|
var item = (tabControl.SelectedItem as TabItem);
|
||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
var type = (XrayType)item.Tag;
|
var type = (RayType)item.Tag;
|
||||||
BuildQrCode(type);
|
BuildQrCode(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,45 +55,45 @@ namespace ProxySuper.WPF.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BuildQrCode(XrayType type)
|
private void BuildQrCode(RayType type)
|
||||||
{
|
{
|
||||||
string shareLink = string.Empty;
|
string shareLink = string.Empty;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case XrayType.VLESS_TCP_XTLS:
|
case RayType.VLESS_TCP_XTLS:
|
||||||
shareLink = Settings.VLESS_TCP_XTLS_ShareLink;
|
shareLink = Settings.VLESS_TCP_XTLS_ShareLink;
|
||||||
break;
|
break;
|
||||||
case XrayType.VLESS_TCP:
|
case RayType.VLESS_TCP:
|
||||||
shareLink = Settings.VLESS_TCP_ShareLink;
|
shareLink = Settings.VLESS_TCP_ShareLink;
|
||||||
break;
|
break;
|
||||||
case XrayType.VLESS_WS:
|
case RayType.VLESS_WS:
|
||||||
shareLink = Settings.VLESS_WS_ShareLink;
|
shareLink = Settings.VLESS_WS_ShareLink;
|
||||||
break;
|
break;
|
||||||
case XrayType.VLESS_H2:
|
case RayType.VLESS_H2:
|
||||||
break;
|
break;
|
||||||
case XrayType.VLESS_KCP:
|
case RayType.VLESS_KCP:
|
||||||
shareLink = Settings.VLESS_KCP_ShareLink;
|
shareLink = Settings.VLESS_KCP_ShareLink;
|
||||||
break;
|
break;
|
||||||
case XrayType.VLESS_gRPC:
|
case RayType.VLESS_gRPC:
|
||||||
shareLink = Settings.VLESS_gRPC_ShareLink;
|
shareLink = Settings.VLESS_gRPC_ShareLink;
|
||||||
break;
|
break;
|
||||||
case XrayType.VMESS_TCP:
|
case RayType.VMESS_TCP:
|
||||||
shareLink = Settings.VMESS_TCP_ShareLink;
|
shareLink = Settings.VMESS_TCP_ShareLink;
|
||||||
break;
|
break;
|
||||||
case XrayType.VMESS_WS:
|
case RayType.VMESS_WS:
|
||||||
shareLink = Settings.VMESS_WS_ShareLink;
|
shareLink = Settings.VMESS_WS_ShareLink;
|
||||||
break;
|
break;
|
||||||
case XrayType.VMESS_H2:
|
case RayType.VMESS_H2:
|
||||||
break;
|
break;
|
||||||
case XrayType.VMESS_KCP:
|
case RayType.VMESS_KCP:
|
||||||
shareLink = Settings.VMESS_KCP_ShareLink;
|
shareLink = Settings.VMESS_KCP_ShareLink;
|
||||||
break;
|
break;
|
||||||
case XrayType.Trojan_TCP:
|
case RayType.Trojan_TCP:
|
||||||
shareLink = Settings.Trojan_TCP_ShareLink;
|
shareLink = Settings.Trojan_TCP_ShareLink;
|
||||||
break;
|
break;
|
||||||
case XrayType.Trojan_WS:
|
case RayType.Trojan_WS:
|
||||||
break;
|
break;
|
||||||
case XrayType.ShadowsocksAEAD:
|
case RayType.ShadowsocksAEAD:
|
||||||
shareLink = Settings.ShadowSocksShareLink;
|
shareLink = Settings.ShadowSocksShareLink;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Icon="/Resources/ProxySU.ico"
|
Icon="/Resources/ProxySU.ico"
|
||||||
BorderThickness="0,1,0,0"
|
BorderThickness="0,1,0,0"
|
||||||
BorderBrush="#EEE"
|
BorderBrush="#EEE"
|
||||||
Title="Xray" Height="610" Width="1015">
|
Title="Xray编辑配置" Height="610" Width="1015">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
|
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Title="XrayInstallView" Height="600" Width="1000">
|
Title="Xray安装" Height="600" Width="1000">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<ctrl:ProgressControl />
|
<ctrl:ProgressControl />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user