mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-28 21:23:04 +00:00
Clean Code
This commit is contained in:
parent
0ac7e87158
commit
36dc824f2f
16 changed files with 244 additions and 348 deletions
|
|
@ -15,7 +15,6 @@ public class Global
|
|||
public const string CoreConfigFileName = "config.json";
|
||||
public const string CorePreConfigFileName = "configPre.json";
|
||||
public const string CoreSpeedtestConfigFileName = "configTest{0}.json";
|
||||
public const string CoreMultipleLoadConfigFileName = "configMultipleLoad.json";
|
||||
public const string ClashMixinConfigFileName = "Mixin.yaml";
|
||||
|
||||
public const string NamespaceSample = "ServiceLib.Sample.";
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ public static class CoreConfigHandler
|
|||
result = node.CoreType switch
|
||||
{
|
||||
ECoreType.mihomo => await new CoreConfigClashService(config).GenerateClientCustomConfig(node, fileName),
|
||||
ECoreType.sing_box => await new CoreConfigSingboxService(context).GenerateClientCustomConfig(fileName),
|
||||
_ => await GenerateClientCustomConfig(node, fileName)
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ namespace ServiceLib.Services.CoreConfig;
|
|||
public partial class CoreConfigSingboxService(CoreConfigContext context)
|
||||
{
|
||||
private static readonly string _tag = "CoreConfigSingboxService";
|
||||
private readonly Config _config = context.AppConfig;
|
||||
private readonly ProfileItem _node = context.Node;
|
||||
|
||||
private SingboxConfig _coreConfig = new();
|
||||
|
||||
|
|
@ -13,16 +15,15 @@ public partial class CoreConfigSingboxService(CoreConfigContext context)
|
|||
var ret = new RetResult();
|
||||
try
|
||||
{
|
||||
var node = context.Node;
|
||||
if (node == null
|
||||
|| !node.IsValid())
|
||||
if (_node == null
|
||||
|| !_node.IsValid())
|
||||
{
|
||||
ret.Msg = ResUI.CheckServerSettings;
|
||||
return ret;
|
||||
}
|
||||
if (node.GetNetwork() is nameof(ETransport.kcp) or nameof(ETransport.xhttp))
|
||||
if (_node.GetNetwork() is nameof(ETransport.kcp) or nameof(ETransport.xhttp))
|
||||
{
|
||||
ret.Msg = ResUI.Incorrectconfiguration + $" - {node.GetNetwork()}";
|
||||
ret.Msg = ResUI.Incorrectconfiguration + $" - {_node.GetNetwork()}";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -193,16 +194,15 @@ public partial class CoreConfigSingboxService(CoreConfigContext context)
|
|||
var ret = new RetResult();
|
||||
try
|
||||
{
|
||||
var node = context.Node;
|
||||
if (node == null
|
||||
|| !node.IsValid())
|
||||
if (_node == null
|
||||
|| !_node.IsValid())
|
||||
{
|
||||
ret.Msg = ResUI.CheckServerSettings;
|
||||
return ret;
|
||||
}
|
||||
if (node.GetNetwork() is nameof(ETransport.kcp) or nameof(ETransport.xhttp))
|
||||
if (_node.GetNetwork() is nameof(ETransport.kcp) or nameof(ETransport.xhttp))
|
||||
{
|
||||
ret.Msg = ResUI.Incorrectconfiguration + $" - {node.GetNetwork()}";
|
||||
ret.Msg = ResUI.Incorrectconfiguration + $" - {_node.GetNetwork()}";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -249,87 +249,5 @@ public partial class CoreConfigSingboxService(CoreConfigContext context)
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<RetResult> GenerateClientCustomConfig(string? fileName)
|
||||
{
|
||||
var ret = new RetResult();
|
||||
var node = context.Node;
|
||||
if (node == null || fileName is null)
|
||||
{
|
||||
ret.Msg = ResUI.CheckServerSettings;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret.Msg = ResUI.InitialConfiguration;
|
||||
|
||||
try
|
||||
{
|
||||
if (node == null)
|
||||
{
|
||||
ret.Msg = ResUI.CheckServerSettings;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
File.Delete(fileName);
|
||||
}
|
||||
|
||||
var addressFileName = node.Address;
|
||||
if (addressFileName.IsNullOrEmpty())
|
||||
{
|
||||
ret.Msg = ResUI.FailedGetDefaultConfiguration;
|
||||
return ret;
|
||||
}
|
||||
if (!File.Exists(addressFileName))
|
||||
{
|
||||
addressFileName = Path.Combine(Utils.GetConfigPath(), addressFileName);
|
||||
}
|
||||
if (!File.Exists(addressFileName))
|
||||
{
|
||||
ret.Msg = ResUI.FailedReadConfiguration + "1";
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (node.Address == Global.CoreMultipleLoadConfigFileName)
|
||||
{
|
||||
var txtFile = File.ReadAllText(addressFileName);
|
||||
_coreConfig = JsonUtils.Deserialize<SingboxConfig>(txtFile);
|
||||
if (_coreConfig == null)
|
||||
{
|
||||
File.Copy(addressFileName, fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
GenInbounds();
|
||||
GenExperimental();
|
||||
|
||||
var content = JsonUtils.Serialize(_coreConfig, true);
|
||||
await File.WriteAllTextAsync(fileName, content);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Copy(addressFileName, fileName);
|
||||
}
|
||||
|
||||
//check again
|
||||
if (!File.Exists(fileName))
|
||||
{
|
||||
ret.Msg = ResUI.FailedReadConfiguration + "2";
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret.Msg = string.Format(ResUI.SuccessfulConfiguration, "");
|
||||
ret.Success = true;
|
||||
return ret;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.SaveLog(_tag, ex);
|
||||
ret.Msg = ResUI.FailedGenDefaultConfiguration;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion public gen function
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ public partial class CoreConfigSingboxService
|
|||
var listen = "0.0.0.0";
|
||||
_coreConfig.inbounds = [];
|
||||
|
||||
if (!context.AppConfig.TunModeItem.EnableTun
|
||||
|| (context.AppConfig.TunModeItem.EnableTun && context.AppConfig.TunModeItem.EnableExInbound && AppManager.Instance.RunningCoreType == ECoreType.sing_box))
|
||||
if (!_config.TunModeItem.EnableTun
|
||||
|| (_config.TunModeItem.EnableTun && _config.TunModeItem.EnableExInbound && AppManager.Instance.RunningCoreType == ECoreType.sing_box))
|
||||
{
|
||||
var inbound = new Inbound4Sbox()
|
||||
{
|
||||
|
|
@ -22,24 +22,24 @@ public partial class CoreConfigSingboxService
|
|||
|
||||
inbound.listen_port = AppManager.Instance.GetLocalPort(EInboundProtocol.socks);
|
||||
|
||||
if (context.AppConfig.Inbound.First().SecondLocalPortEnabled)
|
||||
if (_config.Inbound.First().SecondLocalPortEnabled)
|
||||
{
|
||||
var inbound2 = BuildInbound(inbound, EInboundProtocol.socks2, true);
|
||||
_coreConfig.inbounds.Add(inbound2);
|
||||
}
|
||||
|
||||
if (context.AppConfig.Inbound.First().AllowLANConn)
|
||||
if (_config.Inbound.First().AllowLANConn)
|
||||
{
|
||||
if (context.AppConfig.Inbound.First().NewPort4LAN)
|
||||
if (_config.Inbound.First().NewPort4LAN)
|
||||
{
|
||||
var inbound3 = BuildInbound(inbound, EInboundProtocol.socks3, true);
|
||||
inbound3.listen = listen;
|
||||
_coreConfig.inbounds.Add(inbound3);
|
||||
|
||||
//auth
|
||||
if (context.AppConfig.Inbound.First().User.IsNotEmpty() && context.AppConfig.Inbound.First().Pass.IsNotEmpty())
|
||||
if (_config.Inbound.First().User.IsNotEmpty() && _config.Inbound.First().Pass.IsNotEmpty())
|
||||
{
|
||||
inbound3.users = new() { new() { username = context.AppConfig.Inbound.First().User, password = context.AppConfig.Inbound.First().Pass } };
|
||||
inbound3.users = new() { new() { username = _config.Inbound.First().User, password = _config.Inbound.First().Pass } };
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -49,24 +49,24 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
}
|
||||
|
||||
if (context.AppConfig.TunModeItem.EnableTun)
|
||||
if (_config.TunModeItem.EnableTun)
|
||||
{
|
||||
if (context.AppConfig.TunModeItem.Mtu <= 0)
|
||||
if (_config.TunModeItem.Mtu <= 0)
|
||||
{
|
||||
context.AppConfig.TunModeItem.Mtu = Global.TunMtus.First();
|
||||
_config.TunModeItem.Mtu = Global.TunMtus.First();
|
||||
}
|
||||
if (context.AppConfig.TunModeItem.Stack.IsNullOrEmpty())
|
||||
if (_config.TunModeItem.Stack.IsNullOrEmpty())
|
||||
{
|
||||
context.AppConfig.TunModeItem.Stack = Global.TunStacks.First();
|
||||
_config.TunModeItem.Stack = Global.TunStacks.First();
|
||||
}
|
||||
|
||||
var tunInbound = JsonUtils.Deserialize<Inbound4Sbox>(EmbedUtils.GetEmbedText(Global.TunSingboxInboundFileName)) ?? new Inbound4Sbox { };
|
||||
tunInbound.interface_name = Utils.IsMacOS() ? $"utun{new Random().Next(99)}" : "singbox_tun";
|
||||
tunInbound.mtu = context.AppConfig.TunModeItem.Mtu;
|
||||
tunInbound.auto_route = context.AppConfig.TunModeItem.AutoRoute;
|
||||
tunInbound.strict_route = context.AppConfig.TunModeItem.StrictRoute;
|
||||
tunInbound.stack = context.AppConfig.TunModeItem.Stack;
|
||||
if (context.AppConfig.TunModeItem.EnableIPv6Address == false)
|
||||
tunInbound.mtu = _config.TunModeItem.Mtu;
|
||||
tunInbound.auto_route = _config.TunModeItem.AutoRoute;
|
||||
tunInbound.strict_route = _config.TunModeItem.StrictRoute;
|
||||
tunInbound.stack = _config.TunModeItem.Stack;
|
||||
if (_config.TunModeItem.EnableIPv6Address == false)
|
||||
{
|
||||
tunInbound.address = ["172.18.0.1/30"];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,12 @@ public partial class CoreConfigSingboxService
|
|||
{
|
||||
try
|
||||
{
|
||||
switch (context.AppConfig.CoreBasicItem.Loglevel)
|
||||
switch (_config.CoreBasicItem.Loglevel)
|
||||
{
|
||||
case "debug":
|
||||
case "info":
|
||||
case "error":
|
||||
_coreConfig.log.level = context.AppConfig.CoreBasicItem.Loglevel;
|
||||
_coreConfig.log.level = _config.CoreBasicItem.Loglevel;
|
||||
break;
|
||||
|
||||
case "warning":
|
||||
|
|
@ -21,11 +21,11 @@ public partial class CoreConfigSingboxService
|
|||
default:
|
||||
break;
|
||||
}
|
||||
if (context.AppConfig.CoreBasicItem.Loglevel == Global.None)
|
||||
if (_config.CoreBasicItem.Loglevel == Global.None)
|
||||
{
|
||||
_coreConfig.log.disabled = true;
|
||||
}
|
||||
if (context.AppConfig.CoreBasicItem.LogEnabled)
|
||||
if (_config.CoreBasicItem.LogEnabled)
|
||||
{
|
||||
var dtNow = DateTime.Now;
|
||||
_coreConfig.log.output = Utils.GetLogPath($"sbox_{dtNow:yyyy-MM-dd}.txt");
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public partial class CoreConfigSingboxService
|
|||
private List<BaseServer4Sbox> BuildAllProxyOutbounds(string baseTagName = Global.ProxyTag, bool withSelector = true)
|
||||
{
|
||||
var proxyOutboundList = new List<BaseServer4Sbox>();
|
||||
if (!context.Node.ConfigType.IsComplexType())
|
||||
if (!_node.ConfigType.IsComplexType())
|
||||
{
|
||||
var outbound = BuildProxyOutbound(baseTagName);
|
||||
proxyOutboundList.Add(outbound);
|
||||
|
|
@ -38,7 +38,7 @@ public partial class CoreConfigSingboxService
|
|||
private List<BaseServer4Sbox> BuildGroupProxyOutbounds(string baseTagName = Global.ProxyTag)
|
||||
{
|
||||
var proxyOutboundList = new List<BaseServer4Sbox>();
|
||||
switch (context.Node.ConfigType)
|
||||
switch (_node.ConfigType)
|
||||
{
|
||||
case EConfigType.PolicyGroup:
|
||||
proxyOutboundList = BuildOutboundsList(baseTagName);
|
||||
|
|
@ -54,9 +54,8 @@ public partial class CoreConfigSingboxService
|
|||
{
|
||||
try
|
||||
{
|
||||
var node = context.Node;
|
||||
var txtOutbound = EmbedUtils.GetEmbedText(Global.SingboxSampleOutbound);
|
||||
if (node.ConfigType == EConfigType.WireGuard)
|
||||
if (_node.ConfigType == EConfigType.WireGuard)
|
||||
{
|
||||
var endpoint = JsonUtils.Deserialize<Endpoints4Sbox>(txtOutbound);
|
||||
FillEndpoint(endpoint);
|
||||
|
|
@ -80,17 +79,16 @@ public partial class CoreConfigSingboxService
|
|||
{
|
||||
try
|
||||
{
|
||||
var node = context.Node;
|
||||
var protocolExtra = node.GetProtocolExtra();
|
||||
outbound.server = node.Address;
|
||||
outbound.server_port = node.Port;
|
||||
outbound.type = Global.ProtocolTypes[node.ConfigType];
|
||||
var protocolExtra = _node.GetProtocolExtra();
|
||||
outbound.server = _node.Address;
|
||||
outbound.server_port = _node.Port;
|
||||
outbound.type = Global.ProtocolTypes[_node.ConfigType];
|
||||
|
||||
switch (node.ConfigType)
|
||||
switch (_node.ConfigType)
|
||||
{
|
||||
case EConfigType.VMess:
|
||||
{
|
||||
outbound.uuid = node.Password;
|
||||
outbound.uuid = _node.Password;
|
||||
outbound.alter_id = int.TryParse(protocolExtra.AlterId, out var result) ? result : 0;
|
||||
if (Global.VmessSecurities.Contains(protocolExtra.VmessSecurity))
|
||||
{
|
||||
|
|
@ -107,35 +105,35 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
case EConfigType.Shadowsocks:
|
||||
{
|
||||
outbound.method = AppManager.Instance.GetShadowsocksSecurities(node).Contains(protocolExtra.SsMethod)
|
||||
outbound.method = AppManager.Instance.GetShadowsocksSecurities(_node).Contains(protocolExtra.SsMethod)
|
||||
? protocolExtra.SsMethod : Global.None;
|
||||
outbound.password = node.Password;
|
||||
outbound.password = _node.Password;
|
||||
|
||||
if (node.Network == nameof(ETransport.tcp) && node.HeaderType == Global.TcpHeaderHttp)
|
||||
if (_node.Network == nameof(ETransport.tcp) && _node.HeaderType == Global.TcpHeaderHttp)
|
||||
{
|
||||
outbound.plugin = "obfs-local";
|
||||
outbound.plugin_opts = $"obfs=http;obfs-host={node.RequestHost};";
|
||||
outbound.plugin_opts = $"obfs=http;obfs-host={_node.RequestHost};";
|
||||
}
|
||||
else
|
||||
{
|
||||
var pluginArgs = string.Empty;
|
||||
if (node.Network == nameof(ETransport.ws))
|
||||
if (_node.Network == nameof(ETransport.ws))
|
||||
{
|
||||
pluginArgs += "mode=websocket;";
|
||||
pluginArgs += $"host={node.RequestHost};";
|
||||
pluginArgs += $"host={_node.RequestHost};";
|
||||
// https://github.com/shadowsocks/v2ray-plugin/blob/e9af1cdd2549d528deb20a4ab8d61c5fbe51f306/args.go#L172
|
||||
// Equal signs and commas [and backslashes] must be escaped with a backslash.
|
||||
var path = node.Path.Replace("\\", "\\\\").Replace("=", "\\=").Replace(",", "\\,");
|
||||
var path = _node.Path.Replace("\\", "\\\\").Replace("=", "\\=").Replace(",", "\\,");
|
||||
pluginArgs += $"path={path};";
|
||||
}
|
||||
else if (node.Network == nameof(ETransport.quic))
|
||||
else if (_node.Network == nameof(ETransport.quic))
|
||||
{
|
||||
pluginArgs += "mode=quic;";
|
||||
}
|
||||
if (node.StreamSecurity == Global.StreamSecurity)
|
||||
if (_node.StreamSecurity == Global.StreamSecurity)
|
||||
{
|
||||
pluginArgs += "tls;";
|
||||
var certs = CertPemManager.ParsePemChain(node.Cert);
|
||||
var certs = CertPemManager.ParsePemChain(_node.Cert);
|
||||
if (certs.Count > 0)
|
||||
{
|
||||
var cert = certs.First();
|
||||
|
|
@ -165,27 +163,27 @@ public partial class CoreConfigSingboxService
|
|||
case EConfigType.SOCKS:
|
||||
{
|
||||
outbound.version = "5";
|
||||
if (node.Username.IsNotEmpty()
|
||||
&& node.Password.IsNotEmpty())
|
||||
if (_node.Username.IsNotEmpty()
|
||||
&& _node.Password.IsNotEmpty())
|
||||
{
|
||||
outbound.username = node.Username;
|
||||
outbound.password = node.Password;
|
||||
outbound.username = _node.Username;
|
||||
outbound.password = _node.Password;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EConfigType.HTTP:
|
||||
{
|
||||
if (node.Username.IsNotEmpty()
|
||||
&& node.Password.IsNotEmpty())
|
||||
if (_node.Username.IsNotEmpty()
|
||||
&& _node.Password.IsNotEmpty())
|
||||
{
|
||||
outbound.username = node.Username;
|
||||
outbound.password = node.Password;
|
||||
outbound.username = _node.Username;
|
||||
outbound.password = _node.Password;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EConfigType.VLESS:
|
||||
{
|
||||
outbound.uuid = node.Password;
|
||||
outbound.uuid = _node.Password;
|
||||
|
||||
outbound.packet_encoding = "xudp";
|
||||
|
||||
|
|
@ -203,7 +201,7 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
case EConfigType.Trojan:
|
||||
{
|
||||
outbound.password = node.Password;
|
||||
outbound.password = _node.Password;
|
||||
|
||||
FillOutboundMux(outbound);
|
||||
FillOutboundTransport(outbound);
|
||||
|
|
@ -211,7 +209,7 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
case EConfigType.Hysteria2:
|
||||
{
|
||||
outbound.password = node.Password;
|
||||
outbound.password = _node.Password;
|
||||
|
||||
if (!protocolExtra.SalamanderPass.IsNullOrEmpty())
|
||||
{
|
||||
|
|
@ -224,10 +222,10 @@ public partial class CoreConfigSingboxService
|
|||
|
||||
outbound.up_mbps = protocolExtra?.UpMbps is { } su and >= 0
|
||||
? su
|
||||
: context.AppConfig.HysteriaItem.UpMbps;
|
||||
: _config.HysteriaItem.UpMbps;
|
||||
outbound.down_mbps = protocolExtra?.DownMbps is { } sd and >= 0
|
||||
? sd
|
||||
: context.AppConfig.HysteriaItem.DownMbps;
|
||||
: _config.HysteriaItem.DownMbps;
|
||||
var ports = protocolExtra?.Ports?.IsNullOrEmpty() == false ? protocolExtra.Ports : null;
|
||||
if ((!ports.IsNullOrEmpty()) && (ports.Contains(':') || ports.Contains('-') || ports.Contains(',')))
|
||||
{
|
||||
|
|
@ -241,8 +239,8 @@ public partial class CoreConfigSingboxService
|
|||
return port.Contains(':') ? port : $"{port}:{port}";
|
||||
})
|
||||
.ToList();
|
||||
outbound.hop_interval = context.AppConfig.HysteriaItem.HopInterval >= 5
|
||||
? $"{context.AppConfig.HysteriaItem.HopInterval}s"
|
||||
outbound.hop_interval = _config.HysteriaItem.HopInterval >= 5
|
||||
? $"{_config.HysteriaItem.HopInterval}s"
|
||||
: $"{Global.Hysteria2DefaultHopInt}s";
|
||||
if (int.TryParse(protocolExtra.HopInterval, out var hiResult))
|
||||
{
|
||||
|
|
@ -265,14 +263,14 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
case EConfigType.TUIC:
|
||||
{
|
||||
outbound.uuid = node.Username;
|
||||
outbound.password = node.Password;
|
||||
outbound.congestion_control = node.HeaderType;
|
||||
outbound.uuid = _node.Username;
|
||||
outbound.password = _node.Password;
|
||||
outbound.congestion_control = _node.HeaderType;
|
||||
break;
|
||||
}
|
||||
case EConfigType.Anytls:
|
||||
{
|
||||
outbound.password = node.Password;
|
||||
outbound.password = _node.Password;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -289,13 +287,12 @@ public partial class CoreConfigSingboxService
|
|||
{
|
||||
try
|
||||
{
|
||||
var node = context.Node;
|
||||
var protocolExtra = node.GetProtocolExtra();
|
||||
var protocolExtra = _node.GetProtocolExtra();
|
||||
|
||||
endpoint.address = Utils.String2List(protocolExtra.WgInterfaceAddress);
|
||||
endpoint.type = Global.ProtocolTypes[node.ConfigType];
|
||||
endpoint.type = Global.ProtocolTypes[_node.ConfigType];
|
||||
|
||||
switch (node.ConfigType)
|
||||
switch (_node.ConfigType)
|
||||
{
|
||||
case EConfigType.WireGuard:
|
||||
{
|
||||
|
|
@ -304,12 +301,12 @@ public partial class CoreConfigSingboxService
|
|||
public_key = protocolExtra.WgPublicKey,
|
||||
pre_shared_key = protocolExtra.WgPresharedKey,
|
||||
reserved = Utils.String2List(protocolExtra.WgReserved)?.Select(int.Parse).ToList(),
|
||||
address = node.Address,
|
||||
port = node.Port,
|
||||
address = _node.Address,
|
||||
port = _node.Port,
|
||||
// TODO default ["0.0.0.0/0", "::/0"]
|
||||
allowed_ips = new() { "0.0.0.0/0", "::/0" },
|
||||
};
|
||||
endpoint.private_key = node.Password;
|
||||
endpoint.private_key = _node.Password;
|
||||
endpoint.mtu = protocolExtra.WgMtu > 0 ? protocolExtra.WgMtu : Global.TunMtus.First();
|
||||
endpoint.peers = [peer];
|
||||
break;
|
||||
|
|
@ -326,16 +323,15 @@ public partial class CoreConfigSingboxService
|
|||
{
|
||||
try
|
||||
{
|
||||
var config = context.AppConfig;
|
||||
var muxEnabled = context.Node.MuxEnabled ?? config.CoreBasicItem.MuxEnabled;
|
||||
if (muxEnabled && config.Mux4SboxItem.Protocol.IsNotEmpty())
|
||||
var muxEnabled = _node.MuxEnabled ?? _config.CoreBasicItem.MuxEnabled;
|
||||
if (muxEnabled && _config.Mux4SboxItem.Protocol.IsNotEmpty())
|
||||
{
|
||||
var mux = new Multiplex4Sbox()
|
||||
{
|
||||
enabled = true,
|
||||
protocol = config.Mux4SboxItem.Protocol,
|
||||
max_connections = config.Mux4SboxItem.MaxConnections,
|
||||
padding = config.Mux4SboxItem.Padding,
|
||||
protocol = _config.Mux4SboxItem.Protocol,
|
||||
max_connections = _config.Mux4SboxItem.MaxConnections,
|
||||
padding = _config.Mux4SboxItem.Padding,
|
||||
};
|
||||
outbound.multiplex = mux;
|
||||
}
|
||||
|
|
@ -350,60 +346,59 @@ public partial class CoreConfigSingboxService
|
|||
{
|
||||
try
|
||||
{
|
||||
var node = context.Node;
|
||||
if (node.StreamSecurity is not (Global.StreamSecurityReality or Global.StreamSecurity))
|
||||
if (_node.StreamSecurity is not (Global.StreamSecurityReality or Global.StreamSecurity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (node.ConfigType is EConfigType.Shadowsocks or EConfigType.SOCKS or EConfigType.WireGuard)
|
||||
if (_node.ConfigType is EConfigType.Shadowsocks or EConfigType.SOCKS or EConfigType.WireGuard)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var serverName = string.Empty;
|
||||
if (node.Sni.IsNotEmpty())
|
||||
if (_node.Sni.IsNotEmpty())
|
||||
{
|
||||
serverName = node.Sni;
|
||||
serverName = _node.Sni;
|
||||
}
|
||||
else if (node.RequestHost.IsNotEmpty())
|
||||
else if (_node.RequestHost.IsNotEmpty())
|
||||
{
|
||||
serverName = Utils.String2List(node.RequestHost)?.First();
|
||||
serverName = Utils.String2List(_node.RequestHost)?.First();
|
||||
}
|
||||
var tls = new Tls4Sbox()
|
||||
{
|
||||
enabled = true,
|
||||
record_fragment = context.AppConfig.CoreBasicItem.EnableFragment ? true : null,
|
||||
record_fragment = _config.CoreBasicItem.EnableFragment ? true : null,
|
||||
server_name = serverName,
|
||||
insecure = Utils.ToBool(node.AllowInsecure.IsNullOrEmpty() ? context.AppConfig.CoreBasicItem.DefAllowInsecure.ToString().ToLower() : node.AllowInsecure),
|
||||
alpn = node.GetAlpn(),
|
||||
insecure = Utils.ToBool(_node.AllowInsecure.IsNullOrEmpty() ? _config.CoreBasicItem.DefAllowInsecure.ToString().ToLower() : _node.AllowInsecure),
|
||||
alpn = _node.GetAlpn(),
|
||||
};
|
||||
if (node.Fingerprint.IsNotEmpty())
|
||||
if (_node.Fingerprint.IsNotEmpty())
|
||||
{
|
||||
tls.utls = new Utls4Sbox()
|
||||
{
|
||||
enabled = true,
|
||||
fingerprint = node.Fingerprint.IsNullOrEmpty() ? context.AppConfig.CoreBasicItem.DefFingerprint : node.Fingerprint
|
||||
fingerprint = _node.Fingerprint.IsNullOrEmpty() ? _config.CoreBasicItem.DefFingerprint : _node.Fingerprint
|
||||
};
|
||||
}
|
||||
if (node.StreamSecurity == Global.StreamSecurity)
|
||||
if (_node.StreamSecurity == Global.StreamSecurity)
|
||||
{
|
||||
var certs = CertPemManager.ParsePemChain(node.Cert);
|
||||
var certs = CertPemManager.ParsePemChain(_node.Cert);
|
||||
if (certs.Count > 0)
|
||||
{
|
||||
tls.certificate = certs;
|
||||
tls.insecure = false;
|
||||
}
|
||||
}
|
||||
else if (node.StreamSecurity == Global.StreamSecurityReality)
|
||||
else if (_node.StreamSecurity == Global.StreamSecurityReality)
|
||||
{
|
||||
tls.reality = new Reality4Sbox()
|
||||
{
|
||||
enabled = true,
|
||||
public_key = node.PublicKey,
|
||||
short_id = node.ShortId
|
||||
public_key = _node.PublicKey,
|
||||
short_id = _node.ShortId
|
||||
};
|
||||
tls.insecure = false;
|
||||
}
|
||||
var (ech, _) = ParseEchParam(node.EchConfigList);
|
||||
var (ech, _) = ParseEchParam(_node.EchConfigList);
|
||||
if (ech is not null)
|
||||
{
|
||||
tls.ech = ech;
|
||||
|
|
@ -420,29 +415,28 @@ public partial class CoreConfigSingboxService
|
|||
{
|
||||
try
|
||||
{
|
||||
var node = context.Node;
|
||||
var transport = new Transport4Sbox();
|
||||
|
||||
switch (node.GetNetwork())
|
||||
switch (_node.GetNetwork())
|
||||
{
|
||||
case nameof(ETransport.h2):
|
||||
transport.type = nameof(ETransport.http);
|
||||
transport.host = node.RequestHost.IsNullOrEmpty() ? null : Utils.String2List(node.RequestHost);
|
||||
transport.path = node.Path.NullIfEmpty();
|
||||
transport.host = _node.RequestHost.IsNullOrEmpty() ? null : Utils.String2List(_node.RequestHost);
|
||||
transport.path = _node.Path.NullIfEmpty();
|
||||
break;
|
||||
|
||||
case nameof(ETransport.tcp): //http
|
||||
if (node.HeaderType == Global.TcpHeaderHttp)
|
||||
if (_node.HeaderType == Global.TcpHeaderHttp)
|
||||
{
|
||||
transport.type = nameof(ETransport.http);
|
||||
transport.host = node.RequestHost.IsNullOrEmpty() ? null : Utils.String2List(node.RequestHost);
|
||||
transport.path = node.Path.NullIfEmpty();
|
||||
transport.host = _node.RequestHost.IsNullOrEmpty() ? null : Utils.String2List(_node.RequestHost);
|
||||
transport.path = _node.Path.NullIfEmpty();
|
||||
}
|
||||
break;
|
||||
|
||||
case nameof(ETransport.ws):
|
||||
transport.type = nameof(ETransport.ws);
|
||||
var wsPath = node.Path;
|
||||
var wsPath = _node.Path;
|
||||
|
||||
// Parse eh and ed parameters from path using regex
|
||||
if (!wsPath.IsNullOrEmpty())
|
||||
|
|
@ -471,19 +465,19 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
|
||||
transport.path = wsPath.NullIfEmpty();
|
||||
if (node.RequestHost.IsNotEmpty())
|
||||
if (_node.RequestHost.IsNotEmpty())
|
||||
{
|
||||
transport.headers = new()
|
||||
{
|
||||
Host = node.RequestHost
|
||||
Host = _node.RequestHost
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
case nameof(ETransport.httpupgrade):
|
||||
transport.type = nameof(ETransport.httpupgrade);
|
||||
transport.path = node.Path.NullIfEmpty();
|
||||
transport.host = node.RequestHost.NullIfEmpty();
|
||||
transport.path = _node.Path.NullIfEmpty();
|
||||
transport.host = _node.RequestHost.NullIfEmpty();
|
||||
|
||||
break;
|
||||
|
||||
|
|
@ -493,10 +487,10 @@ public partial class CoreConfigSingboxService
|
|||
|
||||
case nameof(ETransport.grpc):
|
||||
transport.type = nameof(ETransport.grpc);
|
||||
transport.service_name = node.Path;
|
||||
transport.idle_timeout = context.AppConfig.GrpcItem.IdleTimeout?.ToString("##s");
|
||||
transport.ping_timeout = context.AppConfig.GrpcItem.HealthCheckTimeout?.ToString("##s");
|
||||
transport.permit_without_stream = context.AppConfig.GrpcItem.PermitWithoutStream;
|
||||
transport.service_name = _node.Path;
|
||||
transport.idle_timeout = _config.GrpcItem.IdleTimeout?.ToString("##s");
|
||||
transport.ping_timeout = _config.GrpcItem.HealthCheckTimeout?.ToString("##s");
|
||||
transport.permit_without_stream = _config.GrpcItem.PermitWithoutStream;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -515,7 +509,7 @@ public partial class CoreConfigSingboxService
|
|||
|
||||
private List<Outbound4Sbox> BuildSelectorOutbounds(List<string> proxyTags, string baseTagName = Global.ProxyTag)
|
||||
{
|
||||
var multipleLoad = context.Node.GetProtocolExtra().MultipleLoad ?? EMultipleLoad.LeastPing;
|
||||
var multipleLoad = _node.GetProtocolExtra().MultipleLoad ?? EMultipleLoad.LeastPing;
|
||||
var outUrltest = new Outbound4Sbox
|
||||
{
|
||||
type = "urltest",
|
||||
|
|
@ -545,7 +539,7 @@ public partial class CoreConfigSingboxService
|
|||
private List<BaseServer4Sbox> BuildOutboundsList(string baseTagName = Global.ProxyTag)
|
||||
{
|
||||
var nodes = new List<ProfileItem>();
|
||||
foreach (var nodeId in Utils.String2List(context.Node.GetProtocolExtra().ChildItems) ?? [])
|
||||
foreach (var nodeId in Utils.String2List(_node.GetProtocolExtra().ChildItems) ?? [])
|
||||
{
|
||||
if (context.AllProxiesMap.TryGetValue(nodeId, out var node))
|
||||
{
|
||||
|
|
@ -574,7 +568,7 @@ public partial class CoreConfigSingboxService
|
|||
private List<BaseServer4Sbox> BuildChainOutboundsList(string baseTagName = Global.ProxyTag)
|
||||
{
|
||||
var nodes = new List<ProfileItem>();
|
||||
foreach (var nodeId in Utils.String2List(context.Node.GetProtocolExtra().ChildItems) ?? [])
|
||||
foreach (var nodeId in Utils.String2List(_node.GetProtocolExtra().ChildItems) ?? [])
|
||||
{
|
||||
if (context.AllProxiesMap.TryGetValue(nodeId, out var node))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ public partial class CoreConfigSingboxService
|
|||
try
|
||||
{
|
||||
_coreConfig.route.final = Global.ProxyTag;
|
||||
var simpleDnsItem = context.AppConfig.SimpleDNSItem;
|
||||
var simpleDnsItem = context.SimpleDnsItem;
|
||||
|
||||
var defaultDomainResolverTag = Global.SingboxDirectDNSTag;
|
||||
var directDnsStrategy = Utils.DomainStrategy4Sbox(simpleDnsItem.Strategy4Freedom);
|
||||
|
|
@ -24,7 +24,7 @@ public partial class CoreConfigSingboxService
|
|||
strategy = directDnsStrategy
|
||||
};
|
||||
|
||||
if (context.AppConfig.TunModeItem.EnableTun)
|
||||
if (_config.TunModeItem.EnableTun)
|
||||
{
|
||||
_coreConfig.route.auto_detect_interface = true;
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ public partial class CoreConfigSingboxService
|
|||
});
|
||||
}
|
||||
|
||||
if (context.AppConfig.Inbound.First().SniffingEnabled)
|
||||
if (_config.Inbound.First().SniffingEnabled)
|
||||
{
|
||||
_coreConfig.route.rules.Add(new()
|
||||
{
|
||||
|
|
@ -102,7 +102,7 @@ public partial class CoreConfigSingboxService
|
|||
clash_mode = ERuleMode.Global.ToString()
|
||||
});
|
||||
|
||||
var domainStrategy = context.AppConfig.RoutingBasicItem.DomainStrategy4Singbox.NullIfEmpty();
|
||||
var domainStrategy = _config.RoutingBasicItem.DomainStrategy4Singbox.NullIfEmpty();
|
||||
var routing = context.RoutingItem;
|
||||
if (routing.DomainStrategy4Singbox.IsNotEmpty())
|
||||
{
|
||||
|
|
@ -113,7 +113,7 @@ public partial class CoreConfigSingboxService
|
|||
action = "resolve",
|
||||
strategy = domainStrategy
|
||||
};
|
||||
if (context.AppConfig.RoutingBasicItem.DomainStrategy == Global.IPOnDemand)
|
||||
if (_config.RoutingBasicItem.DomainStrategy == Global.IPOnDemand)
|
||||
{
|
||||
_coreConfig.route.rules.Add(resolveRule);
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
}
|
||||
}
|
||||
if (context.AppConfig.RoutingBasicItem.DomainStrategy == Global.IPIfNonMatch)
|
||||
if (_config.RoutingBasicItem.DomainStrategy == Global.IPIfNonMatch)
|
||||
{
|
||||
_coreConfig.route.rules.Add(resolveRule);
|
||||
foreach (var item2 in ipRules)
|
||||
|
|
|
|||
|
|
@ -99,9 +99,9 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
else
|
||||
{
|
||||
var srsUrl = string.IsNullOrEmpty(context.AppConfig.ConstItem.SrsSourceUrl)
|
||||
var srsUrl = string.IsNullOrEmpty(_config.ConstItem.SrsSourceUrl)
|
||||
? Global.SingboxRulesetUrl
|
||||
: context.AppConfig.ConstItem.SrsSourceUrl;
|
||||
: _config.ConstItem.SrsSourceUrl;
|
||||
|
||||
customRuleset = new()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ public partial class CoreConfigSingboxService
|
|||
};
|
||||
}
|
||||
|
||||
if (context.AppConfig.CoreBasicItem.EnableCacheFile4Sbox)
|
||||
if (_config.CoreBasicItem.EnableCacheFile4Sbox)
|
||||
{
|
||||
_coreConfig.experimental ??= new Experimental4Sbox();
|
||||
_coreConfig.experimental.cache_file = new CacheFile4Sbox()
|
||||
{
|
||||
enabled = true,
|
||||
path = Utils.GetBinPath("cache.db"),
|
||||
store_fakeip = context.AppConfig.SimpleDNSItem.FakeIP == true
|
||||
store_fakeip = context.SimpleDnsItem.FakeIP == true
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ namespace ServiceLib.Services.CoreConfig;
|
|||
public partial class CoreConfigV2rayService(CoreConfigContext context)
|
||||
{
|
||||
private static readonly string _tag = "CoreConfigV2rayService";
|
||||
private readonly Config _config = context.AppConfig;
|
||||
private readonly ProfileItem _node = context.Node;
|
||||
|
||||
private V2rayConfig _coreConfig = new();
|
||||
|
||||
|
|
@ -13,17 +15,16 @@ public partial class CoreConfigV2rayService(CoreConfigContext context)
|
|||
var ret = new RetResult();
|
||||
try
|
||||
{
|
||||
var node = context?.Node;
|
||||
if (node == null
|
||||
|| !node.IsValid())
|
||||
if (_node == null
|
||||
|| !_node.IsValid())
|
||||
{
|
||||
ret.Msg = ResUI.CheckServerSettings;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (node.GetNetwork() is nameof(ETransport.quic))
|
||||
if (_node.GetNetwork() is nameof(ETransport.quic))
|
||||
{
|
||||
ret.Msg = ResUI.Incorrectconfiguration + $" - {node.GetNetwork()}";
|
||||
ret.Msg = ResUI.Incorrectconfiguration + $" - {_node.GetNetwork()}";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -170,7 +171,7 @@ public partial class CoreConfigV2rayService(CoreConfigContext context)
|
|||
if (proxyOutbounds.Count(n => n.tag.StartsWith(tag)) > 1)
|
||||
{
|
||||
isBalancer = true;
|
||||
var multipleLoad = context.Node.GetProtocolExtra().MultipleLoad ?? EMultipleLoad.LeastPing;
|
||||
var multipleLoad = _node.GetProtocolExtra().MultipleLoad ?? EMultipleLoad.LeastPing;
|
||||
GenObservatory(multipleLoad, tag);
|
||||
GenBalancer(multipleLoad, tag);
|
||||
}
|
||||
|
|
@ -208,17 +209,16 @@ public partial class CoreConfigV2rayService(CoreConfigContext context)
|
|||
var ret = new RetResult();
|
||||
try
|
||||
{
|
||||
var node = context.Node;
|
||||
if (node == null
|
||||
|| !node.IsValid())
|
||||
if (_node == null
|
||||
|| !_node.IsValid())
|
||||
{
|
||||
ret.Msg = ResUI.CheckServerSettings;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (node.GetNetwork() is nameof(ETransport.quic))
|
||||
if (_node.GetNetwork() is nameof(ETransport.quic))
|
||||
{
|
||||
ret.Msg = ResUI.Incorrectconfiguration + $" - {node.GetNetwork()}";
|
||||
ret.Msg = ResUI.Incorrectconfiguration + $" - {_node.GetNetwork()}";
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,6 @@ public partial class CoreConfigV2rayService
|
|||
|
||||
private void FillDnsServers(Dns4Ray dnsItem)
|
||||
{
|
||||
var node = context.Node;
|
||||
var simpleDNSItem = context.SimpleDnsItem;
|
||||
static List<string> ParseDnsAddresses(string? dnsInput, string defaultAddress)
|
||||
{
|
||||
|
|
@ -246,11 +245,6 @@ public partial class CoreConfigV2rayService
|
|||
}
|
||||
}
|
||||
|
||||
if (Utils.IsDomain(node?.Address))
|
||||
{
|
||||
directDomainList.Add(node.Address);
|
||||
}
|
||||
|
||||
if (context.ProtectDomainList.Count > 0)
|
||||
{
|
||||
directDomainList.AddRange(context.ProtectDomainList);
|
||||
|
|
@ -407,7 +401,6 @@ public partial class CoreConfigV2rayService
|
|||
|
||||
private void FillDnsDomainsCustom(JsonNode dns)
|
||||
{
|
||||
var node = context.Node;
|
||||
var servers = dns["servers"];
|
||||
if (servers == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,32 +6,31 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
try
|
||||
{
|
||||
var config = context.AppConfig;
|
||||
var listen = "0.0.0.0";
|
||||
_coreConfig.inbounds = [];
|
||||
|
||||
var inbound = BuildInbound(config.Inbound.First(), EInboundProtocol.socks, true);
|
||||
var inbound = BuildInbound(_config.Inbound.First(), EInboundProtocol.socks, true);
|
||||
_coreConfig.inbounds.Add(inbound);
|
||||
|
||||
if (config.Inbound.First().SecondLocalPortEnabled)
|
||||
if (_config.Inbound.First().SecondLocalPortEnabled)
|
||||
{
|
||||
var inbound2 = BuildInbound(config.Inbound.First(), EInboundProtocol.socks2, true);
|
||||
var inbound2 = BuildInbound(_config.Inbound.First(), EInboundProtocol.socks2, true);
|
||||
_coreConfig.inbounds.Add(inbound2);
|
||||
}
|
||||
|
||||
if (config.Inbound.First().AllowLANConn)
|
||||
if (_config.Inbound.First().AllowLANConn)
|
||||
{
|
||||
if (config.Inbound.First().NewPort4LAN)
|
||||
if (_config.Inbound.First().NewPort4LAN)
|
||||
{
|
||||
var inbound3 = BuildInbound(config.Inbound.First(), EInboundProtocol.socks3, true);
|
||||
var inbound3 = BuildInbound(_config.Inbound.First(), EInboundProtocol.socks3, true);
|
||||
inbound3.listen = listen;
|
||||
_coreConfig.inbounds.Add(inbound3);
|
||||
|
||||
//auth
|
||||
if (config.Inbound.First().User.IsNotEmpty() && config.Inbound.First().Pass.IsNotEmpty())
|
||||
if (_config.Inbound.First().User.IsNotEmpty() && _config.Inbound.First().Pass.IsNotEmpty())
|
||||
{
|
||||
inbound3.settings.auth = "password";
|
||||
inbound3.settings.accounts = new List<AccountsItem4Ray> { new() { user = config.Inbound.First().User, pass = config.Inbound.First().Pass } };
|
||||
inbound3.settings.accounts = new List<AccountsItem4Ray> { new() { user = _config.Inbound.First().User, pass = _config.Inbound.First().Pass } };
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -6,17 +6,16 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
try
|
||||
{
|
||||
var config = context.AppConfig;
|
||||
if (config.CoreBasicItem.LogEnabled)
|
||||
if (_config.CoreBasicItem.LogEnabled)
|
||||
{
|
||||
var dtNow = DateTime.Now;
|
||||
_coreConfig.log.loglevel = config.CoreBasicItem.Loglevel;
|
||||
_coreConfig.log.loglevel = _config.CoreBasicItem.Loglevel;
|
||||
_coreConfig.log.access = Utils.GetLogPath($"Vaccess_{dtNow:yyyy-MM-dd}.txt");
|
||||
_coreConfig.log.error = Utils.GetLogPath($"Verror_{dtNow:yyyy-MM-dd}.txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
_coreConfig.log.loglevel = config.CoreBasicItem.Loglevel;
|
||||
_coreConfig.log.loglevel = _config.CoreBasicItem.Loglevel;
|
||||
_coreConfig.log.access = null;
|
||||
_coreConfig.log.error = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public partial class CoreConfigV2rayService
|
|||
_coreConfig.outbounds.InsertRange(0, proxyOutboundList);
|
||||
if (proxyOutboundList.Count(n => n.tag.StartsWith(Global.ProxyTag)) > 1)
|
||||
{
|
||||
var multipleLoad = context.Node.GetProtocolExtra().MultipleLoad ?? EMultipleLoad.LeastPing;
|
||||
var multipleLoad = _node.GetProtocolExtra().MultipleLoad ?? EMultipleLoad.LeastPing;
|
||||
GenObservatory(multipleLoad);
|
||||
GenBalancer(multipleLoad);
|
||||
}
|
||||
|
|
@ -17,8 +17,7 @@ public partial class CoreConfigV2rayService
|
|||
private List<Outbounds4Ray> BuildAllProxyOutbounds(string baseTagName = Global.ProxyTag)
|
||||
{
|
||||
var proxyOutboundList = new List<Outbounds4Ray>();
|
||||
var node = context.Node;
|
||||
if (node.ConfigType.IsGroupType())
|
||||
if (_node.ConfigType.IsGroupType())
|
||||
{
|
||||
proxyOutboundList.AddRange(BuildGroupProxyOutbounds(baseTagName));
|
||||
}
|
||||
|
|
@ -27,7 +26,7 @@ public partial class CoreConfigV2rayService
|
|||
proxyOutboundList.Add(BuildProxyOutbound(baseTagName));
|
||||
}
|
||||
|
||||
if (context.AppConfig.CoreBasicItem.EnableFragment)
|
||||
if (_config.CoreBasicItem.EnableFragment)
|
||||
{
|
||||
var fragmentOutbound = new Outbounds4Ray
|
||||
{
|
||||
|
|
@ -37,9 +36,9 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
fragment = new()
|
||||
{
|
||||
packets = context.AppConfig.Fragment4RayItem?.Packets,
|
||||
length = context.AppConfig.Fragment4RayItem?.Length,
|
||||
interval = context.AppConfig.Fragment4RayItem?.Interval
|
||||
packets = _config.Fragment4RayItem?.Packets,
|
||||
length = _config.Fragment4RayItem?.Length,
|
||||
interval = _config.Fragment4RayItem?.Interval
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -63,8 +62,7 @@ public partial class CoreConfigV2rayService
|
|||
private List<Outbounds4Ray> BuildGroupProxyOutbounds(string baseTagName = Global.ProxyTag)
|
||||
{
|
||||
var proxyOutboundList = new List<Outbounds4Ray>();
|
||||
var node = context.Node;
|
||||
switch (node.ConfigType)
|
||||
switch (_node.ConfigType)
|
||||
{
|
||||
case EConfigType.PolicyGroup:
|
||||
proxyOutboundList.AddRange(BuildOutboundsList(baseTagName));
|
||||
|
|
@ -89,10 +87,9 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
try
|
||||
{
|
||||
var node = context.Node;
|
||||
var protocolExtra = node.GetProtocolExtra();
|
||||
var muxEnabled = node.MuxEnabled ?? context.AppConfig.CoreBasicItem.MuxEnabled;
|
||||
switch (node.ConfigType)
|
||||
var protocolExtra = _node.GetProtocolExtra();
|
||||
var muxEnabled = _node.MuxEnabled ?? _config.CoreBasicItem.MuxEnabled;
|
||||
switch (_node.ConfigType)
|
||||
{
|
||||
case EConfigType.VMess:
|
||||
{
|
||||
|
|
@ -106,8 +103,8 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
vnextItem = outbound.settings.vnext.First();
|
||||
}
|
||||
vnextItem.address = node.Address;
|
||||
vnextItem.port = node.Port;
|
||||
vnextItem.address = _node.Address;
|
||||
vnextItem.port = _node.Port;
|
||||
|
||||
UsersItem4Ray usersItem;
|
||||
if (vnextItem.users.Count <= 0)
|
||||
|
|
@ -120,7 +117,7 @@ public partial class CoreConfigV2rayService
|
|||
usersItem = vnextItem.users.First();
|
||||
}
|
||||
|
||||
usersItem.id = node.Password;
|
||||
usersItem.id = _node.Password;
|
||||
usersItem.alterId = int.TryParse(protocolExtra?.AlterId, out var result) ? result : 0;
|
||||
usersItem.email = Global.UserEMail;
|
||||
if (Global.VmessSecurities.Contains(protocolExtra.VmessSecurity))
|
||||
|
|
@ -149,10 +146,10 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
serversItem = outbound.settings.servers.First();
|
||||
}
|
||||
serversItem.address = node.Address;
|
||||
serversItem.port = node.Port;
|
||||
serversItem.password = node.Password;
|
||||
serversItem.method = AppManager.Instance.GetShadowsocksSecurities(node).Contains(protocolExtra.SsMethod)
|
||||
serversItem.address = _node.Address;
|
||||
serversItem.port = _node.Port;
|
||||
serversItem.password = _node.Password;
|
||||
serversItem.method = AppManager.Instance.GetShadowsocksSecurities(_node).Contains(protocolExtra.SsMethod)
|
||||
? protocolExtra.SsMethod : "none";
|
||||
|
||||
serversItem.ota = false;
|
||||
|
|
@ -176,18 +173,18 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
serversItem = outbound.settings.servers.First();
|
||||
}
|
||||
serversItem.address = node.Address;
|
||||
serversItem.port = node.Port;
|
||||
serversItem.address = _node.Address;
|
||||
serversItem.port = _node.Port;
|
||||
serversItem.method = null;
|
||||
serversItem.password = null;
|
||||
|
||||
if (node.Username.IsNotEmpty()
|
||||
&& node.Password.IsNotEmpty())
|
||||
if (_node.Username.IsNotEmpty()
|
||||
&& _node.Password.IsNotEmpty())
|
||||
{
|
||||
SocksUsersItem4Ray socksUsersItem = new()
|
||||
{
|
||||
user = node.Username ?? "",
|
||||
pass = node.Password,
|
||||
user = _node.Username ?? "",
|
||||
pass = _node.Password,
|
||||
level = 1
|
||||
};
|
||||
|
||||
|
|
@ -211,8 +208,8 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
vnextItem = outbound.settings.vnext.First();
|
||||
}
|
||||
vnextItem.address = node.Address;
|
||||
vnextItem.port = node.Port;
|
||||
vnextItem.address = _node.Address;
|
||||
vnextItem.port = _node.Port;
|
||||
|
||||
UsersItem4Ray usersItem;
|
||||
if (vnextItem.users.Count <= 0)
|
||||
|
|
@ -224,7 +221,7 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
usersItem = vnextItem.users.First();
|
||||
}
|
||||
usersItem.id = node.Password;
|
||||
usersItem.id = _node.Password;
|
||||
usersItem.email = Global.UserEMail;
|
||||
usersItem.encryption = protocolExtra.VlessEncryption;
|
||||
|
||||
|
|
@ -251,9 +248,9 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
serversItem = outbound.settings.servers.First();
|
||||
}
|
||||
serversItem.address = node.Address;
|
||||
serversItem.port = node.Port;
|
||||
serversItem.password = node.Password;
|
||||
serversItem.address = _node.Address;
|
||||
serversItem.port = _node.Port;
|
||||
serversItem.password = _node.Password;
|
||||
|
||||
serversItem.ota = false;
|
||||
serversItem.level = 1;
|
||||
|
|
@ -268,8 +265,8 @@ public partial class CoreConfigV2rayService
|
|||
outbound.settings = new()
|
||||
{
|
||||
version = 2,
|
||||
address = node.Address,
|
||||
port = node.Port,
|
||||
address = _node.Address,
|
||||
port = _node.Port,
|
||||
};
|
||||
outbound.settings.vnext = null;
|
||||
outbound.settings.servers = null;
|
||||
|
|
@ -277,7 +274,7 @@ public partial class CoreConfigV2rayService
|
|||
}
|
||||
case EConfigType.WireGuard:
|
||||
{
|
||||
var address = node.Address;
|
||||
var address = _node.Address;
|
||||
if (Utils.IsIpv6(address))
|
||||
{
|
||||
address = $"[{address}]";
|
||||
|
|
@ -285,12 +282,12 @@ public partial class CoreConfigV2rayService
|
|||
var peer = new WireguardPeer4Ray
|
||||
{
|
||||
publicKey = protocolExtra.WgPublicKey ?? "",
|
||||
endpoint = address + ":" + node.Port.ToString()
|
||||
endpoint = address + ":" + _node.Port.ToString()
|
||||
};
|
||||
var setting = new Outboundsettings4Ray
|
||||
{
|
||||
address = Utils.String2List(protocolExtra.WgInterfaceAddress),
|
||||
secretKey = node.Password,
|
||||
secretKey = _node.Password,
|
||||
reserved = Utils.String2List(protocolExtra.WgReserved)?.Select(int.Parse).ToList(),
|
||||
mtu = protocolExtra.WgMtu > 0 ? protocolExtra.WgMtu : Global.TunMtus.First(),
|
||||
peers = [peer]
|
||||
|
|
@ -302,8 +299,8 @@ public partial class CoreConfigV2rayService
|
|||
}
|
||||
}
|
||||
|
||||
outbound.protocol = Global.ProtocolTypes[node.ConfigType];
|
||||
if (node.ConfigType == EConfigType.Hysteria2)
|
||||
outbound.protocol = Global.ProtocolTypes[_node.ConfigType];
|
||||
if (_node.ConfigType == EConfigType.Hysteria2)
|
||||
{
|
||||
outbound.protocol = "hysteria";
|
||||
}
|
||||
|
|
@ -325,13 +322,13 @@ public partial class CoreConfigV2rayService
|
|||
if (enabledTCP)
|
||||
{
|
||||
outbound.mux.enabled = true;
|
||||
outbound.mux.concurrency = context.AppConfig.Mux4RayItem.Concurrency;
|
||||
outbound.mux.concurrency = _config.Mux4RayItem.Concurrency;
|
||||
}
|
||||
else if (enabledUDP)
|
||||
{
|
||||
outbound.mux.enabled = true;
|
||||
outbound.mux.xudpConcurrency = context.AppConfig.Mux4RayItem.XudpConcurrency;
|
||||
outbound.mux.xudpProxyUDP443 = context.AppConfig.Mux4RayItem.XudpProxyUDP443;
|
||||
outbound.mux.xudpConcurrency = _config.Mux4RayItem.XudpConcurrency;
|
||||
outbound.mux.xudpProxyUDP443 = _config.Mux4RayItem.XudpProxyUDP443;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -344,43 +341,41 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
try
|
||||
{
|
||||
var node = context.Node;
|
||||
var config = context.AppConfig;
|
||||
var streamSettings = outbound.streamSettings;
|
||||
var network = node.GetNetwork();
|
||||
if (node.ConfigType == EConfigType.Hysteria2)
|
||||
var network = _node.GetNetwork();
|
||||
if (_node.ConfigType == EConfigType.Hysteria2)
|
||||
{
|
||||
network = "hysteria";
|
||||
}
|
||||
streamSettings.network = network;
|
||||
var host = node.RequestHost.TrimEx();
|
||||
var path = node.Path.TrimEx();
|
||||
var sni = node.Sni.TrimEx();
|
||||
var host = _node.RequestHost.TrimEx();
|
||||
var path = _node.Path.TrimEx();
|
||||
var sni = _node.Sni.TrimEx();
|
||||
var useragent = "";
|
||||
if (!config.CoreBasicItem.DefUserAgent.IsNullOrEmpty())
|
||||
if (!_config.CoreBasicItem.DefUserAgent.IsNullOrEmpty())
|
||||
{
|
||||
try
|
||||
{
|
||||
useragent = Global.UserAgentTexts[config.CoreBasicItem.DefUserAgent];
|
||||
useragent = Global.UserAgentTexts[_config.CoreBasicItem.DefUserAgent];
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
useragent = config.CoreBasicItem.DefUserAgent;
|
||||
useragent = _config.CoreBasicItem.DefUserAgent;
|
||||
}
|
||||
}
|
||||
|
||||
//if tls
|
||||
if (node.StreamSecurity == Global.StreamSecurity)
|
||||
if (_node.StreamSecurity == Global.StreamSecurity)
|
||||
{
|
||||
streamSettings.security = node.StreamSecurity;
|
||||
streamSettings.security = _node.StreamSecurity;
|
||||
|
||||
TlsSettings4Ray tlsSettings = new()
|
||||
{
|
||||
allowInsecure = Utils.ToBool(node.AllowInsecure.IsNullOrEmpty() ? config.CoreBasicItem.DefAllowInsecure.ToString().ToLower() : node.AllowInsecure),
|
||||
alpn = node.GetAlpn(),
|
||||
fingerprint = node.Fingerprint.IsNullOrEmpty() ? config.CoreBasicItem.DefFingerprint : node.Fingerprint,
|
||||
echConfigList = node.EchConfigList.NullIfEmpty(),
|
||||
echForceQuery = node.EchForceQuery.NullIfEmpty()
|
||||
allowInsecure = Utils.ToBool(_node.AllowInsecure.IsNullOrEmpty() ? _config.CoreBasicItem.DefAllowInsecure.ToString().ToLower() : _node.AllowInsecure),
|
||||
alpn = _node.GetAlpn(),
|
||||
fingerprint = _node.Fingerprint.IsNullOrEmpty() ? _config.CoreBasicItem.DefFingerprint : _node.Fingerprint,
|
||||
echConfigList = _node.EchConfigList.NullIfEmpty(),
|
||||
echForceQuery = _node.EchForceQuery.NullIfEmpty()
|
||||
};
|
||||
if (sni.IsNotEmpty())
|
||||
{
|
||||
|
|
@ -390,7 +385,7 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
tlsSettings.serverName = Utils.String2List(host)?.First();
|
||||
}
|
||||
var certs = CertPemManager.ParsePemChain(node.Cert);
|
||||
var certs = CertPemManager.ParsePemChain(_node.Cert);
|
||||
if (certs.Count > 0)
|
||||
{
|
||||
var certsettings = new List<CertificateSettings4Ray>();
|
||||
|
|
@ -407,27 +402,27 @@ public partial class CoreConfigV2rayService
|
|||
tlsSettings.disableSystemRoot = true;
|
||||
tlsSettings.allowInsecure = false;
|
||||
}
|
||||
else if (!node.CertSha.IsNullOrEmpty())
|
||||
else if (!_node.CertSha.IsNullOrEmpty())
|
||||
{
|
||||
tlsSettings.pinnedPeerCertSha256 = node.CertSha;
|
||||
tlsSettings.pinnedPeerCertSha256 = _node.CertSha;
|
||||
tlsSettings.allowInsecure = false;
|
||||
}
|
||||
streamSettings.tlsSettings = tlsSettings;
|
||||
}
|
||||
|
||||
//if Reality
|
||||
if (node.StreamSecurity == Global.StreamSecurityReality)
|
||||
if (_node.StreamSecurity == Global.StreamSecurityReality)
|
||||
{
|
||||
streamSettings.security = node.StreamSecurity;
|
||||
streamSettings.security = _node.StreamSecurity;
|
||||
|
||||
TlsSettings4Ray realitySettings = new()
|
||||
{
|
||||
fingerprint = node.Fingerprint.IsNullOrEmpty() ? config.CoreBasicItem.DefFingerprint : node.Fingerprint,
|
||||
fingerprint = _node.Fingerprint.IsNullOrEmpty() ? _config.CoreBasicItem.DefFingerprint : _node.Fingerprint,
|
||||
serverName = sni,
|
||||
publicKey = node.PublicKey,
|
||||
shortId = node.ShortId,
|
||||
spiderX = node.SpiderX,
|
||||
mldsa65Verify = node.Mldsa65Verify,
|
||||
publicKey = _node.PublicKey,
|
||||
shortId = _node.ShortId,
|
||||
spiderX = _node.SpiderX,
|
||||
mldsa65Verify = _node.Mldsa65Verify,
|
||||
show = false,
|
||||
};
|
||||
|
||||
|
|
@ -440,25 +435,25 @@ public partial class CoreConfigV2rayService
|
|||
case nameof(ETransport.kcp):
|
||||
KcpSettings4Ray kcpSettings = new()
|
||||
{
|
||||
mtu = config.KcpItem.Mtu,
|
||||
tti = config.KcpItem.Tti
|
||||
mtu = _config.KcpItem.Mtu,
|
||||
tti = _config.KcpItem.Tti
|
||||
};
|
||||
|
||||
kcpSettings.uplinkCapacity = config.KcpItem.UplinkCapacity;
|
||||
kcpSettings.downlinkCapacity = config.KcpItem.DownlinkCapacity;
|
||||
kcpSettings.uplinkCapacity = _config.KcpItem.UplinkCapacity;
|
||||
kcpSettings.downlinkCapacity = _config.KcpItem.DownlinkCapacity;
|
||||
|
||||
kcpSettings.congestion = config.KcpItem.Congestion;
|
||||
kcpSettings.readBufferSize = config.KcpItem.ReadBufferSize;
|
||||
kcpSettings.writeBufferSize = config.KcpItem.WriteBufferSize;
|
||||
kcpSettings.congestion = _config.KcpItem.Congestion;
|
||||
kcpSettings.readBufferSize = _config.KcpItem.ReadBufferSize;
|
||||
kcpSettings.writeBufferSize = _config.KcpItem.WriteBufferSize;
|
||||
streamSettings.finalmask ??= new();
|
||||
if (Global.KcpHeaderMaskMap.TryGetValue(node.HeaderType, out var header))
|
||||
if (Global.KcpHeaderMaskMap.TryGetValue(_node.HeaderType, out var header))
|
||||
{
|
||||
streamSettings.finalmask.udp =
|
||||
[
|
||||
new Mask4Ray
|
||||
{
|
||||
type = header,
|
||||
settings = node.HeaderType == "dns" && !host.IsNullOrEmpty() ? new MaskSettings4Ray { domain = host } : null
|
||||
settings = _node.HeaderType == "dns" && !host.IsNullOrEmpty() ? new MaskSettings4Ray { domain = host } : null
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
@ -528,13 +523,13 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
xhttpSettings.host = host;
|
||||
}
|
||||
if (node.HeaderType.IsNotEmpty() && Global.XhttpMode.Contains(node.HeaderType))
|
||||
if (_node.HeaderType.IsNotEmpty() && Global.XhttpMode.Contains(_node.HeaderType))
|
||||
{
|
||||
xhttpSettings.mode = node.HeaderType;
|
||||
xhttpSettings.mode = _node.HeaderType;
|
||||
}
|
||||
if (node.Extra.IsNotEmpty())
|
||||
if (_node.Extra.IsNotEmpty())
|
||||
{
|
||||
xhttpSettings.extra = JsonUtils.ParseJson(node.Extra);
|
||||
xhttpSettings.extra = JsonUtils.ParseJson(_node.Extra);
|
||||
}
|
||||
|
||||
streamSettings.xhttpSettings = xhttpSettings;
|
||||
|
|
@ -562,11 +557,11 @@ public partial class CoreConfigV2rayService
|
|||
key = path,
|
||||
header = new Header4Ray
|
||||
{
|
||||
type = node.HeaderType
|
||||
type = _node.HeaderType
|
||||
}
|
||||
};
|
||||
streamSettings.quicSettings = quicsettings;
|
||||
if (node.StreamSecurity == Global.StreamSecurity)
|
||||
if (_node.StreamSecurity == Global.StreamSecurity)
|
||||
{
|
||||
if (sni.IsNotEmpty())
|
||||
{
|
||||
|
|
@ -574,7 +569,7 @@ public partial class CoreConfigV2rayService
|
|||
}
|
||||
else
|
||||
{
|
||||
streamSettings.tlsSettings.serverName = node.Address;
|
||||
streamSettings.tlsSettings.serverName = _node.Address;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -584,28 +579,28 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
authority = host.NullIfEmpty(),
|
||||
serviceName = path,
|
||||
multiMode = node.HeaderType == Global.GrpcMultiMode,
|
||||
idle_timeout = config.GrpcItem.IdleTimeout,
|
||||
health_check_timeout = config.GrpcItem.HealthCheckTimeout,
|
||||
permit_without_stream = config.GrpcItem.PermitWithoutStream,
|
||||
initial_windows_size = config.GrpcItem.InitialWindowsSize,
|
||||
multiMode = _node.HeaderType == Global.GrpcMultiMode,
|
||||
idle_timeout = _config.GrpcItem.IdleTimeout,
|
||||
health_check_timeout = _config.GrpcItem.HealthCheckTimeout,
|
||||
permit_without_stream = _config.GrpcItem.PermitWithoutStream,
|
||||
initial_windows_size = _config.GrpcItem.InitialWindowsSize,
|
||||
};
|
||||
streamSettings.grpcSettings = grpcSettings;
|
||||
break;
|
||||
|
||||
case "hysteria":
|
||||
var protocolExtra = node.GetProtocolExtra();
|
||||
var protocolExtra = _node.GetProtocolExtra();
|
||||
var ports = protocolExtra?.Ports;
|
||||
int? upMbps = protocolExtra?.UpMbps is { } su and >= 0
|
||||
? su
|
||||
: config.HysteriaItem.UpMbps;
|
||||
: _config.HysteriaItem.UpMbps;
|
||||
int? downMbps = protocolExtra?.DownMbps is { } sd and >= 0
|
||||
? sd
|
||||
: config.HysteriaItem.UpMbps;
|
||||
: _config.HysteriaItem.UpMbps;
|
||||
var hopInterval = !protocolExtra.HopInterval.IsNullOrEmpty()
|
||||
? protocolExtra.HopInterval
|
||||
: (config.HysteriaItem.HopInterval >= 5
|
||||
? config.HysteriaItem.HopInterval
|
||||
: (_config.HysteriaItem.HopInterval >= 5
|
||||
? _config.HysteriaItem.HopInterval
|
||||
: Global.Hysteria2DefaultHopInt).ToString();
|
||||
HysteriaUdpHop4Ray? udpHop = null;
|
||||
if (!ports.IsNullOrEmpty() &&
|
||||
|
|
@ -620,7 +615,7 @@ public partial class CoreConfigV2rayService
|
|||
streamSettings.hysteriaSettings = new()
|
||||
{
|
||||
version = 2,
|
||||
auth = node.Password,
|
||||
auth = _node.Password,
|
||||
up = upMbps > 0 ? $"{upMbps}mbps" : null,
|
||||
down = downMbps > 0 ? $"{downMbps}mbps" : null,
|
||||
udphop = udpHop,
|
||||
|
|
@ -641,13 +636,13 @@ public partial class CoreConfigV2rayService
|
|||
|
||||
default:
|
||||
//tcp
|
||||
if (node.HeaderType == Global.TcpHeaderHttp)
|
||||
if (_node.HeaderType == Global.TcpHeaderHttp)
|
||||
{
|
||||
TcpSettings4Ray tcpSettings = new()
|
||||
{
|
||||
header = new Header4Ray
|
||||
{
|
||||
type = node.HeaderType
|
||||
type = _node.HeaderType
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -681,7 +676,7 @@ public partial class CoreConfigV2rayService
|
|||
private List<Outbounds4Ray> BuildOutboundsList(string baseTagName = Global.ProxyTag)
|
||||
{
|
||||
var nodes = new List<ProfileItem>();
|
||||
foreach (var nodeId in Utils.String2List(context.Node.GetProtocolExtra().ChildItems) ?? [])
|
||||
foreach (var nodeId in Utils.String2List(_node.GetProtocolExtra().ChildItems) ?? [])
|
||||
{
|
||||
if (context.AllProxiesMap.TryGetValue(nodeId, out var node))
|
||||
{
|
||||
|
|
@ -710,7 +705,7 @@ public partial class CoreConfigV2rayService
|
|||
private List<Outbounds4Ray> BuildChainOutboundsList(string baseTagName = Global.ProxyTag)
|
||||
{
|
||||
var nodes = new List<ProfileItem>();
|
||||
foreach (var nodeId in Utils.String2List(context.Node.GetProtocolExtra().ChildItems) ?? [])
|
||||
foreach (var nodeId in Utils.String2List(_node.GetProtocolExtra().ChildItems) ?? [])
|
||||
{
|
||||
if (context.AllProxiesMap.TryGetValue(nodeId, out var node))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
if (_coreConfig.routing?.rules != null)
|
||||
{
|
||||
_coreConfig.routing.domainStrategy = context.AppConfig.RoutingBasicItem.DomainStrategy;
|
||||
_coreConfig.routing.domainStrategy = _config.RoutingBasicItem.DomainStrategy;
|
||||
|
||||
var routing = context.RoutingItem;
|
||||
if (routing != null)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
private void GenStatistic()
|
||||
{
|
||||
if (context.AppConfig.GuiItem.EnableStatistics || context.AppConfig.GuiItem.DisplayRealTimeSpeed)
|
||||
if (_config.GuiItem.EnableStatistics || _config.GuiItem.DisplayRealTimeSpeed)
|
||||
{
|
||||
var tag = EInboundProtocol.api.ToString();
|
||||
Metrics4Ray apiObj = new();
|
||||
|
|
|
|||
Loading…
Reference in a new issue