mirror of
https://github.com/coredns/coredns.git
synced 2026-01-02 15:01:34 -05:00
Add roundrobin middleware
This middleware allows you to round robin a/aaaa records in a reply and maybe more in the future (i.e.) sort a packet?
This commit is contained in:
@@ -51,9 +51,10 @@ var directiveOrder = []directive{
|
||||
{"shutdown", setup.Shutdown},
|
||||
|
||||
// Directives that inject handlers (middleware)
|
||||
{"prometheus", setup.Prometheus},
|
||||
{"loadbalance", setup.Loadbalance},
|
||||
{"log", setup.Log},
|
||||
{"errors", setup.Errors},
|
||||
{"prometheus", setup.Prometheus},
|
||||
{"rewrite", setup.Rewrite},
|
||||
{"file", setup.File},
|
||||
{"proxy", setup.Proxy},
|
||||
|
||||
19
core/setup/loadbalance.go
Normal file
19
core/setup/loadbalance.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package setup
|
||||
|
||||
import (
|
||||
"github.com/miekg/coredns/middleware"
|
||||
"github.com/miekg/coredns/middleware/loadbalance"
|
||||
)
|
||||
|
||||
// Root sets up the root file path of the server.
|
||||
func Loadbalance(c *Controller) (middleware.Middleware, error) {
|
||||
for c.Next() {
|
||||
// and choosing the correct balancer
|
||||
// TODO(miek): block and option parsing
|
||||
}
|
||||
return func(next middleware.Handler) middleware.Handler {
|
||||
return loadbalance.RoundRobin{Next: next}
|
||||
}, nil
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
Reference in New Issue
Block a user