summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/modifiers_test.go
diff options
context:
space:
mode:
authorChris Koch <chrisko@google.com>2019-12-28 07:12:19 -0800
committerinsomniac <insomniacslk@users.noreply.github.com>2020-03-05 15:51:55 +0000
commit26ec6ccc1813d21a91bc0227ce36dee3531c5c96 (patch)
tree0697fef1a7ee2b32b7a4a602a4904cb0e18e72c8 /dhcpv6/modifiers_test.go
parent69252213a65449f6984b24e912979876723ce066 (diff)
v6: add DNS getter (and rename DNSRecursiveNameServer to DNS)
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/modifiers_test.go')
-rw-r--r--dhcpv6/modifiers_test.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/dhcpv6/modifiers_test.go b/dhcpv6/modifiers_test.go
index 2179aaa..ff8022c 100644
--- a/dhcpv6/modifiers_test.go
+++ b/dhcpv6/modifiers_test.go
@@ -58,18 +58,17 @@ func TestWithIANA(t *testing.T) {
func TestWithDNS(t *testing.T) {
var d Message
- WithDNS([]net.IP{
+ WithDNS(
net.ParseIP("fe80::1"),
net.ParseIP("fe80::2"),
- }...)(&d)
+ )(&d)
require.Equal(t, 1, len(d.Options.Options))
- dns := d.Options.Options[0].(*OptDNSRecursiveNameServer)
+ dns := d.Options.DNS()
log.Printf("DNS %+v", dns)
- require.Equal(t, OptionDNSRecursiveNameServer, dns.Code())
- require.Equal(t, 2, len(dns.NameServers))
- require.Equal(t, net.ParseIP("fe80::1"), dns.NameServers[0])
- require.Equal(t, net.ParseIP("fe80::2"), dns.NameServers[1])
- require.NotEqual(t, net.ParseIP("fe80::1"), dns.NameServers[1])
+ require.Equal(t, 2, len(dns))
+ require.Equal(t, net.ParseIP("fe80::1"), dns[0])
+ require.Equal(t, net.ParseIP("fe80::2"), dns[1])
+ require.NotEqual(t, net.ParseIP("fe80::1"), dns[1])
}
func TestWithDomainSearchList(t *testing.T) {