feat: 目前完成了订阅功能和 Xray-Core 的更新管理.

This commit is contained in:
2025-01-07 09:50:02 +08:00
parent 78c7db692a
commit 99cb0a03a5
22 changed files with 1153 additions and 0 deletions
@@ -0,0 +1,50 @@
using System.Text.Json.Nodes;
namespace Proxd_man.Config.Outbound;
/// <summary>
/// Xray-Core 的 ShadowSocks 出站配置.
///
/// 目前不支持设置多服务器.
/// </summary>
public class ShadowSocksOutboundSetting : BaseOutboundSetting
{
public string? UserEmail { get; init; } = null;
public required string Method { get; init; }
public required string Address { get; init; }
public int Port { get; init; }
public required string Password { get; init; }
public bool EnableUdpOverTcp { get; init; } = false;
public uint? UdpOverTcpVersion { get; init; } = null;
public override string GetTag()
{
return $"ShadowSocks-{GetHashCode()}";
}
protected override JsonObject GetProtocolSetting()
{
var root = new JsonObject();
var setting = new JsonObject();
setting.Add("address", Address);
setting.Add("port", Port);
setting.Add("method", Method);
setting.Add("password", Password);
setting.Add("uot", EnableUdpOverTcp);
if (EnableUdpOverTcp)
{
setting.Add("UoTVersion", UdpOverTcpVersion);
}
if (!string.IsNullOrEmpty(UserEmail))
{
setting.Add("email", UserEmail);
}
root.Add("servers", new JsonArray { setting });
return root;
}
}