summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/modifiers.go
diff options
context:
space:
mode:
Diffstat (limited to 'dhcpv4/modifiers.go')
-rw-r--r--dhcpv4/modifiers.go15
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
+ }
+}