Add a NOT_READY return code
This commit is contained in:
parent
f9ec0a9c09
commit
daa1f3d3b1
|
@ -46,6 +46,7 @@ const (
|
||||||
PluginsReturnCodeNetworkError
|
PluginsReturnCodeNetworkError
|
||||||
PluginsReturnCodeCloak
|
PluginsReturnCodeCloak
|
||||||
PluginsReturnCodeServerTimeout
|
PluginsReturnCodeServerTimeout
|
||||||
|
PluginsReturnCodeNotReady
|
||||||
)
|
)
|
||||||
|
|
||||||
var PluginsReturnCodeToString = map[PluginsReturnCode]string{
|
var PluginsReturnCodeToString = map[PluginsReturnCode]string{
|
||||||
|
@ -61,6 +62,7 @@ var PluginsReturnCodeToString = map[PluginsReturnCode]string{
|
||||||
PluginsReturnCodeNetworkError: "NETWORK_ERROR",
|
PluginsReturnCodeNetworkError: "NETWORK_ERROR",
|
||||||
PluginsReturnCodeCloak: "CLOAK",
|
PluginsReturnCodeCloak: "CLOAK",
|
||||||
PluginsReturnCodeServerTimeout: "SERVER_TIMEOUT",
|
PluginsReturnCodeServerTimeout: "SERVER_TIMEOUT",
|
||||||
|
PluginsReturnCodeNotReady: "NOT_READY",
|
||||||
}
|
}
|
||||||
|
|
||||||
type PluginsState struct {
|
type PluginsState struct {
|
||||||
|
|
|
@ -716,7 +716,11 @@ func (proxy *Proxy) processIncomingQuery(clientProto string, serverProto string,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(response) < MinDNSPacketSize || len(response) > MaxDNSPacketSize {
|
if len(response) < MinDNSPacketSize || len(response) > MaxDNSPacketSize {
|
||||||
pluginsState.returnCode = PluginsReturnCodeParseError
|
if len(response) == 0 {
|
||||||
|
pluginsState.returnCode = PluginsReturnCodeNotReady
|
||||||
|
} else {
|
||||||
|
pluginsState.returnCode = PluginsReturnCodeParseError
|
||||||
|
}
|
||||||
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
|
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
|
||||||
if serverInfo != nil {
|
if serverInfo != nil {
|
||||||
serverInfo.noticeFailure(proxy)
|
serverInfo.noticeFailure(proxy)
|
||||||
|
|
Loading…
Reference in New Issue