Check destination before udp connect

This commit is contained in:
Skyxim 2022-10-19 10:20:13 +08:00 committed by 世界
parent 92a92f39c5
commit 6a26737508
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -79,8 +79,10 @@ func NewEarlyConnection(ctx context.Context, this N.Dialer, conn net.Conn, metad
func NewPacketConnection(ctx context.Context, this N.Dialer, conn N.PacketConn, metadata adapter.InboundContext) error {
switch metadata.Protocol {
case C.ProtocolQUIC, C.ProtocolDNS:
if !metadata.Destination.Addr.IsUnspecified() {
return connectPacketConnection(ctx, this, conn, metadata)
}
}
ctx = adapter.WithContext(ctx, &metadata)
var outConn net.PacketConn
var err error