mirror of
https://github.com/coredns/coredns.git
synced 2026-08-20 23:08:28 -04:00
plugin/timeouts: add maxtcpqueries option to bound queries per TCP/TLS connection (#8376)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package timeouts
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/coredns/caddy"
|
||||
@@ -36,6 +37,19 @@ func parseTimeouts(c *caddy.Controller) error {
|
||||
return c.ArgErr()
|
||||
}
|
||||
|
||||
if block == "maxtcpqueries" {
|
||||
n, err := strconv.Atoi(timeoutArgs[0])
|
||||
if err != nil {
|
||||
return c.Errf("invalid value for maxtcpqueries '%s': %v", timeoutArgs[0], err)
|
||||
}
|
||||
if n == 0 || n < -1 {
|
||||
return c.Errf("maxtcpqueries provided '%d' needs to be -1 (unlimited) or a positive integer", n)
|
||||
}
|
||||
config.MaxTCPQueries = &n
|
||||
b++
|
||||
continue
|
||||
}
|
||||
|
||||
timeout, err := durations.NewDurationFromArg(timeoutArgs[0])
|
||||
if err != nil {
|
||||
return c.Err(err.Error())
|
||||
|
||||
Reference in New Issue
Block a user