mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-10-25 13:52:08 +00:00
Fix missing process info in hijacked DNS queries
This commit is contained in:
parent
097f784e7a
commit
a8091761d7
1 changed files with 3 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ import (
|
|||
)
|
||||
|
||||
func (r *Router) hijackDNSStream(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error {
|
||||
r.searchProcessInfo(ctx, &metadata)
|
||||
metadata.Destination = M.Socksaddr{}
|
||||
for {
|
||||
conn.SetReadDeadline(time.Now().Add(C.DNSTimeout))
|
||||
|
|
@ -33,6 +34,7 @@ func (r *Router) hijackDNSStream(ctx context.Context, conn net.Conn, metadata ad
|
|||
}
|
||||
|
||||
func (r *Router) hijackDNSPacket(ctx context.Context, conn N.PacketConn, packetBuffers []*N.PacketBuffer, metadata adapter.InboundContext, onClose N.CloseHandlerFunc) error {
|
||||
r.searchProcessInfo(ctx, &metadata)
|
||||
err := dnsOutbound.NewDNSPacketConnection(ctx, r.dns, conn, packetBuffers, metadata)
|
||||
N.CloseOnHandshakeFailure(conn, onClose, err)
|
||||
if err != nil && !E.IsClosedOrCanceled(err) {
|
||||
|
|
@ -48,6 +50,7 @@ func (r *Router) HijackDNSPacket(ctx context.Context, payload []byte, writer N.P
|
|||
r.logger.ErrorContext(ctx, E.Cause(err, "process DNS packet: unpack request"))
|
||||
return
|
||||
}
|
||||
r.searchProcessInfo(ctx, &metadata)
|
||||
destination := metadata.Destination
|
||||
metadata.Destination = M.Socksaddr{}
|
||||
r.dns.ExchangeAsync(adapter.WithContext(ctx, &metadata), &message, adapter.DNSQueryOptions{}, func(response *mDNS.Msg, exchangeErr error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue