Improved share Uri

https://github.com/2dust/v2rayN/issues/5807
This commit is contained in:
2dust
2024-10-15 11:02:17 +08:00
parent fd7cf164ff
commit e96c9abd69
8 changed files with 22 additions and 49 deletions
+3 -9
View File
@@ -16,7 +16,8 @@
item.address = url.IdnHost;
item.port = url.Port;
item.remarks = url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
var userInfoParts = url.UserInfo.Split(new[] { ':' }, 2);
var rawUserInfo = Utils.UrlDecode(url.UserInfo);
var userInfoParts = rawUserInfo.Split(new[] { ':' }, 2);
if (userInfoParts.Length == 2)
{
item.id = userInfoParts[0];
@@ -51,14 +52,7 @@
}
dicQuery.Add("congestion_control", item.headerType);
string query = "?" + string.Join("&", dicQuery.Select(x => x.Key + "=" + x.Value).ToArray());
url = string.Format("{0}@{1}:{2}",
$"{item.id}:{item.security}",
GetIpv6(item.address),
item.port);
url = $"{Global.ProtocolShares[EConfigType.TUIC]}{url}{query}{remark}";
return url;
return ToUri(EConfigType.TUIC, item.address, item.port, $"{item.id}:{item.security}", dicQuery, remark);
}
}
}