From 73d51e8973f7e89fe1d2a988aaef7739c8696dd4 Mon Sep 17 00:00:00 2001 From: Dmitrii Okunev Date: Fri, 29 Nov 2019 10:50:55 +0000 Subject: Added option nclient4.WithHWAddr This option allows to receive answers DHCP with arbitrary client addresses Signed-off-by: Dmitrii Okunev --- dhcpv4/nclient4/client.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'dhcpv4/nclient4/client.go') diff --git a/dhcpv4/nclient4/client.go b/dhcpv4/nclient4/client.go index 17af89c..a1596a5 100644 --- a/dhcpv4/nclient4/client.go +++ b/dhcpv4/nclient4/client.go @@ -362,6 +362,15 @@ func WithUnicast(srcAddr *net.UDPAddr) ClientOpt { } } +// WithHWAddr tells to the Client to receive messages destinated to selected +// hardware address +func WithHWAddr(hwAddr net.HardwareAddr) ClientOpt { + return func(c *Client) (err error) { + c.ifaceHWAddr = hwAddr + return + } +} + func withBufferCap(n int) ClientOpt { return func(c *Client) (err error) { c.bufferCap = n -- cgit v1.2.3