mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 10:13:14 -04:00 
			
		
		
		
	By defining and using an proxy.Exchanger interface we make the proxy more generic and we can then fold back httproxy into proxy. This overrides #463 and #473 and should make futures extensions rather trivial * Add docs that talk about `protocol` and how to set it. * middleware/proxy: rename New to NewLookup It's used as a Lookup mechanism not as a completely new proxy, reflect that in the name. * Set maxfails to 3 by default when looking up names. Most of the changes have been copied from https://github.com/johnbelamaric/coredns/pull/1/files
		
			
				
	
	
		
			19 lines
		
	
	
		
			420 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			420 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package proxy
 | |
| 
 | |
| import (
 | |
| 	"github.com/miekg/coredns/request"
 | |
| 	"github.com/miekg/dns"
 | |
| )
 | |
| 
 | |
| // Exchanger is an interface that specifies a type implementing a DNS resolver that
 | |
| // can use whatever transport it likes.
 | |
| type Exchanger interface {
 | |
| 	Exchange(request.Request) (*dns.Msg, error)
 | |
| 	SetUpstream(Upstream) error // (Re)set the upstream
 | |
| 	OnStartup() error
 | |
| 	OnShutdown() error
 | |
| 	Protocol() protocol
 | |
| }
 | |
| 
 | |
| type protocol string
 |