diff --git a/sub/subService.go b/sub/subService.go index 336d2956..3b5820d7 100644 --- a/sub/subService.go +++ b/sub/subService.go @@ -214,11 +214,12 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string { } obj["alpn"] = strings.Join(alpn, ",") } + if sniValue, ok := searchKey(tlsSetting, "serverName"); ok { + obj["sni"], _ = sniValue.(string) + } + tlsSettings, _ := searchKey(tlsSetting, "settings") if tlsSetting != nil { - if sniValue, ok := searchKey(tlsSettings, "serverName"); ok { - obj["sni"], _ = sniValue.(string) - } if fpValue, ok := searchKey(tlsSettings, "fingerprint"); ok { obj["fp"], _ = fpValue.(string) } @@ -226,10 +227,6 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string { obj["allowInsecure"], _ = insecure.(bool) } } - serverName, _ := tlsSetting["serverName"].(string) - if serverName != "" { - obj["add"] = serverName - } } clients, _ := s.inboundService.GetClients(inbound) @@ -356,11 +353,12 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string { if len(alpn) > 0 { params["alpn"] = strings.Join(alpn, ",") } + if sniValue, ok := searchKey(tlsSetting, "serverName"); ok { + params["sni"], _ = sniValue.(string) + } + tlsSettings, _ := searchKey(tlsSetting, "settings") if tlsSetting != nil { - if sniValue, ok := searchKey(tlsSettings, "serverName"); ok { - params["sni"], _ = sniValue.(string) - } if fpValue, ok := searchKey(tlsSettings, "fingerprint"); ok { params["fp"], _ = fpValue.(string) } @@ -374,11 +372,6 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string { if streamNetwork == "tcp" && len(clients[clientIndex].Flow) > 0 { params["flow"] = clients[clientIndex].Flow } - - serverName, _ := tlsSetting["serverName"].(string) - if serverName != "" { - address = serverName - } } if security == "reality" { @@ -550,11 +543,12 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string if len(alpn) > 0 { params["alpn"] = strings.Join(alpn, ",") } + if sniValue, ok := searchKey(tlsSetting, "serverName"); ok { + params["sni"], _ = sniValue.(string) + } + tlsSettings, _ := searchKey(tlsSetting, "settings") if tlsSetting != nil { - if sniValue, ok := searchKey(tlsSettings, "serverName"); ok { - params["sni"], _ = sniValue.(string) - } if fpValue, ok := searchKey(tlsSettings, "fingerprint"); ok { params["fp"], _ = fpValue.(string) } @@ -564,11 +558,6 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string } } } - - serverName, _ := tlsSetting["serverName"].(string) - if serverName != "" { - address = serverName - } } if security == "reality" { diff --git a/web/assets/js/model/xray.js b/web/assets/js/model/xray.js index 85cd7e5a..88920dd0 100644 --- a/web/assets/js/model/xray.js +++ b/web/assets/js/model/xray.js @@ -461,7 +461,7 @@ class TlsStreamSettings extends XrayCommonClass { alpn=[], settings=new TlsStreamSettings.Settings()) { super(); - this.server = serverName; + this.sni = serverName; this.minVersion = minVersion; this.maxVersion = maxVersion; this.cipherSuites = cipherSuites; @@ -503,7 +503,7 @@ class TlsStreamSettings extends XrayCommonClass { toJson() { return { - serverName: this.server, + serverName: this.sni, minVersion: this.minVersion, maxVersion: this.maxVersion, cipherSuites: this.cipherSuites, @@ -562,24 +562,21 @@ TlsStreamSettings.Cert = class extends XrayCommonClass { }; TlsStreamSettings.Settings = class extends XrayCommonClass { - constructor(allowInsecure = false, fingerprint = '', serverName = '', domains = []) { + constructor(allowInsecure = false, fingerprint = '') { super(); this.allowInsecure = allowInsecure; this.fingerprint = fingerprint; - this.serverName = serverName; } static fromJson(json = {}) { return new TlsStreamSettings.Settings( json.allowInsecure, json.fingerprint, - json.serverName, ); } toJson() { return { allowInsecure: this.allowInsecure, fingerprint: this.fingerprint, - serverName: this.serverName, }; } }; @@ -1054,11 +1051,8 @@ class Inbound extends XrayCommonClass { } if (security === 'tls') { - if (address == this.listen && port == this.port && !ObjectUtil.isEmpty(this.stream.tls.server)) { - obj.add = this.stream.tls.server; - } - if (!ObjectUtil.isEmpty(this.stream.tls.settings.serverName)){ - obj.sni = this.stream.tls.settings.serverName; + if (!ObjectUtil.isEmpty(this.stream.tls.sni)){ + obj.sni = this.stream.tls.sni; } if (!ObjectUtil.isEmpty(this.stream.tls.settings.fingerprint)){ obj.fp = this.stream.tls.settings.fingerprint; @@ -1136,11 +1130,8 @@ class Inbound extends XrayCommonClass { if(this.stream.tls.settings.allowInsecure){ params.set("allowInsecure", "1"); } - if (!ObjectUtil.isEmpty(this.stream.tls.server)) { - address = this.stream.tls.server; - } - if (this.stream.tls.settings.serverName !== ''){ - params.set("sni", this.stream.tls.settings.serverName); + if (!ObjectUtil.isEmpty(this.stream.tls.sni)){ + params.set("sni", this.stream.tls.sni); } if (type == "tcp" && !ObjectUtil.isEmpty(flow)) { params.set("flow", flow); @@ -1158,9 +1149,6 @@ class Inbound extends XrayCommonClass { if (this.stream.reality.shortIds.length > 0) { params.set("sid", this.stream.reality.shortIds.split(",")[0]); } - if (address == this.listen && port == this.port && !ObjectUtil.isEmpty(this.stream.reality.settings.serverName)) { - address = this.stream.reality.settings.serverName; - } if (!ObjectUtil.isEmpty(this.stream.reality.settings.spiderX)) { params.set("spx", this.stream.reality.settings.spiderX); } @@ -1305,11 +1293,8 @@ class Inbound extends XrayCommonClass { if(this.stream.tls.settings.allowInsecure){ params.set("allowInsecure", "1"); } - if (address == this.listen && port == this.port && !ObjectUtil.isEmpty(this.stream.tls.server)) { - address = this.stream.tls.server; - } - if (this.stream.tls.settings.serverName !== ''){ - params.set("sni", this.stream.tls.settings.serverName); + if (!ObjectUtil.isEmpty(this.stream.tls.sni)){ + params.set("sni", this.stream.tls.sni); } } } @@ -1324,9 +1309,6 @@ class Inbound extends XrayCommonClass { if (this.stream.reality.shortIds.length > 0) { params.set("sid", this.stream.reality.shortIds.split(",")[0]); } - if (address == this.listen && port == this.port && !ObjectUtil.isEmpty(this.stream.reality.settings.serverName)) { - address = this.stream.reality.settings.serverName; - } if (!ObjectUtil.isEmpty(this.stream.reality.settings.spiderX)) { params.set("spx", this.stream.reality.settings.spiderX); } diff --git a/web/html/xui/form/tls_settings.html b/web/html/xui/form/tls_settings.html index 3e4781fe..f56fa0dc 100644 --- a/web/html/xui/form/tls_settings.html +++ b/web/html/xui/form/tls_settings.html @@ -21,7 +21,7 @@