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:
Miek Gieben
2016-03-23 15:57:48 +00:00
parent 7d834ce037
commit b167411bba
5 changed files with 127 additions and 1 deletions

19
core/setup/loadbalance.go Normal file
View 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
}