mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-28 16:54:15 -04:00 
			
		
		
		
	* New plugin: loop Add a plugin that detects loops. It does this by sending an unique query to our selves. If we see the query more than twice we stop the process. If there isn't a loop, the plugin disables it self and becomes a noop plugin. Signed-off-by: Miek Gieben <miek@miek.nl>
		
			
				
	
	
		
			12 lines
		
	
	
		
			178 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
		
			178 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package loop
 | |
| 
 | |
| import "testing"
 | |
| 
 | |
| func TestLoop(t *testing.T) {
 | |
| 	l := New(".")
 | |
| 	l.inc()
 | |
| 	if l.seen() != 1 {
 | |
| 		t.Errorf("Failed to inc loop, expected %d, got %d", 1, l.seen())
 | |
| 	}
 | |
| }
 |