use global 'timeout' option for forwarding queries (#1284)
* Update plugins.go * Update plugin_forward.go
This commit is contained in:
parent
4f41fc3fee
commit
f71244ed74
|
@ -93,7 +93,7 @@ func (plugin *PluginForward) Eval(pluginsState *PluginsState, msg *dns.Msg) erro
|
||||||
}
|
}
|
||||||
server := servers[rand.Intn(len(servers))]
|
server := servers[rand.Intn(len(servers))]
|
||||||
pluginsState.serverName = server
|
pluginsState.serverName = server
|
||||||
client := dns.Client{Net: pluginsState.serverProto}
|
client := dns.Client{Net: pluginsState.serverProto, Timeout: pluginsState.timeout}
|
||||||
respMsg, _, err := client.Exchange(msg, server)
|
respMsg, _, err := client.Exchange(msg, server)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -87,6 +87,7 @@ type PluginsState struct {
|
||||||
returnCode PluginsReturnCode
|
returnCode PluginsReturnCode
|
||||||
serverName string
|
serverName string
|
||||||
serverProto string
|
serverProto string
|
||||||
|
timeout time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
func (proxy *Proxy) InitPluginsGlobals() error {
|
func (proxy *Proxy) InitPluginsGlobals() error {
|
||||||
|
@ -240,6 +241,7 @@ func NewPluginsState(proxy *Proxy, clientProto string, clientAddr *net.Addr, ser
|
||||||
qName: "",
|
qName: "",
|
||||||
serverName: "-",
|
serverName: "-",
|
||||||
serverProto: serverProto,
|
serverProto: serverProto,
|
||||||
|
timeout: proxy.timeout,
|
||||||
requestStart: start,
|
requestStart: start,
|
||||||
maxUnencryptedUDPSafePayloadSize: MaxDNSUDPSafePacketSize,
|
maxUnencryptedUDPSafePayloadSize: MaxDNSUDPSafePacketSize,
|
||||||
sessionData: make(map[string]interface{}),
|
sessionData: make(map[string]interface{}),
|
||||||
|
|
Loading…
Reference in New Issue