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

@@ -17,7 +17,7 @@ func main() {
mi := make(map[string]string, 0)
md := make(map[int]string, 0)
file, err := os.Open(middlewareFile)
file, err := os.Open(pluginFile)
fatalIfErr(err)
defer file.Close()
@@ -41,14 +41,14 @@ func main() {
log.Fatalf("Duplicate priority '%d', slot already taken by %q", priority, v)
}
md[priority] = items[1]
mi[items[1]] = middlewarePath + items[2] // Default, unless overridden by 3rd arg
mi[items[1]] = pluginPath + items[2] // Default, unless overridden by 3rd arg
if _, err := os.Stat(middlewareFSPath + items[2]); err != nil { // External package has been given
if _, err := os.Stat(pluginFSPath + items[2]); err != nil { // External package has been given
mi[items[1]] = items[2]
}
}
genImports("core/zmiddleware.go", "core", mi)
genImports("core/zplugin.go", "core", mi)
genDirectives("core/dnsserver/zdirectives.go", "dnsserver", md)
}
@@ -59,7 +59,7 @@ func genImports(file, pack string, mi map[string]string) {
outs += "\n"
}
outs += "// Include all middleware.\n"
outs += "// Include all plugin.\n"
for _, v := range mi {
outs += `_ "` + v + `"` + "\n"
}
@@ -79,10 +79,10 @@ func genDirectives(file, pack string, md map[int]string) {
// Directives are registered in the order they should be
// executed.
//
// Ordering is VERY important. Every middleware will
// feel the effects of all other middleware below
// Ordering is VERY important. Every plugin will
// feel the effects of all other plugin below
// (after) them during a request, but they must not
// care what middleware above them are doing.
// care what plugin above them are doing.
var directives = []string{
`
@@ -113,8 +113,8 @@ func fatalIfErr(err error) {
}
const (
middlewarePath = "github.com/coredns/coredns/middleware/"
middlewareFile = "middleware.cfg"
middlewareFSPath = "middleware/" // Where the middleware packages are located on the file system
header = "// generated by directives_generate.go; DO NOT EDIT\n\n"
pluginPath = "github.com/coredns/coredns/plugin/"
pluginFile = "plugin.cfg"
pluginFSPath = "plugin/" // Where the plugins are located on the file system
header = "// generated by directives_generate.go; DO NOT EDIT\n\n"
)