mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-09 14:05:00 +03:00
Add hysteria2 uri cert sha pinning support (#8657)
This commit is contained in:
@@ -25,6 +25,10 @@ public class Hysteria2Fmt : BaseFmt
|
|||||||
ResolveUriQuery(query, ref item);
|
ResolveUriQuery(query, ref item);
|
||||||
item.Path = GetQueryDecoded(query, "obfs-password");
|
item.Path = GetQueryDecoded(query, "obfs-password");
|
||||||
item.Ports = GetQueryDecoded(query, "mport");
|
item.Ports = GetQueryDecoded(query, "mport");
|
||||||
|
if (item.CertSha.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
item.CertSha = GetQueryDecoded(query, "pinSHA256");
|
||||||
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@@ -55,6 +59,16 @@ public class Hysteria2Fmt : BaseFmt
|
|||||||
{
|
{
|
||||||
dicQuery.Add("mport", Utils.UrlEncode(item.Ports.Replace(':', '-')));
|
dicQuery.Add("mport", Utils.UrlEncode(item.Ports.Replace(':', '-')));
|
||||||
}
|
}
|
||||||
|
if (!item.CertSha.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
var sha = item.CertSha;
|
||||||
|
var idx = sha.IndexOf('~');
|
||||||
|
if (idx > 0)
|
||||||
|
{
|
||||||
|
sha = sha[..idx];
|
||||||
|
}
|
||||||
|
dicQuery.Add("pinSHA256", Utils.UrlEncode(sha));
|
||||||
|
}
|
||||||
|
|
||||||
return ToUri(EConfigType.Hysteria2, item.Address, item.Port, item.Id, dicQuery, remark);
|
return ToUri(EConfigType.Hysteria2, item.Address, item.Port, item.Id, dicQuery, remark);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user