mirror of
https://github.com/2dust/v2rayN.git
synced 2026-04-16 20:45:45 +00:00
Add hysteria2 uri cert sha pinning support
This commit is contained in:
parent
c42dcd2876
commit
8aaa2fec0b
1 changed files with 14 additions and 0 deletions
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue