Update code style

This commit is contained in:
ChsBuffer
2021-04-30 17:20:29 +08:00
parent 60f0637b03
commit 5b5262e03e
4 changed files with 45 additions and 44 deletions

View File

@@ -102,7 +102,7 @@ namespace Netch.Controllers
RouteHelper.CreateUnicastIP(AddressFamily.InterNetwork,
Global.Settings.TUNTAP.Address,
(byte) Utils.Utils.SubnetToCidr(Global.Settings.TUNTAP.Netmask),
(byte)Utils.Utils.SubnetToCidr(Global.Settings.TUNTAP.Netmask),
_tunAdapter.InterfaceIndex);
SetupRouteTable(mode);
@@ -248,18 +248,18 @@ namespace Netch.Controllers
return false;
IAdapter adapter = routeType switch
{
RouteType.Outbound => _outboundAdapter,
RouteType.TUNTAP => _tunAdapter,
_ => throw new ArgumentOutOfRangeException(nameof(routeType), routeType, null)
};
{
RouteType.Outbound => _outboundAdapter,
RouteType.TUNTAP => _tunAdapter,
_ => throw new ArgumentOutOfRangeException(nameof(routeType), routeType, null)
};
List<string> ipList = routeType switch
{
RouteType.Outbound => _directIPs,
RouteType.TUNTAP => _proxyIPs,
_ => throw new ArgumentOutOfRangeException(nameof(routeType), routeType, null)
};
{
RouteType.Outbound => _directIPs,
RouteType.TUNTAP => _proxyIPs,
_ => throw new ArgumentOutOfRangeException(nameof(routeType), routeType, null)
};
string gateway = adapter.Gateway.ToString();
var index = adapter.InterfaceIndex;
@@ -270,13 +270,13 @@ namespace Netch.Controllers
switch (action)
{
case Action.Create:
result = RouteHelper.CreateRoute(AddressFamily.InterNetwork, ip, (byte) cidr, gateway, index, metric);
result = RouteHelper.CreateRoute(AddressFamily.InterNetwork, ip, (byte)cidr, gateway, index, metric);
if (record)
ipList.Add(ipNetwork);
break;
case Action.Delete:
result = RouteHelper.DeleteRoute(AddressFamily.InterNetwork, ip, (byte) cidr, gateway, index, metric);
result = RouteHelper.DeleteRoute(AddressFamily.InterNetwork, ip, (byte)cidr, gateway, index, metric);
break;
default:
throw new ArgumentOutOfRangeException(nameof(action), action, null);