diff options
author | Pablo Mazzini <pmazzini@gmail.com> | 2018-11-27 22:15:54 +0000 |
---|---|---|
committer | insomniac <insomniacslk@users.noreply.github.com> | 2018-11-27 22:15:54 +0000 |
commit | 319e92b03a0b85eeaee17398b72ee759b2ccf905 (patch) | |
tree | 5c3427a22d5e293835b6f60f2d9c58187352eb33 /dhcpv4/client.go | |
parent | ee4c6d2553989a433e4a13fb130616061558db48 (diff) |
simplify client interface (#181)
Diffstat (limited to 'dhcpv4/client.go')
-rw-r--r-- | dhcpv4/client.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/dhcpv4/client.go b/dhcpv4/client.go index e9a9ff5..8ec1490 100644 --- a/dhcpv4/client.go +++ b/dhcpv4/client.go @@ -179,7 +179,7 @@ func (c *Client) getRemoteUDPAddr() (*net.UDPAddr, error) { // ordered as Discovery, Offer, Request and Acknowledge. In case of errors, an // error is returned, and the list of DHCPv4 objects will be shorted than 4, // containing all the sent and received DHCPv4 messages. -func (c *Client) Exchange(ifname string, discover *DHCPv4, modifiers ...Modifier) ([]*DHCPv4, error) { +func (c *Client) Exchange(ifname string, modifiers ...Modifier) ([]*DHCPv4, error) { conversation := make([]*DHCPv4, 0) raddr, err := c.getRemoteUDPAddr() if err != nil { @@ -220,11 +220,9 @@ func (c *Client) Exchange(ifname string, discover *DHCPv4, modifiers ...Modifier }() // Discover - if discover == nil { - discover, err = NewDiscoveryForInterface(ifname) - if err != nil { - return conversation, err - } + discover, err := NewDiscoveryForInterface(ifname) + if err != nil { + return conversation, err } for _, mod := range modifiers { discover = mod(discover) |