|
|
@@ -8,6 +8,7 @@ import (
|
|
|
"github.com/v2fly/v2ray-core/v5/common"
|
|
|
"github.com/v2fly/v2ray-core/v5/common/mux"
|
|
|
"github.com/v2fly/v2ray-core/v5/common/net"
|
|
|
+ "github.com/v2fly/v2ray-core/v5/common/net/packetaddr"
|
|
|
"github.com/v2fly/v2ray-core/v5/common/serial"
|
|
|
"github.com/v2fly/v2ray-core/v5/common/session"
|
|
|
"github.com/v2fly/v2ray-core/v5/features/outbound"
|
|
|
@@ -208,6 +209,15 @@ func (h *Handler) Dial(ctx context.Context, dest net.Destination) (internet.Conn
|
|
|
ctx = session.SetTransportLayerProxyTagToContext(ctx, tag)
|
|
|
}
|
|
|
|
|
|
+ if isStream, err := packetaddr.GetDestinationSubsetOf(dest); err == nil {
|
|
|
+ packetConn, err := internet.ListenSystemPacket(ctx, nil, h.streamSettings.SocketSettings)
|
|
|
+ if err != nil {
|
|
|
+ return nil, newError("unable to listen socket").Base(err)
|
|
|
+ }
|
|
|
+ conn := packetaddr.ToPacketAddrConnWrapper(packetConn, isStream)
|
|
|
+ return h.getStatCouterConnection(conn), nil
|
|
|
+ }
|
|
|
+
|
|
|
conn, err := internet.Dial(ctx, dest, h.streamSettings)
|
|
|
return h.getStatCouterConnection(conn), err
|
|
|
}
|