mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-20 07:04:08 +00:00
merge log into common log
This commit is contained in:
45 files changed
+297
-406
No files matched your search
@@ -7,7 +7,6 @@ import (
|
||||
|
||||
"github.com/miekg/dns"
|
||||
"v2ray.com/core/app/dispatcher"
|
||||
"v2ray.com/core/app/log"
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/dice"
|
||||
@@ -88,7 +87,7 @@ func (s *UDPNameServer) AssignUnusedID(response chan<- *ARecord) uint16 {
|
||||
if _, found := s.requests[id]; found {
|
||||
continue
|
||||
}
|
||||
log.Trace(newError("add pending request id ", id).AtDebug())
|
||||
newError("add pending request id ", id).AtDebug().WriteToLog()
|
||||
s.requests[id] = &PendingRequest{
|
||||
expire: time.Now().Add(time.Second * 8),
|
||||
response: response,
|
||||
@@ -103,9 +102,9 @@ func (s *UDPNameServer) HandleResponse(payload *buf.Buffer) {
|
||||
msg := new(dns.Msg)
|
||||
err := msg.Unpack(payload.Bytes())
|
||||
if err == dns.ErrTruncated {
|
||||
log.Trace(newError("truncated message received. DNS server should still work. If you see anything abnormal, please submit an issue to v2ray-core.").AtWarning())
|
||||
newError("truncated message received. DNS server should still work. If you see anything abnormal, please submit an issue to v2ray-core.").AtWarning().WriteToLog()
|
||||
} else if err != nil {
|
||||
log.Trace(newError("failed to parse DNS response").Base(err).AtWarning())
|
||||
newError("failed to parse DNS response").Base(err).AtWarning().WriteToLog()
|
||||
return
|
||||
}
|
||||
record := &ARecord{
|
||||
@@ -113,7 +112,7 @@ func (s *UDPNameServer) HandleResponse(payload *buf.Buffer) {
|
||||
}
|
||||
id := msg.Id
|
||||
ttl := uint32(3600) // an hour
|
||||
log.Trace(newError("handling response for id ", id, " content: ", msg).AtDebug())
|
||||
newError("handling response for id ", id, " content: ", msg).AtDebug().WriteToLog()
|
||||
|
||||
s.Lock()
|
||||
request, found := s.requests[id]
|
||||
@@ -206,7 +205,7 @@ func (*LocalNameServer) QueryA(domain string) <-chan *ARecord {
|
||||
|
||||
ips, err := net.LookupIP(domain)
|
||||
if err != nil {
|
||||
log.Trace(newError("failed to lookup IPs for domain ", domain).Base(err))
|
||||
newError("failed to lookup IPs for domain ", domain).Base(err).WriteToLog()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"v2ray.com/core/app"
|
||||
"v2ray.com/core/app/dispatcher"
|
||||
"v2ray.com/core/app/dns"
|
||||
"v2ray.com/core/app/log"
|
||||
"v2ray.com/core/common"
|
||||
"v2ray.com/core/common/net"
|
||||
)
|
||||
@@ -144,13 +143,13 @@ func (s *CacheServer) Get(domain string) []net.IP {
|
||||
LastAccess: time.Now(),
|
||||
}
|
||||
s.Unlock()
|
||||
log.Trace(newError("returning ", len(a.IPs), " IPs for domain ", domain).AtDebug())
|
||||
newError("returning ", len(a.IPs), " IPs for domain ", domain).AtDebug().WriteToLog()
|
||||
return a.IPs
|
||||
case <-time.After(QueryTimeout):
|
||||
}
|
||||
}
|
||||
|
||||
log.Trace(newError("returning nil for domain ", domain).AtDebug())
|
||||
newError("returning nil for domain ", domain).AtDebug().WriteToLog()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user