1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 10:08:15 -05:00

Fix transportcommon.ListenWithSecuritySettings

This commit is contained in:
dyhkwong 2024-06-24 01:20:13 +08:00 committed by Xiaokang Wang (Shelikhoo)
parent 863479bb81
commit 66a81ecbf5

View File

@ -2,12 +2,14 @@ package transportcommon
import (
"context"
"crypto/tls"
"github.com/v2fly/v2ray-core/v5/common/environment"
"github.com/v2fly/v2ray-core/v5/common/environment/envctx"
"github.com/v2fly/v2ray-core/v5/common/net"
"github.com/v2fly/v2ray-core/v5/common/session"
"github.com/v2fly/v2ray-core/v5/transport/internet"
v2tls "github.com/v2fly/v2ray-core/v5/transport/internet/tls"
)
func ListenWithSecuritySettings(ctx context.Context, address net.Address, port net.Port, streamSettings *internet.MemoryStreamConfig) (
@ -43,5 +45,11 @@ func ListenWithSecuritySettings(ctx context.Context, address net.Address, port n
if streamSettings.SocketSettings != nil && streamSettings.SocketSettings.AcceptProxyProtocol {
newError("accepting PROXY protocol").AtWarning().WriteToLog(session.ExportIDToError(ctx))
}
if config := v2tls.ConfigFromStreamSettings(streamSettings); config != nil {
if tlsConfig := config.GetTLSConfig(); tlsConfig != nil {
l = tls.NewListener(l, tlsConfig)
}
}
return l, nil
}