mirror of
https://github.com/coredns/coredns.git
synced 2025-10-26 13:51:05 +01:00
* For caddy v1 in our org This RP changes all imports for caddyserver/caddy to coredns/caddy. This is the v1 code of caddy. For the coredns/caddy repo the following changes have been made: * anything not needed by us is deleted * all `telemetry` stuff is deleted * all its import paths are also changed to point to coredns/caddy * the v1 branch has been moved to the master branch * a v1.1.0 tag has been added to signal the latest release Signed-off-by: Miek Gieben <miek@miek.nl> * Fix imports Signed-off-by: Miek Gieben <miek@miek.nl> * Group coredns/caddy with out plugins Signed-off-by: Miek Gieben <miek@miek.nl> * remove this file Signed-off-by: Miek Gieben <miek@miek.nl> * Relax import ordering github.com/coredns is now also a coredns dep, this makes github.com/coredns/caddy fit more natural in the list. Signed-off-by: Miek Gieben <miek@miek.nl> * Fix final import Signed-off-by: Miek Gieben <miek@miek.nl>
cancel
Name
cancel - cancels a request's context after 5001 milliseconds.
Description
The cancel plugin creates a canceling context for each request. It adds a timeout that gets triggered after 5001 milliseconds.
The 5001 number was chosen because the default timeout for DNS clients is 5 seconds, after that they give up.
A plugin interested in the cancellation status should call plugin.Done() on the context. If the
context was canceled due to a timeout the plugin should not write anything back to the client and
return a value indicating CoreDNS should not either; a zero return value should suffice for that.
Syntax
cancel [TIMEOUT]
- TIMEOUT allows setting a custom timeout. The default timeout is 5001 milliseconds (
5001 ms)
Examples
example.org {
cancel
whoami
}
Or with a custom timeout:
example.org {
cancel 1s
whoami
}
Also See
The Go documentation for the context package.