mirror of
https://github.com/coredns/coredns.git
synced 2026-07-23 08:00:11 -04:00
Add max conn limit to https3 (#8187)
* Add max conn limit to https3 This PR adds max conn limit to https3, similiar to https Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Add Test to cover change Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Address review feedback Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update README and setup Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update plugin/https3/README.md Co-authored-by: Ville Vesilehto <ville@vesilehto.fi> Signed-off-by: Yong Tang <yong.tang.github@outlook.com> --------- Signed-off-by: Yong Tang <yong.tang.github@outlook.com> Co-authored-by: Ville Vesilehto <ville@vesilehto.fi>
This commit is contained in:
@@ -15,10 +15,12 @@ This plugin can only be used once per HTTPS3 listener block.
|
||||
```txt
|
||||
https3 {
|
||||
max_streams POSITIVE_INTEGER
|
||||
max_connections POSITIVE_INTEGER
|
||||
}
|
||||
```
|
||||
|
||||
* `max_streams` limits the number of concurrent QUIC streams per connection. This helps prevent unbounded streams on a single connection, exhausting server resources. The default value is 256 if not specified. Set to 0 to use underlying QUIC transport default.
|
||||
* `max_connections` limits the number of concurrent HTTPS/3 connections accepted by the server. The default value is 200 if not specified. Connections above the configured limit are rejected. Set to 0 to disable the CoreDNS connection limit.
|
||||
|
||||
## Examples
|
||||
|
||||
|
||||
@@ -54,6 +54,22 @@ func parseDOH3(c *caddy.Controller) error {
|
||||
return c.Err("max_streams already defined for this server block")
|
||||
}
|
||||
config.MaxHTTPS3Streams = &val
|
||||
case "max_connections":
|
||||
args := c.RemainingArgs()
|
||||
if len(args) != 1 {
|
||||
return c.ArgErr()
|
||||
}
|
||||
val, err := strconv.Atoi(args[0])
|
||||
if err != nil {
|
||||
return c.Errf("invalid max_connections value '%s': %v", args[0], err)
|
||||
}
|
||||
if val < 0 {
|
||||
return c.Errf("max_connections must be a non-negative integer: %d", val)
|
||||
}
|
||||
if config.MaxHTTPS3Connections != nil {
|
||||
return c.Err("max_connections already defined for this server block")
|
||||
}
|
||||
config.MaxHTTPS3Connections = &val
|
||||
default:
|
||||
return c.Errf("unknown property '%s'", c.Val())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user