Fill sing-box server_name

This commit is contained in:
2dust 2023-05-21 14:35:18 +08:00
parent 82dea829f1
commit 9433213fe5

View file

@ -315,10 +315,19 @@ namespace v2rayN.Handler
{ {
if (node.streamSecurity == Global.StreamSecurityReality || node.streamSecurity == Global.StreamSecurity) if (node.streamSecurity == Global.StreamSecurityReality || node.streamSecurity == Global.StreamSecurity)
{ {
var server_name = string.Empty;
if (!string.IsNullOrWhiteSpace(node.sni))
{
server_name = node.sni;
}
else if (!string.IsNullOrWhiteSpace(node.requestHost))
{
server_name = Utils.String2List(node.requestHost)[0];
}
var tls = new Tls4Sbox() var tls = new Tls4Sbox()
{ {
enabled = true, enabled = true,
server_name = node.sni, server_name = server_name,
insecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? _config.coreBasicItem.defAllowInsecure.ToString().ToLower() : node.allowInsecure), insecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? _config.coreBasicItem.defAllowInsecure.ToString().ToLower() : node.allowInsecure),
alpn = node.GetAlpn(), alpn = node.GetAlpn(),
}; };