diff options
author | Chris Koch <chrisko@google.com> | 2019-12-28 07:12:19 -0800 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2020-03-05 15:51:55 +0000 |
commit | 26ec6ccc1813d21a91bc0227ce36dee3531c5c96 (patch) | |
tree | 0697fef1a7ee2b32b7a4a602a4904cb0e18e72c8 /dhcpv6/dhcpv6message.go | |
parent | 69252213a65449f6984b24e912979876723ce066 (diff) |
v6: add DNS getter (and rename DNSRecursiveNameServer to DNS)
Signed-off-by: Chris Koch <chrisko@google.com>
Diffstat (limited to 'dhcpv6/dhcpv6message.go')
-rw-r--r-- | dhcpv6/dhcpv6message.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/dhcpv6/dhcpv6message.go b/dhcpv6/dhcpv6message.go index 28853f1..400c46a 100644 --- a/dhcpv6/dhcpv6message.go +++ b/dhcpv6/dhcpv6message.go @@ -92,6 +92,18 @@ func (mo MessageOptions) RequestedOptions() OptionCodes { return oro.OptionCodes } +// DNS returns the DNS Recursive Name Server option as defined by RFC 3646. +func (mo MessageOptions) DNS() []net.IP { + opt := mo.Options.GetOne(OptionDNSRecursiveNameServer) + if opt == nil { + return nil + } + if dns, ok := opt.(*optDNS); ok { + return dns.NameServers + } + return nil +} + // Message represents a DHCPv6 Message as defined by RFC 3315 Section 6. type Message struct { MessageType MessageType |