mirror of
https://github.com/2dust/v2rayN.git
synced 2026-04-18 05:25:46 +00:00
Update HttpFmt.cs
This commit is contained in:
parent
2428985e5a
commit
6e2cd1c23e
1 changed files with 8 additions and 3 deletions
|
|
@ -2,6 +2,11 @@ namespace ServiceLib.Handler.Fmt;
|
||||||
|
|
||||||
public class HttpFmt : BaseFmt
|
public class HttpFmt : BaseFmt
|
||||||
{
|
{
|
||||||
|
private static string NormalizeColon(string value)
|
||||||
|
{
|
||||||
|
return value.Replace(':', ':');
|
||||||
|
}
|
||||||
|
|
||||||
public static ProfileItem? Resolve(string str, out string msg)
|
public static ProfileItem? Resolve(string str, out string msg)
|
||||||
{
|
{
|
||||||
msg = ResUI.ConfigurationFormatIncorrect;
|
msg = ResUI.ConfigurationFormatIncorrect;
|
||||||
|
|
@ -36,17 +41,17 @@ public class HttpFmt : BaseFmt
|
||||||
var userInfo = string.Empty;
|
var userInfo = string.Empty;
|
||||||
if (item.Security.IsNotEmpty() && item.Id.IsNotEmpty())
|
if (item.Security.IsNotEmpty() && item.Id.IsNotEmpty())
|
||||||
{
|
{
|
||||||
userInfo = $"{item.Security}:{item.Id}";
|
userInfo = $"{NormalizeColon(item.Security)}:{NormalizeColon(item.Id)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
var protocol = item.StreamSecurity == "tls" ? "https://" : "http://";
|
var protocol = item.StreamSecurity == "tls" ? "https://" : "http://";
|
||||||
if (userInfo.IsNotEmpty())
|
if (userInfo.IsNotEmpty())
|
||||||
{
|
{
|
||||||
return $"{protocol}{Utils.UrlEncode(userInfo)}@{GetIpv6(item.Address)}:{item.Port}{remark}";
|
return $"{protocol}{Utils.UrlEncode(userInfo)}@{GetIpv6(NormalizeColon(item.Address))}:{item.Port}{remark}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $"{protocol}{GetIpv6(item.Address)}:{item.Port}{remark}";
|
return $"{protocol}{GetIpv6(NormalizeColon(item.Address))}:{item.Port}{remark}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue