mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-13 20:09:12 +00:00
Create the GetDomainFromProfile() function
This commit is contained in:
parent
bc90eb7eba
commit
9e21977acf
2 changed files with 15 additions and 20 deletions
|
@ -459,6 +459,19 @@ public class Utils
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string? GetDomainFromProfile(ProfileItem node)
|
||||||
|
{
|
||||||
|
if (IsDomain(node.Address))
|
||||||
|
{
|
||||||
|
return node.Address;
|
||||||
|
}
|
||||||
|
else if (node.Sni != null && IsDomain(node.Sni))
|
||||||
|
{
|
||||||
|
return node.Sni;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion 数据检查
|
#endregion 数据检查
|
||||||
|
|
||||||
#region 测速
|
#region 测速
|
||||||
|
|
|
@ -46,16 +46,7 @@ public partial class CoreConfigSingboxService
|
||||||
// Tun2SocksAddress
|
// Tun2SocksAddress
|
||||||
if (node != null)
|
if (node != null)
|
||||||
{
|
{
|
||||||
string? domainToAdd = null;
|
string? domainToAdd = Utils.GetDomainFromProfile(node);
|
||||||
|
|
||||||
if (Utils.IsDomain(node.Address))
|
|
||||||
{
|
|
||||||
domainToAdd = node.Address;
|
|
||||||
}
|
|
||||||
else if (node.Sni != null && Utils.IsDomain(node.Sni))
|
|
||||||
{
|
|
||||||
domainToAdd = node.Sni;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (domainToAdd != null)
|
if (domainToAdd != null)
|
||||||
{
|
{
|
||||||
|
@ -363,16 +354,7 @@ public partial class CoreConfigSingboxService
|
||||||
// Tun2SocksAddress
|
// Tun2SocksAddress
|
||||||
if (node != null)
|
if (node != null)
|
||||||
{
|
{
|
||||||
string? domainToAdd = null;
|
string? domainToAdd = Utils.GetDomainFromProfile(node);
|
||||||
|
|
||||||
if (Utils.IsDomain(node.Address))
|
|
||||||
{
|
|
||||||
domainToAdd = node.Address;
|
|
||||||
}
|
|
||||||
else if (node.Sni != null && Utils.IsDomain(node.Sni))
|
|
||||||
{
|
|
||||||
domainToAdd = node.Sni;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (domainToAdd != null)
|
if (domainToAdd != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue