summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv6')
-rw-r--r--dhcpv6/dhcpv6.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/dhcpv6/dhcpv6.go b/dhcpv6/dhcpv6.go
index 329d8b2..7a53b90 100644
--- a/dhcpv6/dhcpv6.go
+++ b/dhcpv6/dhcpv6.go
@@ -79,16 +79,21 @@ func FromBytes(data []byte) (DHCPv6, error) {
}
// NewMessage creates a new DHCPv6 message with default options
-func NewMessage() (DHCPv6, error) {
+func NewMessage(modifiers ...Modifier) (DHCPv6, error) {
tid, err := GenerateTransactionID()
if err != nil {
return nil, err
}
- d := DHCPv6Message{
+ msg := DHCPv6Message{
messageType: SOLICIT,
transactionID: *tid,
}
- return &d, nil
+ // apply modifiers
+ d := DHCPv6(&msg)
+ for _, mod := range modifiers {
+ d = mod(d)
+ }
+ return d, nil
}
func getOptions(options []Option, code OptionCode, onlyFirst bool) []Option {