blob: da4cf154915e50944b63492b3f051b98e196c038 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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" }
|