mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 02:03:20 -04:00 
			
		
		
		
	New plugin: loop (#1989)
* 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>
This commit is contained in:
		
							
								
								
									
										19
									
								
								plugin/loop/setup_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								plugin/loop/setup_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| package loop | ||||
|  | ||||
| import ( | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/mholt/caddy" | ||||
| ) | ||||
|  | ||||
| func TestSetup(t *testing.T) { | ||||
| 	c := caddy.NewTestController("dns", `loop`) | ||||
| 	if err := setup(c); err != nil { | ||||
| 		t.Fatalf("Expected no errors, but got: %v", err) | ||||
| 	} | ||||
|  | ||||
| 	c = caddy.NewTestController("dns", `loop argument`) | ||||
| 	if err := setup(c); err == nil { | ||||
| 		t.Fatal("Expected errors, but got none") | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user