mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-01-01 00:57:32 +01:00
Add NETWORK_ERROR
This commit is contained in:
parent
ca7e5e5bcb
commit
06c0fbb65b
@ -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",
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user