mirror of
https://github.com/coredns/coredns.git
synced 2025-12-06 02:15:11 -05:00
This reverts commit 68f1dd5ddf.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
@@ -24,16 +24,17 @@ A working syntax would be:
|
||||
~~~
|
||||
secondary [zones...] {
|
||||
transfer from ADDRESS
|
||||
transfer to ADDRESS
|
||||
}
|
||||
~~~
|
||||
|
||||
* `transfer from` specifies from which address to fetch the zone. It can be specified multiple times;
|
||||
if one does not work, another will be tried. Transfering this zone outwards again can be done by
|
||||
enableing the *transfer* plugin.
|
||||
if one does not work, another will be tried.
|
||||
* `transfer to` can be enabled to allow this secondary zone to be transferred again.
|
||||
|
||||
When a zone is due to be refreshed (Refresh timer fires) a random jitter of 5 seconds is
|
||||
applied, before fetching. In the case of retry this will be 2 seconds. If there are any errors
|
||||
during the transfer in, the transfer fails; this will be logged.
|
||||
during the transfer the transfer fails; this will be logged.
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -42,7 +43,8 @@ Transfer `example.org` from 10.0.1.1, and if that fails try 10.1.2.1.
|
||||
~~~ corefile
|
||||
example.org {
|
||||
secondary {
|
||||
transfer from 10.0.1.1 10.1.2.1
|
||||
transfer from 10.0.1.1
|
||||
transfer from 10.1.2.1
|
||||
}
|
||||
}
|
||||
~~~
|
||||
@@ -50,12 +52,10 @@ example.org {
|
||||
Or re-export the retrieved zone to other secondaries.
|
||||
|
||||
~~~ corefile
|
||||
example.net {
|
||||
secondary {
|
||||
. {
|
||||
secondary example.net {
|
||||
transfer from 10.1.2.1
|
||||
}
|
||||
transfer {
|
||||
to *
|
||||
transfer to *
|
||||
}
|
||||
}
|
||||
~~~
|
||||
@@ -63,7 +63,3 @@ example.net {
|
||||
## Bugs
|
||||
|
||||
Only AXFR is supported and the retrieved zone is not committed to disk.
|
||||
|
||||
## Also See
|
||||
|
||||
See the *transfer* plugin to enable zone transfers _to_ other servers.
|
||||
|
||||
@@ -44,6 +44,7 @@ func setup(c *caddy.Controller) error {
|
||||
func secondaryParse(c *caddy.Controller) (file.Zones, error) {
|
||||
z := make(map[string]*file.Zone)
|
||||
names := []string{}
|
||||
upstr := upstream.New()
|
||||
for c.Next() {
|
||||
|
||||
if c.Val() == "secondary" {
|
||||
@@ -62,24 +63,30 @@ func secondaryParse(c *caddy.Controller) (file.Zones, error) {
|
||||
|
||||
for c.NextBlock() {
|
||||
|
||||
f := []string{}
|
||||
t, f := []string{}, []string{}
|
||||
var e error
|
||||
|
||||
switch c.Val() {
|
||||
case "transfer":
|
||||
var err error
|
||||
f, err = parse.TransferIn(c)
|
||||
if err != nil {
|
||||
return file.Zones{}, err
|
||||
t, f, e = parse.Transfer(c, true)
|
||||
if e != nil {
|
||||
return file.Zones{}, e
|
||||
}
|
||||
case "upstream":
|
||||
// remove soon
|
||||
c.RemainingArgs()
|
||||
default:
|
||||
return file.Zones{}, c.Errf("unknown property '%s'", c.Val())
|
||||
}
|
||||
|
||||
for _, origin := range origins {
|
||||
if t != nil {
|
||||
z[origin].TransferTo = append(z[origin].TransferTo, t...)
|
||||
}
|
||||
if f != nil {
|
||||
z[origin].TransferFrom = append(z[origin].TransferFrom, f...)
|
||||
}
|
||||
z[origin].Upstream = upstream.New()
|
||||
z[origin].Upstream = upstr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ func TestSecondaryParse(t *testing.T) {
|
||||
{
|
||||
`secondary {
|
||||
transfer from 127.0.0.1
|
||||
transfer to 127.0.0.1
|
||||
}`,
|
||||
false,
|
||||
"127.0.0.1:53",
|
||||
@@ -30,6 +31,7 @@ func TestSecondaryParse(t *testing.T) {
|
||||
{
|
||||
`secondary example.org {
|
||||
transfer from 127.0.0.1
|
||||
transfer to 127.0.0.1
|
||||
}`,
|
||||
false,
|
||||
"127.0.0.1:53",
|
||||
|
||||
Reference in New Issue
Block a user