Remove the word middleware (#1067)

* Rename middleware to plugin

first pass; mostly used 'sed', few spots where I manually changed
text.

This still builds a coredns binary.

* fmt error

* Rename AddMiddleware to AddPlugin

* Readd AddMiddleware to remain backwards compat
This commit is contained in:
Miek Gieben
2017-09-14 09:36:06 +01:00
committed by GitHub
parent b984aa4559
commit d8714e64e4
354 changed files with 974 additions and 969 deletions

View File

@@ -8,8 +8,8 @@ import (
"testing"
"time"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"

View File

@@ -6,8 +6,8 @@ import (
"testing"
"time"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"

View File

@@ -5,8 +5,8 @@ import (
"log"
"testing"
"github.com/coredns/coredns/middleware/proxy"
mtest "github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
mtest "github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"

View File

@@ -7,9 +7,9 @@ import (
"log"
"testing"
"github.com/coredns/coredns/middleware/etcd/msg"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/etcd/msg"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"

View File

@@ -9,10 +9,10 @@ import (
"testing"
"time"
"github.com/coredns/coredns/middleware/etcd"
"github.com/coredns/coredns/middleware/etcd/msg"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/etcd"
"github.com/coredns/coredns/plugin/etcd/msg"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
etcdc "github.com/coreos/etcd/client"
@@ -87,7 +87,7 @@ var servicesStub = []*msg.Service{
{Host: "199.43.132.53", Key: "a.example.net.stub.dns.skydns.test."},
}
// Copied from middleware/etcd/setup_test.go
// Copied from plugin/etcd/setup_test.go
func set(ctx context.Context, t *testing.T, e *etcd.Etcd, k string, ttl time.Duration, m *msg.Service) {
b, err := json.Marshal(m)
if err != nil {
@@ -97,7 +97,7 @@ func set(ctx context.Context, t *testing.T, e *etcd.Etcd, k string, ttl time.Dur
e.Client.Set(ctx, path, string(b), &etcdc.SetOptions{TTL: ttl})
}
// Copied from middleware/etcd/setup_test.go
// Copied from plugin/etcd/setup_test.go
func delete(ctx context.Context, t *testing.T, e *etcd.Etcd, k string) {
path, _ := msg.PathWithWildcard(k, e.PathPrefix)
e.Client.Delete(ctx, path, &etcdc.DeleteOptions{Recursive: false})

View File

@@ -8,7 +8,7 @@ import (
"testing"
)
// Go get external example middleware, compile it into CoreDNS
// Go get external example plugin, compile it into CoreDNS
// and check if it is really there, but running coredns -plugins.
// Dangerous test as it messes with your git tree, maybe use tag?
@@ -36,7 +36,7 @@ func testExternalMiddlewareCompile(t *testing.T) {
}
if !strings.Contains(string(out), "dns.example") {
t.Fatal("dns.example middleware should be there")
t.Fatal("dns.example plugin should be there")
}
}
@@ -51,7 +51,7 @@ func run(t *testing.T, c *exec.Cmd) ([]byte, error) {
}
func addExampleMiddleware() error {
f, err := os.OpenFile("../middleware.cfg", os.O_APPEND|os.O_WRONLY, os.ModeAppend)
f, err := os.OpenFile("../plugin.cfg", os.O_APPEND|os.O_WRONLY, os.ModeAppend)
if err != nil {
return err
}

View File

@@ -5,8 +5,8 @@ import (
"log"
"testing"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"

View File

@@ -6,8 +6,8 @@ import (
"testing"
"time"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"

View File

@@ -5,8 +5,8 @@ import (
"log"
"testing"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"

View File

@@ -6,7 +6,7 @@ import (
"testing"
"time"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/test"
"github.com/miekg/dns"
)

View File

@@ -8,7 +8,7 @@ import (
"os"
"testing"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/test"
"github.com/miekg/dns"
)

View File

@@ -6,7 +6,7 @@ import (
"testing"
"time"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/test"
"github.com/miekg/dns"
)

View File

@@ -6,7 +6,7 @@ import (
"testing"
"time"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/test"
"github.com/miekg/dns"
)

View File

@@ -13,7 +13,7 @@ import (
"testing"
"time"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/test"
"github.com/mholt/caddy"
"github.com/miekg/dns"

View File

@@ -8,10 +8,10 @@ import (
"testing"
"time"
"github.com/coredns/coredns/middleware/cache"
"github.com/coredns/coredns/middleware/metrics"
mtest "github.com/coredns/coredns/middleware/metrics/test"
"github.com/coredns/coredns/middleware/metrics/vars"
"github.com/coredns/coredns/plugin/cache"
"github.com/coredns/coredns/plugin/metrics"
mtest "github.com/coredns/coredns/plugin/metrics/test"
"github.com/coredns/coredns/plugin/metrics/vars"
"github.com/miekg/dns"
)

View File

@@ -6,7 +6,7 @@ import (
"os"
"testing"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/test"
"github.com/miekg/dns"
)

View File

@@ -5,7 +5,7 @@ import (
"log"
"testing"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/test"
"github.com/miekg/dns"
)

View File

@@ -5,8 +5,8 @@ import (
"log"
"testing"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"

View File

@@ -10,8 +10,8 @@ import (
"net/url"
"testing"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"
)

View File

@@ -5,8 +5,8 @@ import (
"log"
"testing"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"

View File

@@ -14,7 +14,7 @@ import (
"github.com/mholt/caddy"
)
// Pasrse all README.md's of the middleware and check if every example Corefile
// Pasrse all README.md's of the plugin and check if every example Corefile
// actually works. Each corefile is only used if:
//
// ~~~ corefile
@@ -30,7 +30,7 @@ func TestReadme(t *testing.T) {
log.SetOutput(ioutil.Discard)
middle := filepath.Join("..", "middleware")
middle := filepath.Join("..", "plugin")
dirs, err := ioutil.ReadDir(middle)
if err != nil {
t.Fatalf("Could not read %s: %q", middle, err)

View File

@@ -5,8 +5,8 @@ import (
"log"
"testing"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"

View File

@@ -5,8 +5,8 @@ import (
"log"
"testing"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"

View File

@@ -5,8 +5,8 @@ import (
"log"
"testing"
"github.com/coredns/coredns/middleware/proxy"
"github.com/coredns/coredns/middleware/test"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/test"
"github.com/coredns/coredns/request"
"github.com/miekg/dns"