mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-18 08:13:02 +00:00
Add xray v26.1.31 finalmask support (#8732)
* Add xray v26.1.31 hysteria2 support * Add xray v26.1.31 mkcp support
This commit is contained in:
parent
c7afef3d70
commit
fdde837698
3 changed files with 56 additions and 19 deletions
|
|
@ -288,6 +288,16 @@ public class Global
|
|||
"dns"
|
||||
];
|
||||
|
||||
public static readonly Dictionary<string, string> KcpHeaderMaskMap = new()
|
||||
{
|
||||
{ "srtp", "header-srtp" },
|
||||
{ "utp", "header-utp" },
|
||||
{ "wechat-video", "header-wechat" },
|
||||
{ "dtls", "header-dtls" },
|
||||
{ "wireguard", "header-wireguard" },
|
||||
{ "dns", "header-dns" }
|
||||
};
|
||||
|
||||
public static readonly List<string> CoreTypes =
|
||||
[
|
||||
"Xray",
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ public class StreamSettings4Ray
|
|||
|
||||
public HysteriaSettings4Ray? hysteriaSettings { get; set; }
|
||||
|
||||
public List<UdpMasks4Ray>? udpmasks { get; set; }
|
||||
public FinalMask4Ray? finalmask { get; set; }
|
||||
|
||||
public Sockopt4Ray? sockopt { get; set; }
|
||||
}
|
||||
|
|
@ -388,8 +388,6 @@ public class Header4Ray
|
|||
public object request { get; set; }
|
||||
|
||||
public object response { get; set; }
|
||||
|
||||
public string? domain { get; set; }
|
||||
}
|
||||
|
||||
public class KcpSettings4Ray
|
||||
|
|
@ -407,10 +405,6 @@ public class KcpSettings4Ray
|
|||
public int readBufferSize { get; set; }
|
||||
|
||||
public int writeBufferSize { get; set; }
|
||||
|
||||
public Header4Ray header { get; set; }
|
||||
|
||||
public string seed { get; set; }
|
||||
}
|
||||
|
||||
public class WsSettings4Ray
|
||||
|
|
@ -484,15 +478,22 @@ public class HysteriaUdpHop4Ray
|
|||
public int? interval { get; set; }
|
||||
}
|
||||
|
||||
public class UdpMasks4Ray
|
||||
public class FinalMask4Ray
|
||||
{
|
||||
public string type { get; set; }
|
||||
public UdpMasksSettings4Ray? settings { get; set; }
|
||||
public List<Mask4Ray>? tcp { get; set; }
|
||||
public List<Mask4Ray>? udp { get; set; }
|
||||
}
|
||||
|
||||
public class UdpMasksSettings4Ray
|
||||
public class Mask4Ray
|
||||
{
|
||||
public string type { get; set; }
|
||||
public MaskSettings4Ray? settings { get; set; }
|
||||
}
|
||||
|
||||
public class MaskSettings4Ray
|
||||
{
|
||||
public string? password { get; set; }
|
||||
public string? domain { get; set; }
|
||||
}
|
||||
|
||||
public class AccountsItem4Ray
|
||||
|
|
|
|||
|
|
@ -365,14 +365,33 @@ public partial class CoreConfigV2rayService
|
|||
kcpSettings.congestion = _config.KcpItem.Congestion;
|
||||
kcpSettings.readBufferSize = _config.KcpItem.ReadBufferSize;
|
||||
kcpSettings.writeBufferSize = _config.KcpItem.WriteBufferSize;
|
||||
kcpSettings.header = new Header4Ray
|
||||
streamSettings.finalmask ??= new();
|
||||
if (Global.KcpHeaderMaskMap.TryGetValue(node.HeaderType, out var header))
|
||||
{
|
||||
type = node.HeaderType,
|
||||
domain = host.NullIfEmpty()
|
||||
};
|
||||
if (path.IsNotEmpty())
|
||||
streamSettings.finalmask.udp =
|
||||
[
|
||||
new Mask4Ray
|
||||
{
|
||||
kcpSettings.seed = path;
|
||||
type = header,
|
||||
settings = node.HeaderType == "dns" && !host.IsNullOrEmpty() ? new MaskSettings4Ray { domain = host } : null
|
||||
}
|
||||
];
|
||||
}
|
||||
streamSettings.finalmask.udp ??= [];
|
||||
if (path.IsNullOrEmpty())
|
||||
{
|
||||
streamSettings.finalmask.udp.Add(new Mask4Ray
|
||||
{
|
||||
type = "mkcp-original"
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
streamSettings.finalmask.udp.Add(new Mask4Ray
|
||||
{
|
||||
type = "mkcp-aes128gcm",
|
||||
settings = new MaskSettings4Ray { password = path }
|
||||
});
|
||||
}
|
||||
streamSettings.kcpSettings = kcpSettings;
|
||||
break;
|
||||
|
|
@ -513,8 +532,15 @@ public partial class CoreConfigV2rayService
|
|||
streamSettings.hysteriaSettings = hysteriaSettings;
|
||||
if (node.Path.IsNotEmpty())
|
||||
{
|
||||
streamSettings.udpmasks =
|
||||
[new() { type = "salamander", settings = new() { password = node.Path.TrimEx(), } }];
|
||||
streamSettings.finalmask ??= new();
|
||||
streamSettings.finalmask.udp =
|
||||
[
|
||||
new Mask4Ray
|
||||
{
|
||||
type = "salamander",
|
||||
settings = new MaskSettings4Ray { password = node.Path.TrimEx(), }
|
||||
}
|
||||
];
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue