aboutsummaryrefslogtreecommitdiff
path: root/plugin/file/zone.go
diff options
context:
space:
mode:
authorGravatar Yong Tang <yong.tang.github@outlook.com> 2020-09-24 11:30:39 -0700
committerGravatar GitHub <noreply@github.com> 2020-09-24 20:30:39 +0200
commit9798dd067f53a74e3777cff539b2f01617c107c6 (patch)
treefac3bbc495c9a7f78fd9a847fb44533bd6367d9a /plugin/file/zone.go
parent279194f2e45c9dfeccafe95e515e0aced0ea8bdc (diff)
downloadcoredns-9798dd067f53a74e3777cff539b2f01617c107c6.tar.gz
coredns-9798dd067f53a74e3777cff539b2f01617c107c6.tar.zst
coredns-9798dd067f53a74e3777cff539b2f01617c107c6.zip
Cherry-pick: Implement notifies for transfer plugin (#3972) (#4142)
* Implement notifies for transfer plugin (#3972) * Fix notifies in transfer plugin Signed-off-by: Miek Gieben <miek@miek.nl> * Make it compile Signed-off-by: Miek Gieben <miek@miek.nl> * Port more plugins Signed-off-by: Miek Gieben <miek@miek.nl> * golint Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl> * Fix notifies in transfer plugin Signed-off-by: Miek Gieben <miek@miek.nl> * Make it compile Signed-off-by: Miek Gieben <miek@miek.nl> * Port more plugins Signed-off-by: Miek Gieben <miek@miek.nl> * golint Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl> * Fix tests Signed-off-by: Miek Gieben <miek@miek.nl> * really fix test Signed-off-by: Miek Gieben <miek@miek.nl> * Implement ixfr fallback and unify file and auto for transfering Signed-off-by: Miek Gieben <miek@miek.nl> * Add transfer tests copied and modified from #3452 Signed-off-by: Miek Gieben <miek@miek.nl> * Test correct selection of plugin Signed-off-by: Miek Gieben <miek@miek.nl> * add upstream back in Signed-off-by: Miek Gieben <miek@miek.nl> * Implement ixfr fallback and unify file and auto for transfering Signed-off-by: Miek Gieben <miek@miek.nl> * fix test Signed-off-by: Miek Gieben <miek@miek.nl> * properly merge Signed-off-by: Miek Gieben <miek@miek.nl> * Remove plugin/kubernetes/setup_transfer_test.go Signed-off-by: Yong Tang <yong.tang.github@outlook.com> Co-authored-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/file/zone.go')
-rw-r--r--plugin/file/zone.go25
1 files changed, 0 insertions, 25 deletions
diff --git a/plugin/file/zone.go b/plugin/file/zone.go
index 62720abb4..aa5f3cac0 100644
--- a/plugin/file/zone.go
+++ b/plugin/file/zone.go
@@ -2,7 +2,6 @@ package file
import (
"fmt"
- "net"
"path/filepath"
"strings"
"sync"
@@ -10,7 +9,6 @@ import (
"github.com/coredns/coredns/plugin/file/tree"
"github.com/coredns/coredns/plugin/pkg/upstream"
- "github.com/coredns/coredns/request"
"github.com/miekg/dns"
)
@@ -26,7 +24,6 @@ type Zone struct {
sync.RWMutex
- TransferTo []string
StartupOnce sync.Once
TransferFrom []string
@@ -58,7 +55,6 @@ func NewZone(name, file string) *Zone {
// Copy copies a zone.
func (z *Zone) Copy() *Zone {
z1 := NewZone(z.origin, z.file)
- z1.TransferTo = z.TransferTo
z1.TransferFrom = z.TransferFrom
z1.Expired = z.Expired
@@ -69,7 +65,6 @@ func (z *Zone) Copy() *Zone {
// CopyWithoutApex copies zone z without the Apex records.
func (z *Zone) CopyWithoutApex() *Zone {
z1 := NewZone(z.origin, z.file)
- z1.TransferTo = z.TransferTo
z1.TransferFrom = z.TransferFrom
z1.Expired = z.Expired
@@ -134,26 +129,6 @@ func (z *Zone) SetFile(path string) {
z.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 {
- if t == "*" {
- return true
- }
- // If remote IP matches we accept.
- remote := state.IP()
- to, _, err := net.SplitHostPort(t)
- if err != nil {
- continue
- }
- if to == remote {
- return true
- }
- }
- // TODO(miek): future matching against IP/CIDR notations
- return false
-}
-
// ApexIfDefined returns the apex nodes from z. The SOA record is the first record, if it does not exist, an error is returned.
func (z *Zone) ApexIfDefined() ([]dns.RR, error) {
z.RLock()