| 
									
										
										
										
											2017-09-14 09:36:06 +01:00
										 |  |  | package plugin
 | 
					
						
							| 
									
										
										
										
											2016-10-30 15:54:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | import (
 | 
					
						
							| 
									
										
										
										
											2017-09-14 09:36:06 +01:00
										 |  |  | 	"github.com/coredns/coredns/plugin/etcd/msg"
 | 
					
						
							| 
									
										
										
										
											2017-02-21 22:51:47 -08:00
										 |  |  | 	"github.com/coredns/coredns/request"
 | 
					
						
							| 
									
										
										
										
											2016-10-30 15:54:16 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/miekg/dns"
 | 
					
						
							|  |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // ServiceBackend defines a (dynamic) backend that returns a slice of service definitions.
 | 
					
						
							|  |  |  | type ServiceBackend interface {
 | 
					
						
							| 
									
										
										
										
											2016-11-13 14:03:12 +00:00
										 |  |  | 	// Services communicates with the backend to retrieve the service definition. Exact indicates
 | 
					
						
							| 
									
										
										
										
											2016-10-30 15:54:16 +00:00
										 |  |  | 	// on exact much are that we are allowed to recurs.
 | 
					
						
							| 
									
										
										
										
											2017-09-12 10:52:43 +01:00
										 |  |  | 	Services(state request.Request, exact bool, opt Options) ([]msg.Service, error)
 | 
					
						
							| 
									
										
										
										
											2016-10-30 15:54:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-05 15:43:27 +00:00
										 |  |  | 	// Reverse communicates with the backend to retrieve service definition based on a IP address
 | 
					
						
							|  |  |  | 	// instead of a name. I.e. a reverse DNS lookup.
 | 
					
						
							| 
									
										
										
										
											2017-09-12 10:52:43 +01:00
										 |  |  | 	Reverse(state request.Request, exact bool, opt Options) ([]msg.Service, error)
 | 
					
						
							| 
									
										
										
										
											2016-11-05 15:43:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-30 15:54:16 +00:00
										 |  |  | 	// Lookup is used to find records else where.
 | 
					
						
							|  |  |  | 	Lookup(state request.Request, name string, typ uint16) (*dns.Msg, error)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-01 18:19:57 -04:00
										 |  |  | 	// Returns _all_ services that matches a certain name.
 | 
					
						
							|  |  |  | 	// Note: it does not implement a specific service.
 | 
					
						
							| 
									
										
										
										
											2017-08-19 14:03:03 +01:00
										 |  |  | 	Records(state request.Request, exact bool) ([]msg.Service, error)
 | 
					
						
							| 
									
										
										
										
											2017-09-12 10:52:43 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// IsNameError return true if err indicated a record not found condition
 | 
					
						
							|  |  |  | 	IsNameError(err error) bool
 | 
					
						
							| 
									
										
										
										
											2016-10-30 15:54:16 +00:00
										 |  |  | }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Options are extra options that can be specified for a lookup.
 | 
					
						
							| 
									
										
										
										
											2017-09-12 10:52:43 +01:00
										 |  |  | type Options struct{}
 |