aboutsummaryrefslogtreecommitdiff
path: root/test/tests.go
blob: 0f9d12bae1e4187ca0fde67ea52bf1089cab4b52 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package test

import (
	"github.com/miekg/coredns/middleware"

	"github.com/miekg/dns"
)

func Msg(zone string, typ uint16, o *dns.OPT) *dns.Msg {
	m := new(dns.Msg)
	m.SetQuestion(zone, typ)
	if o != nil {
		m.Extra = []dns.RR{o}
	}
	return m
}

func Exchange(m *dns.Msg, server, net string) (*dns.Msg, error) {
	c := new(dns.Client)
	c.Net = net
	return middleware.Exchange(c, m, server)
}