| 
									
										
										
										
											2020-09-24 11:30:39 -07:00
										 |  |  | package auto
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import (
 | 
					
						
							|  |  |  | 	"github.com/coredns/coredns/plugin/transfer"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/miekg/dns"
 | 
					
						
							|  |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Transfer implements the transfer.Transfer interface.
 | 
					
						
							|  |  |  | func (a Auto) Transfer(zone string, serial uint32) (<-chan []dns.RR, error) {
 | 
					
						
							| 
									
										
										
										
											2025-04-04 20:27:39 +02:00
										 |  |  | 	a.RLock()
 | 
					
						
							|  |  |  | 	z, ok := a.Z[zone]
 | 
					
						
							|  |  |  | 	a.RUnlock()
 | 
					
						
							| 
									
										
										
										
											2020-09-24 11:30:39 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if !ok || z == nil {
 | 
					
						
							|  |  |  | 		return nil, transfer.ErrNotAuthoritative
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 	return z.Transfer(serial)
 | 
					
						
							|  |  |  | }
 | 
					
						
							| 
									
										
										
										
											2023-02-15 13:25:02 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | // Notify sends notifies for all zones with secondaries configured with the transfer plugin
 | 
					
						
							|  |  |  | func (a Auto) Notify() error {
 | 
					
						
							|  |  |  | 	var err error
 | 
					
						
							| 
									
										
										
										
											2025-04-04 20:27:39 +02:00
										 |  |  | 	for _, origin := range a.Names() {
 | 
					
						
							| 
									
										
										
										
											2023-02-15 13:25:02 -05:00
										 |  |  | 		e := a.transfer.Notify(origin)
 | 
					
						
							|  |  |  | 		if e != nil {
 | 
					
						
							|  |  |  | 			err = e
 | 
					
						
							|  |  |  | 		}
 | 
					
						
							|  |  |  | 	}
 | 
					
						
							|  |  |  | 	return err
 | 
					
						
							| 
									
										
										
										
											2023-05-04 09:47:18 +01:00
										 |  |  | }
 |