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
+9
View File
@@ -201,5 +201,14 @@ namespace ServiceLib.Handler.Fmt
File.WriteAllText(fileName, strData);
return fileName;
}
protected static string ToUri(EConfigType eConfigType, string address, object port, string userInfo, Dictionary<string, string>? dicQuery, string? remark)
{
var query = dicQuery != null
? ("?" + string.Join("&", dicQuery.Select(x => x.Key + "=" + x.Value).ToArray()))
: string.Empty;
var url = $"{Utils.UrlEncode(userInfo)}@{GetIpv6(address)}:{port}";
return $"{Global.ProtocolShares[eConfigType]}{url}{query}{remark}";
}
}
}