diff options
author | insomniac <insomniacslk@users.noreply.github.com> | 2018-05-02 12:23:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-02 12:23:18 +0200 |
commit | 47455a374fe5e5110979e9f1ac818290cafcabaf (patch) | |
tree | 1bd077152ffd53e2ca6745688f69ec838a60d784 /dhcpv6/modifiers.go | |
parent | 08a6a496134a077cb868adb516c602fa12bb9b1e (diff) |
Added WithClientId, WithServerId and tests (#56)
Diffstat (limited to 'dhcpv6/modifiers.go')
-rw-r--r-- | dhcpv6/modifiers.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/dhcpv6/modifiers.go b/dhcpv6/modifiers.go index 08745bc..54285cd 100644 --- a/dhcpv6/modifiers.go +++ b/dhcpv6/modifiers.go @@ -4,6 +4,24 @@ import ( "log" ) +// WithClientID adds a client ID option to a DHCPv6 packet +func WithClientID(duid Duid) Modifier { + return func(d DHCPv6) DHCPv6 { + cid := OptClientId{Cid: duid} + d.UpdateOption(&cid) + return d + } +} + +// WithServerID adds a client ID option to a DHCPv6 packet +func WithServerID(duid Duid) Modifier { + return func(d DHCPv6) DHCPv6 { + sid := OptServerId{Sid: duid} + d.UpdateOption(&sid) + return d + } +} + // WithNetboot adds bootfile URL and bootfile param options to a DHCPv6 packet. func WithNetboot(d DHCPv6) DHCPv6 { msg, ok := d.(*DHCPv6Message) @@ -26,7 +44,7 @@ func WithNetboot(d DHCPv6) DHCPv6 { // WithUserClass adds a user class option to the packet func WithUserClass(uc []byte) Modifier { - // TODO let the user specify multiple user classes + // TODO let the user specify multiple user classes return func(d DHCPv6) DHCPv6 { ouc := OptUserClass{UserClasses: [][]byte{uc}} d.AddOption(&ouc) |