using Netch.Controllers;
using Netch.Forms;
using Netch.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Windows.Forms;
using WindowsJobAPI;
namespace Netch
{
public static class Global
{
///
/// 换行
///
public const string EOF = "\r\n";
public static readonly string NetchDir = Application.StartupPath;
///
/// 主窗体的静态实例
///
public static MainForm MainForm;
public static class Flags
{
public static bool SupportFakeDns => _supportFakeDns ??= new TUNTAPController().TestFakeDNS();
public static readonly bool IsWindows10Upper = Environment.OSVersion.Version.Major >= 10;
private static bool? _supportFakeDns;
}
///
/// 出口适配器
///
public static class Outbound
{
///
/// 索引
///
public static int Index = -1;
///
/// 地址
///
public static IPAddress Address => Adapter.GetIPProperties().UnicastAddresses.First(ip => ip.Address.AddressFamily == AddressFamily.InterNetwork).Address;
///
/// 网关
///
public static IPAddress Gateway;
public static NetworkInterface Adapter;
}
///
/// TUN/TAP 适配器
///
public static class TUNTAP
{
///
/// 适配器
///
public static NetworkInterface Adapter;
///
/// 索引
///
public static int Index = -1;
///
/// 组件 ID
///
public static string ComponentID = string.Empty;
}
///
/// 用于读取和写入的配置
///
public static Setting Settings = new Setting();
///
/// 用于存储模式
///
public static readonly List Modes = new List();
///
/// Windows Job API
///
public static readonly JobObject Job = new JobObject();
}
}