diff options
Diffstat (limited to 'dhcpv6/dhcpv6message.go')
-rw-r--r-- | dhcpv6/dhcpv6message.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dhcpv6/dhcpv6message.go b/dhcpv6/dhcpv6message.go index f3ed4ef..0dd219d 100644 --- a/dhcpv6/dhcpv6message.go +++ b/dhcpv6/dhcpv6message.go @@ -248,6 +248,21 @@ func (mo MessageOptions) ElapsedTime() time.Duration { return 0 } +// InformationRefreshTime returns the Information Refresh Time option +// as defined by RFC 815 Section 21.23. +// +// InformationRefreshTime returns the provided default if no option is present. +func (mo MessageOptions) InformationRefreshTime(def time.Duration) time.Duration { + opt := mo.Options.GetOne(OptionInformationRefreshTime) + if opt == nil { + return def + } + if t, ok := opt.(*optInformationRefreshTime); ok { + return t.InformationRefreshtime + } + return def +} + // FQDN returns the FQDN option as defined by RFC 4704. func (mo MessageOptions) FQDN() *OptFQDN { opt := mo.Options.GetOne(OptionFQDN) |