plugin/loadbalance: add parse and tests (#1947)

Automatically submitted.
This commit is contained in:
Miek Gieben
2018-07-06 22:49:21 +01:00
committed by corbot[bot]
parent bcc749db04
commit 7c41f2ce9f
4 changed files with 71 additions and 16 deletions

View File

@@ -1,14 +1,12 @@
// Package loadbalance shuffles A and AAAA records.
// Package loadbalance shuffles A, AAAA and MX records.
package loadbalance
import (
"github.com/miekg/dns"
)
// RoundRobinResponseWriter is a response writer that shuffles A and AAAA records.
type RoundRobinResponseWriter struct {
dns.ResponseWriter
}
// RoundRobinResponseWriter is a response writer that shuffles A, AAAA and MX records.
type RoundRobinResponseWriter struct{ dns.ResponseWriter }
// WriteMsg implements the dns.ResponseWriter interface.
func (r *RoundRobinResponseWriter) WriteMsg(res *dns.Msg) error {
@@ -77,9 +75,3 @@ func (r *RoundRobinResponseWriter) Write(buf []byte) (int, error) {
n, err := r.ResponseWriter.Write(buf)
return n, err
}
// Hijack implements the dns.ResponseWriter interface.
func (r *RoundRobinResponseWriter) Hijack() {
r.ResponseWriter.Hijack()
return
}