61 lines
1.2 KiB
Groff
61 lines
1.2 KiB
Groff
.\" generated with Ronn/v0.7.3
|
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
|
.
|
|
.TH "COREDNS\-CANCEL" "7" "March 2019" "CoreDNS" "CoreDNS plugins"
|
|
.
|
|
.SH "NAME"
|
|
\fIcancel\fR \- a plugin that cancels a request\'s context after 5001 milliseconds\.
|
|
.
|
|
.SH "DESCRIPTION"
|
|
The \fIcancel\fR plugin creates a canceling context for each request\. It adds a timeout that gets triggered after 5001 milliseconds\.
|
|
.
|
|
.P
|
|
The 5001 number is chosen because the default timeout for DNS clients is 5 seconds, after that they give up\.
|
|
.
|
|
.P
|
|
A plugin interested in the cancellation status should call \fBplugin\.Done()\fR 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\.
|
|
.
|
|
.IP "" 4
|
|
.
|
|
.nf
|
|
|
|
cancel [TIMEOUT]
|
|
.
|
|
.fi
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.IP "\(bu" 4
|
|
\fBTIMEOUT\fR allows setting a custom timeout\. The default timeout is 5001 milliseconds (\fB5001 ms\fR)
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.SH "EXAMPLES"
|
|
.
|
|
.nf
|
|
|
|
\&\. {
|
|
cancel
|
|
whoami
|
|
}
|
|
.
|
|
.fi
|
|
.
|
|
.P
|
|
Or with a custom timeout:
|
|
.
|
|
.IP "" 4
|
|
.
|
|
.nf
|
|
|
|
\&\. {
|
|
cancel 1s
|
|
whoami
|
|
}
|
|
.
|
|
.fi
|
|
.
|
|
.IP "" 0
|
|
.
|
|
.SH "ALSO SEE"
|
|
The Go documentation for the context package\.
|