mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
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:
23
plugin/loadbalance/handler.go
Normal file
23
plugin/loadbalance/handler.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Package loadbalance is plugin for rewriting responses to do "load balancing"
|
||||
package loadbalance
|
||||
|
||||
import (
|
||||
"github.com/coredns/coredns/plugin"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// RoundRobin is plugin to rewrite responses for "load balancing".
|
||||
type RoundRobin struct {
|
||||
Next plugin.Handler
|
||||
}
|
||||
|
||||
// ServeDNS implements the plugin.Handler interface.
|
||||
func (rr RoundRobin) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
|
||||
wrr := &RoundRobinResponseWriter{w}
|
||||
return plugin.NextOrFailure(rr.Name(), rr.Next, ctx, wrr, r)
|
||||
}
|
||||
|
||||
// Name implements the Handler interface.
|
||||
func (rr RoundRobin) Name() string { return "loadbalance" }
|
||||
Reference in New Issue
Block a user