mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
Exporting Zone.File to avoid getters and setters Updating getter and setter for Zone.File to be less racy Renaming GetFile to File in zone plugin
This commit is contained in:
committed by
Miek Gieben
parent
908d4fbd23
commit
c2780f42c4
@@ -124,6 +124,20 @@ func (z *Zone) Insert(r dns.RR) error {
|
||||
// Delete deletes r from z.
|
||||
func (z *Zone) Delete(r dns.RR) { z.Tree.Delete(r) }
|
||||
|
||||
// File retrieves the file path in a safe way
|
||||
func (z *Zone) File() string {
|
||||
z.reloadMu.Lock()
|
||||
defer z.reloadMu.Unlock()
|
||||
return z.file
|
||||
}
|
||||
|
||||
// SetFile updates the file path in a safe way
|
||||
func (z *Zone) SetFile(path string) {
|
||||
z.reloadMu.Lock()
|
||||
z.file = path
|
||||
z.reloadMu.Unlock()
|
||||
}
|
||||
|
||||
// TransferAllowed checks if incoming request for transferring the zone is allowed according to the ACLs.
|
||||
func (z *Zone) TransferAllowed(state request.Request) bool {
|
||||
for _, t := range z.TransferTo {
|
||||
|
||||
Reference in New Issue
Block a user