From 06c0fbb65bf6a9d0637f6d0c6f0edb19a4e51a4b Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 17 Nov 2019 19:48:15 +0100 Subject: [PATCH] Add NETWORK_ERROR --- dnscrypt-proxy/plugins.go | 2 ++ dnscrypt-proxy/proxy.go | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dnscrypt-proxy/plugins.go b/dnscrypt-proxy/plugins.go index f830cae3..12af798c 100644 --- a/dnscrypt-proxy/plugins.go +++ b/dnscrypt-proxy/plugins.go @@ -43,6 +43,7 @@ const ( PluginsReturnCodeNXDomain PluginsReturnCodeResponseError PluginsReturnCodeServerError + PluginsReturnCodeNetworkError PluginsReturnCodeCloak PluginsReturnCodeServerTimeout ) @@ -57,6 +58,7 @@ var PluginsReturnCodeToString = map[PluginsReturnCode]string{ PluginsReturnCodeNXDomain: "NXDOMAIN", PluginsReturnCodeResponseError: "RESPONSE_ERROR", PluginsReturnCodeServerError: "SERVER_ERROR", + PluginsReturnCodeNetworkError: "NETWORK_ERROR", PluginsReturnCodeCloak: "CLOAK", PluginsReturnCodeServerTimeout: "SERVER_TIMEOUT", } diff --git a/dnscrypt-proxy/proxy.go b/dnscrypt-proxy/proxy.go index 58f9a27b..d9552da4 100644 --- a/dnscrypt-proxy/proxy.go +++ b/dnscrypt-proxy/proxy.go @@ -416,7 +416,7 @@ func (proxy *Proxy) processIncomingQuery(serverInfo *ServerInfo, clientProto str if neterr, ok := err.(net.Error); ok && neterr.Timeout() { pluginsState.returnCode = PluginsReturnCodeServerTimeout } else { - pluginsState.returnCode = PluginsReturnCodeServerError + pluginsState.returnCode = PluginsReturnCodeNetworkError } pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals) serverInfo.noticeFailure(proxy) @@ -429,14 +429,14 @@ func (proxy *Proxy) processIncomingQuery(serverInfo *ServerInfo, clientProto str resp, _, err := proxy.xTransport.DoHQuery(serverInfo.useGet, serverInfo.URL, query, proxy.timeout) SetTransactionID(query, tid) if err != nil { - pluginsState.returnCode = PluginsReturnCodeServerError + pluginsState.returnCode = PluginsReturnCodeNetworkError pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals) serverInfo.noticeFailure(proxy) return } response, err = ioutil.ReadAll(io.LimitReader(resp.Body, int64(MaxDNSPacketSize))) if err != nil { - pluginsState.returnCode = PluginsReturnCodeServerError + pluginsState.returnCode = PluginsReturnCodeNetworkError pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals) serverInfo.noticeFailure(proxy) return