XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

LumaTunnel

【WinUI】LumaTunnel 是一个面向个人多设备的 Windows 代理系统。客户端在本机提供 HTTP/HTTPS CONNECT 与 SOCKS5 TCP 代理,并通过一个受信任 TLS 证书保护的 WSS 会话,将多个 TCP 流复用到自建 Windows Server 节点。

公开
关注 0 Fork 0 Star 0
UTF-8
using System.Net;

namespace LumaTunnel.Shared.Models;

public enum ProxyMode
{
    Rule,
    Global,
    Direct
}

public enum RouteAction
{
    Tunnel,
    Direct
}

public enum RuleKind
{
    Domain,
    DomainSuffix,
    IpCidr,
    Port
}

public sealed record RoutingRule
{
    public Guid Id { get; init; } = Guid.NewGuid();
    public bool Enabled { get; init; } = true;
    public int Priority { get; init; }
    public required RuleKind Kind { get; init; }
    public required string Value { get; init; }
    public required RouteAction Action { get; init; }
    public string? Note { get; init; }
}

public sealed record ProxyTarget(string Host, int Port, IPAddress? Address = null)
{
    public override string ToString() => $"{Host}:{Port}";
}

public sealed record ProxyEngineOptions
{
    public IPAddress ListenAddress { get; init; } = IPAddress.Loopback;
    public int HttpPort { get; init; } = 7890;
    public int SocksPort { get; init; } = 7891;
    public ProxyMode Mode { get; init; } = ProxyMode.Rule;
    public TimeSpan ConnectTimeout { get; init; } = TimeSpan.FromSeconds(10);
}