|
@@ -17,7 +17,7 @@ import (
|
|
|
"github.com/v2fly/v2ray-core/v5/proxy"
|
|
"github.com/v2fly/v2ray-core/v5/proxy"
|
|
|
"github.com/v2fly/v2ray-core/v5/transport"
|
|
"github.com/v2fly/v2ray-core/v5/transport"
|
|
|
"github.com/v2fly/v2ray-core/v5/transport/internet"
|
|
"github.com/v2fly/v2ray-core/v5/transport/internet"
|
|
|
- "github.com/v2fly/v2ray-core/v5/transport/internet/tls"
|
|
|
|
|
|
|
+ "github.com/v2fly/v2ray-core/v5/transport/internet/security"
|
|
|
"github.com/v2fly/v2ray-core/v5/transport/pipe"
|
|
"github.com/v2fly/v2ray-core/v5/transport/pipe"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -182,9 +182,16 @@ func (h *Handler) Dial(ctx context.Context, dest net.Destination) (internet.Conn
|
|
|
go handler.Dispatch(ctx, &transport.Link{Reader: uplinkReader, Writer: downlinkWriter})
|
|
go handler.Dispatch(ctx, &transport.Link{Reader: uplinkReader, Writer: downlinkWriter})
|
|
|
conn := net.NewConnection(net.ConnectionInputMulti(uplinkWriter), net.ConnectionOutputMulti(downlinkReader))
|
|
conn := net.NewConnection(net.ConnectionInputMulti(uplinkWriter), net.ConnectionOutputMulti(downlinkReader))
|
|
|
|
|
|
|
|
- if config := tls.ConfigFromStreamSettings(h.streamSettings); config != nil {
|
|
|
|
|
- tlsConfig := config.GetTLSConfig(tls.WithDestination(dest))
|
|
|
|
|
- conn = tls.Client(conn, tlsConfig)
|
|
|
|
|
|
|
+ securityEngine, err := security.CreateSecurityEngineFromSettings(ctx, h.streamSettings)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return nil, newError("unable to create security engine").Base(err)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if securityEngine != nil {
|
|
|
|
|
+ conn, err = securityEngine.Client(conn)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return nil, newError("unable to create security protocol client from security engine").Base(err)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return h.getStatCouterConnection(conn), nil
|
|
return h.getStatCouterConnection(conn), nil
|