mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-29 01:04:15 -04:00 
			
		
		
		
	* Add ServiceBackend interface This adds a ServiceBackend interface that is shared between etcd/etcd3 (later) and kubernetes, leading to a massive reduction in code. When returning the specific records from their backend. Fixes #273
		
			
				
	
	
		
			21 lines
		
	
	
		
			522 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			522 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package etcd
 | |
| 
 | |
| import "strings"
 | |
| 
 | |
| const debugName = "o-o.debug."
 | |
| 
 | |
| // isDebug checks if name is a debugging name, i.e. starts with o-o.debug.
 | |
| // it return the empty string if it is not a debug message, otherwise it will return the
 | |
| // name with o-o.debug. stripped off. Must be called with name lowercased.
 | |
| func isDebug(name string) string {
 | |
| 	if len(name) == len(debugName) {
 | |
| 		return ""
 | |
| 	}
 | |
| 	name = strings.ToLower(name)
 | |
| 	debug := strings.HasPrefix(name, debugName)
 | |
| 	if !debug {
 | |
| 		return ""
 | |
| 	}
 | |
| 	return name[len(debugName):]
 | |
| }
 |