mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
Update V2rayConfigUtils.cs TrojanController.cs: sni
This commit is contained in:
@@ -29,7 +29,7 @@ namespace Netch.Servers.Trojan
|
||||
{
|
||||
local_addr = this.LocalAddress(),
|
||||
local_port = this.Socks5LocalPort(),
|
||||
remote_addr = server.Hostname,
|
||||
remote_addr = server.AutoResolveHostname(),
|
||||
remote_port = server.Port,
|
||||
password = new List<string>
|
||||
{
|
||||
@@ -37,8 +37,11 @@ namespace Netch.Servers.Trojan
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(server.Host))
|
||||
trojanConfig.ssl.sni = server.Host;
|
||||
else if (Global.Settings.ResolveServerHostname)
|
||||
trojanConfig.ssl.sni = server.Hostname;
|
||||
|
||||
File.WriteAllBytes(Constants.TempConfig, JsonSerializer.SerializeToUtf8Bytes(trojanConfig, Global.NewDefaultJsonSerializerOptions));
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Netch.Models;
|
||||
using Netch.Servers.V2ray.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using Netch.Enums;
|
||||
using Netch.Models;
|
||||
using Netch.Servers.V2ray.Models;
|
||||
using V2rayConfig = Netch.Servers.V2ray.Models.V2rayConfig;
|
||||
|
||||
namespace Netch.Servers.V2ray.Utils
|
||||
@@ -241,10 +241,14 @@ namespace Netch.Servers.V2ray.Utils
|
||||
{
|
||||
var tlsSettings = new TlsSettings
|
||||
{
|
||||
allowInsecure = Global.Settings.V2RayConfig.AllowInsecure,
|
||||
serverName = !string.IsNullOrWhiteSpace(server.Host) ? server.Host : null
|
||||
allowInsecure = Global.Settings.V2RayConfig.AllowInsecure
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(server.Host))
|
||||
tlsSettings.serverName = server.Host;
|
||||
else if (Global.Settings.ResolveServerHostname)
|
||||
tlsSettings.serverName = server.Hostname;
|
||||
|
||||
switch (server.TLSSecureType)
|
||||
{
|
||||
case "tls":
|
||||
|
||||
Reference in New Issue
Block a user