Skip to content

Commit

Permalink
Merge pull request #5066 from sincereliu/master
Browse files Browse the repository at this point in the history
Optimize code for better performance
  • Loading branch information
2dust committed May 6, 2024
2 parents 60068d8 + 5fe468f commit e223b80
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions v2rayN/v2rayN/Handler/ShareHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,19 +266,10 @@ private static string GetIpv6(string address)
{
if (Utils.IsIpv6(address))
{
if (address.StartsWith('[') && address.EndsWith(']'))
{
return address;
}
else
{
return $"[{address}]";
}
}
else
{
return address;
// 检查地址是否已经被方括号包围,如果没有,则添加方括号
return address.StartsWith('[') && address.EndsWith(']') ? address : $"[{address}]";
}
return address; // 如果不是IPv6地址,直接返回原地址
}

private static int GetStdTransport(ProfileItem item, string? securityDef, ref Dictionary<string, string> dicQuery)
Expand Down

0 comments on commit e223b80

Please sign in to comment.