mirror of
https://github.com/netchx/netch.git
synced 2026-05-07 22:44:03 +08:00
Refactor: Update Netch.Servers naming
This commit is contained in:
@@ -6,7 +6,6 @@ using Netch.Enums;
|
||||
using Netch.Interfaces;
|
||||
using Netch.Models;
|
||||
using Netch.Servers;
|
||||
using Netch.Servers.Shadowsocks;
|
||||
using Netch.Utils;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
@@ -56,8 +55,8 @@ namespace Netch.Controllers
|
||||
|
||||
switch (server)
|
||||
{
|
||||
case Socks5 socks5 when !socks5.Auth() || socks5.Auth() && ModeFeatures.HasFlag(ModeFeature.SupportSocks5Auth):
|
||||
case Shadowsocks shadowsocks when !shadowsocks.HasPlugin() && ModeFeatures.HasFlag(ModeFeature.SupportShadowsocks) &&
|
||||
case Socks5Server socks5 when !socks5.Auth() || socks5.Auth() && ModeFeatures.HasFlag(ModeFeature.SupportSocks5Auth):
|
||||
case ShadowsocksServer shadowsocks when !shadowsocks.HasPlugin() && ModeFeatures.HasFlag(ModeFeature.SupportShadowsocks) &&
|
||||
Global.Settings.Redirector.RedirectorSS:
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -9,7 +9,6 @@ using Netch.Interfaces;
|
||||
using Netch.Interops;
|
||||
using Netch.Models;
|
||||
using Netch.Servers;
|
||||
using Netch.Servers.Shadowsocks;
|
||||
using Netch.Utils;
|
||||
using Serilog;
|
||||
using static Netch.Interops.Redirector;
|
||||
@@ -115,7 +114,7 @@ namespace Netch.Controllers
|
||||
|
||||
var offset = portType == PortType.UDP ? UdpNameListOffset : 0;
|
||||
|
||||
if (server is Socks5 socks5)
|
||||
if (server is Socks5Server socks5)
|
||||
{
|
||||
Dial(NameList.TYPE_TCPTYPE + offset, "Socks5");
|
||||
Dial(NameList.TYPE_TCPHOST + offset, $"{await socks5.AutoResolveHostnameAsync()}:{socks5.Port}");
|
||||
@@ -123,7 +122,7 @@ namespace Netch.Controllers
|
||||
Dial(NameList.TYPE_TCPPASS + offset, socks5.Password ?? string.Empty);
|
||||
Dial(NameList.TYPE_TCPMETH + offset, string.Empty);
|
||||
}
|
||||
else if (server is Shadowsocks shadowsocks && !shadowsocks.HasPlugin() && _rdrConfig.RedirectorSS)
|
||||
else if (server is ShadowsocksServer shadowsocks && !shadowsocks.HasPlugin() && _rdrConfig.RedirectorSS)
|
||||
{
|
||||
Dial(NameList.TYPE_TCPTYPE + offset, "Shadowsocks");
|
||||
Dial(NameList.TYPE_TCPHOST + offset, $"{await shadowsocks.AutoResolveHostnameAsync()}:{shadowsocks.Port}");
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Netch.Controllers
|
||||
var outboundNetworkInterface = NetworkInterfaceUtils.GetBest();
|
||||
|
||||
var argument = new StringBuilder($@"-i \Device\NPF_{outboundNetworkInterface.Id}");
|
||||
if (_server is Socks5 socks5 && !socks5.Auth())
|
||||
if (_server is Socks5Server socks5 && !socks5.Auth())
|
||||
argument.Append($" --destination {await socks5.AutoResolveHostnameAsync()}:{socks5.Port}");
|
||||
else
|
||||
Trace.Assert(false);
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Netch.Controllers
|
||||
_mode = mode;
|
||||
_tunConfig = Global.Settings.TUNTAP;
|
||||
|
||||
if (server is Socks5Bridge socks5Bridge)
|
||||
if (server is Socks5LocalServer socks5Bridge)
|
||||
_serverRemoteAddress = await DnsUtils.LookupAsync(socks5Bridge.RemoteHostname);
|
||||
|
||||
if (_serverRemoteAddress != null && IPAddress.IsLoopback(_serverRemoteAddress))
|
||||
@@ -56,7 +56,7 @@ namespace Netch.Controllers
|
||||
Dial(NameList.TYPE_UDPREST, "");
|
||||
Dial(NameList.TYPE_UDPTYPE, "Socks5");
|
||||
|
||||
if (server is Socks5 socks5)
|
||||
if (server is Socks5Server socks5)
|
||||
{
|
||||
Dial(NameList.TYPE_TCPHOST, $"{await socks5.AutoResolveHostnameAsync()}:{socks5.Port}");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user