mirror of
https://github.com/netchx/netch.git
synced 2026-05-11 23:45:06 +08:00
Refactor: name, namespace
This commit is contained in:
14
Netch/Interfaces/IAdapter.cs
Normal file
14
Netch/Interfaces/IAdapter.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
|
||||
namespace Netch.Interfaces
|
||||
{
|
||||
public interface IAdapter
|
||||
{
|
||||
ulong InterfaceIndex { get; }
|
||||
|
||||
IPAddress Gateway { get; }
|
||||
|
||||
NetworkInterface NetworkInterface { get; }
|
||||
}
|
||||
}
|
||||
15
Netch/Interfaces/IController.cs
Normal file
15
Netch/Interfaces/IController.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Netch.Interfaces
|
||||
{
|
||||
public interface IController
|
||||
{
|
||||
/// <summary>
|
||||
/// 控制器名
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 停止
|
||||
/// </summary>
|
||||
public void Stop();
|
||||
}
|
||||
}
|
||||
14
Netch/Interfaces/IModeController.cs
Normal file
14
Netch/Interfaces/IModeController.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Netch.Models;
|
||||
|
||||
namespace Netch.Interfaces
|
||||
{
|
||||
public interface IModeController : IController
|
||||
{
|
||||
/// <summary>
|
||||
/// 启动
|
||||
/// </summary>
|
||||
/// <param name="mode">模式</param>
|
||||
/// <returns>是否成功</returns>
|
||||
public abstract void Start(in Mode mode);
|
||||
}
|
||||
}
|
||||
32
Netch/Interfaces/IServerController.cs
Normal file
32
Netch/Interfaces/IServerController.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Netch.Models;
|
||||
|
||||
namespace Netch.Interfaces
|
||||
{
|
||||
public interface IServerController : IController
|
||||
{
|
||||
public ushort? Socks5LocalPort { get; set; }
|
||||
|
||||
public string? LocalAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 启动
|
||||
/// </summary>
|
||||
/// <param name="s">服务器</param>
|
||||
/// <param name="mode">模式</param>
|
||||
/// <returns>是否启动成功</returns>
|
||||
public abstract void Start(in Server s, in Mode mode);
|
||||
}
|
||||
|
||||
public static class ServerControllerExtension
|
||||
{
|
||||
public static ushort Socks5LocalPort(this IServerController controller)
|
||||
{
|
||||
return controller.Socks5LocalPort ?? Global.Settings.Socks5LocalPort;
|
||||
}
|
||||
|
||||
public static string LocalAddress(this IServerController controller)
|
||||
{
|
||||
return controller.LocalAddress ?? Global.Settings.LocalAddress;
|
||||
}
|
||||
}
|
||||
}
|
||||
45
Netch/Interfaces/IServerUtil.cs
Normal file
45
Netch/Interfaces/IServerUtil.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Netch.Models;
|
||||
|
||||
namespace Netch.Interfaces
|
||||
{
|
||||
public interface IServerUtil
|
||||
{
|
||||
/// <summary>
|
||||
/// Collection order basis
|
||||
/// </summary>
|
||||
ushort Priority { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Server.Type
|
||||
/// </summary>
|
||||
string TypeName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Protocol Name
|
||||
/// </summary>
|
||||
string FullName { get; }
|
||||
|
||||
string ShortName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Support URI
|
||||
/// </summary>
|
||||
string[] UriScheme { get; }
|
||||
|
||||
public abstract Type ServerType { get; }
|
||||
|
||||
public void Edit(Server s);
|
||||
|
||||
public void Create();
|
||||
|
||||
string GetShareLink(Server s);
|
||||
|
||||
public abstract IServerController GetController();
|
||||
|
||||
public abstract IEnumerable<Server> ParseUri(string text);
|
||||
|
||||
bool CheckServer(Server s);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user