summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/client.go
diff options
context:
space:
mode:
authorinsomniac <insomniacslk@users.noreply.github.com>2018-11-06 17:21:32 +0000
committerGitHub <noreply@github.com>2018-11-06 17:21:32 +0000
commitc572359d4d841c1b9d3eadd06c2b05e6085897b2 (patch)
tree2a94b057dc6bdd6b10da4f8b5bb631cd0fd3e71b /dhcpv4/client.go
parentdf1628dc937bba7f0c742bb4c48d5b9e96852436 (diff)
[WIP] Added DHCPv4 server (#178)
* Added DHCPv4 server * Added more modifiers * Fixed some bugs
Diffstat (limited to 'dhcpv4/client.go')
-rw-r--r--dhcpv4/client.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/dhcpv4/client.go b/dhcpv4/client.go
index a36bb58..61722f4 100644
--- a/dhcpv4/client.go
+++ b/dhcpv4/client.go
@@ -3,12 +3,12 @@ package dhcpv4
import (
"encoding/binary"
"errors"
+ "fmt"
+ "log"
"net"
"os"
- "time"
- "fmt"
"reflect"
- "log"
+ "time"
"golang.org/x/net/ipv4"
"golang.org/x/sys/unix"
@@ -35,8 +35,8 @@ var (
// addresses.
type Client struct {
ReadTimeout, WriteTimeout time.Duration
- RemoteAddr net.Addr
- LocalAddr net.Addr
+ RemoteAddr net.Addr
+ LocalAddr net.Addr
}
// NewClient generates a new client to perform a DHCP exchange with, setting the
@@ -275,7 +275,7 @@ func (c *Client) sendReceive(sendFd, recvFd int, packet *DHCPv4, messageType Mes
recvErrors := make(chan error, 1)
go func(errs chan<- error) {
conn, innerErr := net.FileConn(os.NewFile(uintptr(recvFd), ""))
- if err != nil {
+ if innerErr != nil {
errs <- innerErr
return
}
@@ -291,7 +291,7 @@ func (c *Client) sendReceive(sendFd, recvFd int, packet *DHCPv4, messageType Mes
}
response, innerErr = FromBytes(buf[:n])
- if err != nil {
+ if innerErr != nil {
errs <- innerErr
return
}