mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-19 13:42:24 +00:00
Add Hy2 Port hopping URI support
This commit is contained in:
parent
438eaba4d5
commit
d1e25f6913
2 changed files with 15 additions and 1 deletions
|
@ -24,6 +24,8 @@ namespace ServiceLib.Handler.Fmt
|
|||
item.Path = Utils.UrlDecode(query["obfs-password"] ?? "");
|
||||
item.AllowInsecure = (query["insecure"] ?? "") == "1" ? "true" : "false";
|
||||
|
||||
item.Ports = Utils.UrlDecode(query["mport"] ?? "").Replace('-', ':');
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -53,6 +55,10 @@ namespace ServiceLib.Handler.Fmt
|
|||
dicQuery.Add("obfs-password", Utils.UrlEncode(item.Path));
|
||||
}
|
||||
dicQuery.Add("insecure", item.AllowInsecure.ToLower() == "true" ? "1" : "0");
|
||||
if (Utils.IsNotEmpty(item.Ports))
|
||||
{
|
||||
dicQuery.Add("mport", Utils.UrlEncode(item.Ports.Replace(':', '-')));
|
||||
}
|
||||
|
||||
return ToUri(EConfigType.Hysteria2, item.Address, item.Port, item.Id, dicQuery, remark);
|
||||
}
|
||||
|
|
|
@ -733,7 +733,15 @@ namespace ServiceLib.Services.CoreConfig
|
|||
if (node.Ports.IsNotEmpty())
|
||||
{
|
||||
outbound.server_port = null;
|
||||
outbound.server_ports = node.Ports.Split(",").ToList();
|
||||
outbound.server_ports = new List<string>();
|
||||
var ports = node.Ports.Split(',')
|
||||
.Select(p => p.Trim())
|
||||
.Where(p => !string.IsNullOrEmpty(p))
|
||||
.ToList();
|
||||
foreach (var it in ports)
|
||||
{
|
||||
outbound.server_ports.Add(it.Contains('-') ? it.Replace('-', ':') : it);
|
||||
}
|
||||
outbound.hop_interval = _config.HysteriaItem.HopInterval > 0 ? $"{_config.HysteriaItem.HopInterval}s" : null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue