aboutsummaryrefslogtreecommitdiff
path: root/middleware/file/notify.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2016-04-03 09:02:34 +0100
committerGravatar Miek Gieben <miek@miek.nl> 2016-04-03 09:02:34 +0100
commitf58f1e4285ab9725a317ac7b38f5905fb497c7b0 (patch)
treeb44eead7ca9f687bea1813cfe7247123d8929026 /middleware/file/notify.go
parent7fb959470e95517967c4f0bcf85f1adf9a77a42f (diff)
downloadcoredns-f58f1e4285ab9725a317ac7b38f5905fb497c7b0.tar.gz
coredns-f58f1e4285ab9725a317ac7b38f5905fb497c7b0.tar.zst
coredns-f58f1e4285ab9725a317ac7b38f5905fb497c7b0.zip
Add secondary support
Allow specifying a primary server and retrieve the zone's content. Add tests and an Expired bool to zone struct, to stop server zones that are expired. The zone is retrieved on Startup, no updates of changed content are done. We also don't respond to notifies yet.
Diffstat (limited to 'middleware/file/notify.go')
-rw-r--r--middleware/file/notify.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/middleware/file/notify.go b/middleware/file/notify.go
index cc8f493e4..bbdafe022 100644
--- a/middleware/file/notify.go
+++ b/middleware/file/notify.go
@@ -10,31 +10,31 @@ import (
// Notify will send notifies to all configured IP addresses.
func (z *Zone) Notify() {
- go notify(z.name, z.Peers)
+ go notify(z.name, z.TransferTo)
}
-// notify sends notifies to the configured remotes. It will try up to three times
-// before giving up on a specific remote. We will sequentially loop through the remotes
+// notify sends notifies to the configured remote servers. It will try up to three times
+// before giving up on a specific remote. We will sequentially loop through "to"
// until they all have replied (or have 3 failed attempts).
-func notify(zone string, remotes []string) error {
+func notify(zone string, to []string) error {
m := new(dns.Msg)
m.SetNotify(zone)
c := new(dns.Client)
// TODO(miek): error handling? Run this in a goroutine?
- for _, remote := range remotes {
- notifyRemote(c, m, middleware.Addr(remote).Standard())
+ for _, t := range to {
+ notifyAddr(c, m, t)
}
return nil
}
-func notifyRemote(c *dns.Client, m *dns.Msg, s string) error {
+func notifyAddr(c *dns.Client, m *dns.Msg, s string) error {
for i := 0; i < 3; i++ {
ret, err := middleware.Exchange(c, m, s)
if err == nil && ret.Rcode == dns.RcodeSuccess || ret.Rcode == dns.RcodeNotImplemented {
return nil
}
- // timeout? mean don't want it. should stop sending as well
+ // timeout? mean don't want it. should stop sending as well?
}
return fmt.Errorf("failed to send notify for zone '%s' to '%s'", m.Question[0].Name, s)
}