diff options
author | MikoĊaj Walczak <mikiwalczak+github@gmail.com> | 2018-08-24 15:58:55 +0100 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2018-08-24 15:58:55 +0100 |
commit | f92bc73fec94f430ab1f6fb701d1ec68bf055776 (patch) | |
tree | 19572418c29ba26ccf6042dc311d248154cbf907 /dhcpv4/modifiers.go | |
parent | 537f1f937790c0bd7826ec6feb6e99fe7ededf58 (diff) |
DHCPv4 relay modifier (#149)
Diffstat (limited to 'dhcpv4/modifiers.go')
-rw-r--r-- | dhcpv4/modifiers.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dhcpv4/modifiers.go b/dhcpv4/modifiers.go index 2a9c35b..01d63ac 100644 --- a/dhcpv4/modifiers.go +++ b/dhcpv4/modifiers.go @@ -1,5 +1,9 @@ package dhcpv4 +import ( + "net" +) + // WithUserClass adds a user class option to the packet. // The rfc parameter allows you to specify if the userclass should be // rfc compliant or not. More details in issue #113 @@ -63,3 +67,14 @@ func WithRequestedOptions(optionCodes ...OptionCode) Modifier { return d } } + +// WithRelay adds parameters required for DHCPv4 to be relayed by the relay +// server with given ip +func WithRelay(ip net.IP) Modifier { + return func(d *DHCPv4) *DHCPv4 { + d.SetUnicast() + d.SetGatewayIPAddr(ip) + d.SetHopCount(1) + return d + } +} |