Fix dns inbound

This commit is contained in:
世界 2022-07-22 14:25:04 +08:00
parent e5e24ef51d
commit e531e89b4b
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -49,7 +49,10 @@ func (d *DNS) NewConnection(ctx context.Context, conn net.Conn, metadata adapter
func (d *DNS) NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, metadata adapter.InboundContext) error { func (d *DNS) NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, metadata adapter.InboundContext) error {
d.udpNat.NewContextPacket(ctx, metadata.Source.AddrPort(), buffer, adapter.UpstreamMetadata(metadata), func(natConn N.PacketConn) (context.Context, N.PacketWriter) { d.udpNat.NewContextPacket(ctx, metadata.Source.AddrPort(), buffer, adapter.UpstreamMetadata(metadata), func(natConn N.PacketConn) (context.Context, N.PacketWriter) {
return adapter.WithContext(log.ContextWithNewID(ctx), &metadata), natConn return adapter.WithContext(log.ContextWithNewID(ctx), &metadata), &udpnat.DirectBackWriter{
Source: conn,
Nat: natConn,
}
}) })
return nil return nil
} }