mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 09:18:34 +00:00
Unify dns log
This commit is contained in:
parent
2b46178ff9
commit
5e323958b6
6 changed files with 42 additions and 31 deletions
|
@ -15,7 +15,6 @@ import (
|
|||
"github.com/xtls/xray-core/common/session"
|
||||
"github.com/xtls/xray-core/common/signal/pubsub"
|
||||
"github.com/xtls/xray-core/common/task"
|
||||
"github.com/xtls/xray-core/core"
|
||||
dns_feature "github.com/xtls/xray-core/features/dns"
|
||||
"github.com/xtls/xray-core/features/routing"
|
||||
"github.com/xtls/xray-core/transport/internet/udp"
|
||||
|
@ -195,21 +194,7 @@ func (s *ClassicNameServer) sendQuery(ctx context.Context, domain string, client
|
|||
for _, req := range reqs {
|
||||
s.addPendingRequest(req)
|
||||
b, _ := dns.PackMessage(req.msg)
|
||||
udpCtx := core.ToBackgroundDetachedContext(ctx)
|
||||
if inbound := session.InboundFromContext(ctx); inbound != nil {
|
||||
udpCtx = session.ContextWithInbound(udpCtx, inbound)
|
||||
}
|
||||
|
||||
udpCtx = session.ContextWithContent(udpCtx, &session.Content{
|
||||
Protocol: "dns",
|
||||
})
|
||||
udpCtx = log.ContextWithAccessMessage(udpCtx, &log.AccessMessage{
|
||||
From: "DNS",
|
||||
To: s.address,
|
||||
Status: log.AccessAccepted,
|
||||
Reason: "",
|
||||
})
|
||||
s.udpServer.Dispatch(udpCtx, *s.address, b)
|
||||
s.udpServer.Dispatch(toDnsContext(ctx, s.address.String()), *s.address, b)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue