From 5998358a5d5647987d75b82c9e53045ee3dc8cf9 Mon Sep 17 00:00:00 2001 From: wyx2685 Date: Sat, 18 Nov 2023 11:59:58 +0900 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E5=8C=96=E9=9D=A2=E6=9D=BFREALITY?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/panel/node.go | 1 + core/sing/node.go | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/api/panel/node.go b/api/panel/node.go index c89caad..1dc0071 100644 --- a/api/panel/node.go +++ b/api/panel/node.go @@ -74,6 +74,7 @@ type VAllssNode struct { type TlsSettings struct { ServerName string `json:"server_name"` + Dest string `json:"dest"` ServerPort string `json:"server_port"` ShortId string `json:"short_id"` PrivateKey string `json:"private_key"` diff --git a/core/sing/node.go b/core/sing/node.go index a218f6c..9c83ffb 100644 --- a/core/sing/node.go +++ b/core/sing/node.go @@ -61,7 +61,14 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio tls.Enabled = true v := info.VAllss tls.ServerName = v.TlsSettings.ServerName - dest, _ := strconv.Atoi(v.TlsSettings.ServerPort) + port, _ := strconv.Atoi(v.TlsSettings.ServerPort) + var dest string + if v.TlsSettings.Dest != "" { + dest = v.TlsSettings.Dest + } else { + dest = tls.ServerName + } + mtd, _ := time.ParseDuration(v.RealityConfig.MaxTimeDiff) tls.Reality = &option.InboundRealityOptions{ Enabled: true, @@ -69,8 +76,8 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio PrivateKey: v.TlsSettings.PrivateKey, Handshake: option.InboundRealityHandshakeOptions{ ServerOptions: option.ServerOptions{ - Server: tls.ServerName, - ServerPort: uint16(dest), + Server: dest, + ServerPort: uint16(port), }, }, MaxTimeDifference: option.Duration(mtd),