mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-01-14 02:25:52 +01:00
Log whether response was served from cache
This commit is contained in:
parent
af096f8488
commit
14b464e56d
@ -132,6 +132,7 @@ func (plugin *PluginCache) Eval(pluginsState *PluginsState, msg *dns.Msg) error
|
||||
synth.Question = msg.Question
|
||||
pluginsState.synthResponse = &synth
|
||||
pluginsState.action = PluginsActionSynth
|
||||
pluginsState.cacheHit = true
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -84,8 +84,8 @@ func (plugin *PluginQueryLog) Eval(pluginsState *PluginsState, msg *dns.Msg) err
|
||||
tsStr := fmt.Sprintf("[%d-%02d-%02d %02d:%02d:%02d]", year, int(month), day, hour, minute, second)
|
||||
line = fmt.Sprintf("%s\t%s\t%s\t%s\t%s\t%d\n", tsStr, clientIPStr, StringQuote(qName), qType, returnCode, requestDuration/time.Millisecond)
|
||||
} else if plugin.format == "ltsv" {
|
||||
line = fmt.Sprintf("time:%d\thost:%s\tmessage:%s\ttype:%s\treturn:%s\tduration:%d\n",
|
||||
time.Now().Unix(), clientIPStr, StringQuote(qName), qType, returnCode, requestDuration/time.Millisecond)
|
||||
line = fmt.Sprintf("time:%d\thost:%s\tmessage:%s\ttype:%s\treturn:%s\tcacheHit:%v\tduration:%d\n",
|
||||
time.Now().Unix(), clientIPStr, StringQuote(qName), qType, returnCode, pluginsState.cacheHit, requestDuration/time.Millisecond)
|
||||
} else {
|
||||
dlog.Fatalf("Unexpected log format: [%s]", plugin.format)
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ type PluginsState struct {
|
||||
questionMsg *dns.Msg
|
||||
requestStart time.Time
|
||||
requestEnd time.Time
|
||||
cacheHit bool
|
||||
returnCode PluginsReturnCode
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user