mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-31 02:03:20 -04:00 
			
		
		
		
	Implement a DNS zone
Full implementation, DNS (and in the future DNSSEC). Returns answer in a hopefully standards compliant way. Testing with my miek.nl zone are included as well. This should correctly handle nodata, nxdomain and cnames.
This commit is contained in:
		
							
								
								
									
										30
									
								
								middleware/file/zone_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								middleware/file/zone_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,30 @@ | ||||
| package file | ||||
|  | ||||
| import ( | ||||
| 	"testing" | ||||
|  | ||||
| 	"github.com/miekg/dns" | ||||
| ) | ||||
|  | ||||
| func TestZoneInsert(t *testing.T) { | ||||
| 	z := NewZone("miek.nl") | ||||
| 	rr, _ := dns.NewRR("miek.nl. IN A 127.0.0.1") | ||||
| 	z.Insert(rr) | ||||
|  | ||||
| 	t.Logf("%+v\n", z) | ||||
|  | ||||
| 	elem := z.Get(rr) | ||||
| 	t.Logf("%+v\n", elem) | ||||
| 	if elem != nil { | ||||
| 		t.Logf("%+v\n", elem.Types(dns.TypeA)) | ||||
| 	} | ||||
| 	z.Delete(rr) | ||||
|  | ||||
| 	t.Logf("%+v\n", z) | ||||
|  | ||||
| 	elem = z.Get(rr) | ||||
| 	t.Logf("%+v\n", elem) | ||||
| 	if elem != nil { | ||||
| 		t.Logf("%+v\n", elem.Types(dns.TypeA)) | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user