feat: 目前完成了订阅功能和 Xray-Core 的更新管理.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace Proxd_man.Config.TransportLayerSecurity;
|
||||
|
||||
public abstract class BaseTransportLayerSecuritySetting
|
||||
{
|
||||
|
||||
public TransportLayerSecurityType TransportLayerSecurityType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// 将配置写入到 StreamSetting JSON 对象中.
|
||||
/// </summary>
|
||||
/// <param name="streamSettingJson">现有的 StreamSetting JSON 对象.</param>
|
||||
public abstract void ApplyJsonSetting(JsonObject streamSettingJson);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace Proxd_man.Config.TransportLayerSecurity;
|
||||
|
||||
public class NoneSecuritySetting : BaseTransportLayerSecuritySetting
|
||||
{
|
||||
|
||||
public NoneSecuritySetting()
|
||||
{
|
||||
TransportLayerSecurityType = TransportLayerSecurityType.None;
|
||||
}
|
||||
|
||||
public override void ApplyJsonSetting(JsonObject streamSettingJson)
|
||||
{
|
||||
streamSettingJson.Add("security", "none");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace Proxd_man.Config.TransportLayerSecurity;
|
||||
|
||||
public class RealitySecuritySetting : BaseTransportLayerSecuritySetting
|
||||
{
|
||||
|
||||
public string ServerName { get; init; } = "0.0.0.0";
|
||||
public string FingerPrint { get; init; } = "chrome";
|
||||
public required string ShortId { get; init; }
|
||||
public required string PublicKey { get; init; }
|
||||
|
||||
public RealitySecuritySetting()
|
||||
{
|
||||
TransportLayerSecurityType = TransportLayerSecurityType.Reality;
|
||||
}
|
||||
|
||||
public override void ApplyJsonSetting(JsonObject streamSettingJson)
|
||||
{
|
||||
streamSettingJson.Add("security", "reality");
|
||||
|
||||
var realitySetting = new JsonObject();
|
||||
realitySetting.Add("serverName", ServerName);
|
||||
realitySetting.Add("fingerprint", FingerPrint);
|
||||
realitySetting.Add("shortId", ShortId);
|
||||
realitySetting.Add("publicKey", PublicKey);
|
||||
|
||||
streamSettingJson.Add("realitySettings", realitySetting);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace Proxd_man.Config.TransportLayerSecurity;
|
||||
|
||||
public class TlsSecuritySetting : BaseTransportLayerSecuritySetting
|
||||
{
|
||||
|
||||
public string? ServerName { get; init; } = null;
|
||||
public bool IsRejectUnknownSni { get; init; } = false;
|
||||
public List<string> Alpn { get; init; } = ["h2", "http/1.1"];
|
||||
public string MinVersion { get; init; } = "1.2";
|
||||
public string MaxVersion { get; init; } = "1.3";
|
||||
public string? CipherSuites { get; init; } = null;
|
||||
public bool IsAllowInsecure { get; init; } = false;
|
||||
public string FingerPrint { get; init; } = "chrome";
|
||||
|
||||
public TlsSecuritySetting()
|
||||
{
|
||||
TransportLayerSecurityType = TransportLayerSecurityType.Tls;
|
||||
}
|
||||
|
||||
public override void ApplyJsonSetting(JsonObject streamSettingJson)
|
||||
{
|
||||
streamSettingJson.Add("security", "tls");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user