mirror of
				https://github.com/coredns/coredns.git
				synced 2025-11-03 10:43:20 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			68 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Groff
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Groff
		
	
	
	
	
	
.\" Generated by Mmark Markdown Processer - mmark.miek.nl
 | 
						|
.TH "COREDNS-CANCEL" 7 "March 2021" "CoreDNS" "CoreDNS Plugins"
 | 
						|
 | 
						|
.SH "NAME"
 | 
						|
.PP
 | 
						|
\fIcancel\fP - cancels a request's context after 5001 milliseconds.
 | 
						|
 | 
						|
.SH "DESCRIPTION"
 | 
						|
.PP
 | 
						|
The \fIcancel\fP plugin creates a canceling context for each request. It adds a timeout that gets
 | 
						|
triggered after 5001 milliseconds.
 | 
						|
 | 
						|
.PP
 | 
						|
The 5001 number was chosen because the default timeout for DNS clients is 5 seconds, after that they
 | 
						|
give up.
 | 
						|
 | 
						|
.PP
 | 
						|
A plugin interested in the cancellation status should call \fB\fCplugin.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.
 | 
						|
 | 
						|
.SH "SYNTAX"
 | 
						|
.PP
 | 
						|
.RS
 | 
						|
 | 
						|
.nf
 | 
						|
cancel [TIMEOUT]
 | 
						|
 | 
						|
.fi
 | 
						|
.RE
 | 
						|
 | 
						|
.IP \(bu 4
 | 
						|
\fBTIMEOUT\fP allows setting a custom timeout. The default timeout is 5001 milliseconds (\fB\fC5001 ms\fR)
 | 
						|
 | 
						|
 | 
						|
.SH "EXAMPLES"
 | 
						|
.PP
 | 
						|
.RS
 | 
						|
 | 
						|
.nf
 | 
						|
example.org {
 | 
						|
    cancel
 | 
						|
    whoami
 | 
						|
}
 | 
						|
 | 
						|
.fi
 | 
						|
.RE
 | 
						|
 | 
						|
.PP
 | 
						|
Or with a custom timeout:
 | 
						|
 | 
						|
.PP
 | 
						|
.RS
 | 
						|
 | 
						|
.nf
 | 
						|
example.org {
 | 
						|
    cancel 1s
 | 
						|
    whoami
 | 
						|
}
 | 
						|
 | 
						|
.fi
 | 
						|
.RE
 | 
						|
 | 
						|
.SH "SEE ALSO"
 | 
						|
.PP
 | 
						|
The Go documentation for the context package.
 | 
						|
 |