mirror of
https://github.com/2dust/v2rayN.git
synced 2025-11-18 21:52:52 +00:00
Remove redundant string operation (#8324)
This commit is contained in:
parent
3f0bcf7b83
commit
4fb41aeca1
3 changed files with 5 additions and 5 deletions
|
|
@ -425,7 +425,7 @@ public class Utils
|
||||||
var domain = authority;
|
var domain = authority;
|
||||||
|
|
||||||
// Handle IPv6 addresses, e.g., "[2001:db8::1]:443"
|
// Handle IPv6 addresses, e.g., "[2001:db8::1]:443"
|
||||||
if (authority.StartsWith("[") && authority.Contains("]"))
|
if (authority.StartsWith('[') && authority.Contains(']'))
|
||||||
{
|
{
|
||||||
var closingBracketIndex = authority.LastIndexOf(']');
|
var closingBracketIndex = authority.LastIndexOf(']');
|
||||||
if (closingBracketIndex < authority.Length - 1 && authority[closingBracketIndex + 1] == ':')
|
if (closingBracketIndex < authority.Length - 1 && authority[closingBracketIndex + 1] == ':')
|
||||||
|
|
|
||||||
|
|
@ -45,18 +45,18 @@ public class SocksFmt : BaseFmt
|
||||||
};
|
};
|
||||||
result = result[Global.ProtocolShares[EConfigType.SOCKS].Length..];
|
result = result[Global.ProtocolShares[EConfigType.SOCKS].Length..];
|
||||||
//remark
|
//remark
|
||||||
var indexRemark = result.IndexOf("#");
|
var indexRemark = result.IndexOf('#');
|
||||||
if (indexRemark > 0)
|
if (indexRemark > 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
item.Remarks = Utils.UrlDecode(result.Substring(indexRemark + 1, result.Length - indexRemark - 1));
|
item.Remarks = Utils.UrlDecode(result.Substring(indexRemark + 1));
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
result = result[..indexRemark];
|
result = result[..indexRemark];
|
||||||
}
|
}
|
||||||
//part decode
|
//part decode
|
||||||
var indexS = result.IndexOf("@");
|
var indexS = result.IndexOf('@');
|
||||||
if (indexS > 0)
|
if (indexS > 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ public partial class CoreConfigSingboxService
|
||||||
|
|
||||||
private bool ParseV2Domain(string domain, Rule4Sbox rule)
|
private bool ParseV2Domain(string domain, Rule4Sbox rule)
|
||||||
{
|
{
|
||||||
if (domain.StartsWith("#") || domain.StartsWith("ext:") || domain.StartsWith("ext-domain:"))
|
if (domain.StartsWith('#') || domain.StartsWith("ext:") || domain.StartsWith("ext-domain:"))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue