fix: set sni to servername if not specified for trojan outbound (#1991)

This commit is contained in:
WeidiDeng 2025-04-24 19:50:16 +08:00 committed by GitHub
parent 5dce957755
commit 468cfc3cc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -295,6 +295,10 @@ func (t *Trojan) Close() error {
func NewTrojan(option TrojanOption) (*Trojan, error) { func NewTrojan(option TrojanOption) (*Trojan, error) {
addr := net.JoinHostPort(option.Server, strconv.Itoa(option.Port)) addr := net.JoinHostPort(option.Server, strconv.Itoa(option.Port))
if option.SNI == "" {
option.SNI = option.Server
}
t := &Trojan{ t := &Trojan{
Base: &Base{ Base: &Base{
name: option.Name, name: option.Name,