diff options
author | Pablo Mazzini <pmazzini@gmail.com> | 2018-08-03 11:02:46 +0200 |
---|---|---|
committer | Pablo Mazzini <pmazzini@gmail.com> | 2018-08-10 14:43:25 +0200 |
commit | 45d999fb7b4230c0fa99b94136dfe13a06d924c8 (patch) | |
tree | 18c57dc11a6f236c3d717627b88fc2e2b44af079 /dhcpv4 | |
parent | 5207d76712250f33111c546d9ace98336d616bfc (diff) |
rename RequestFromOffer to NewRequestFromOffer
Diffstat (limited to 'dhcpv4')
-rw-r--r-- | dhcpv4/dhcpv4.go | 4 | ||||
-rw-r--r-- | dhcpv4/dhcpv4_test.go | 8 | ||||
-rw-r--r-- | dhcpv4/option_bootfile_name.go | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/dhcpv4/dhcpv4.go b/dhcpv4/dhcpv4.go index d670de2..5005375 100644 --- a/dhcpv4/dhcpv4.go +++ b/dhcpv4/dhcpv4.go @@ -187,8 +187,8 @@ func NewInformForInterface(ifname string, needsBroadcast bool) (*DHCPv4, error) return d, nil } -// RequestFromOffer builds a DHCPv4 request from an offer. -func RequestFromOffer(offer DHCPv4, modifiers ...Modifier) (*DHCPv4, error) { +// NewRequestFromOffer builds a DHCPv4 request from an offer. +func NewRequestFromOffer(offer *DHCPv4, modifiers ...Modifier) (*DHCPv4, error) { d, err := New() if err != nil { return nil, err diff --git a/dhcpv4/dhcpv4_test.go b/dhcpv4/dhcpv4_test.go index 1bce05d..6e3394c 100644 --- a/dhcpv4/dhcpv4_test.go +++ b/dhcpv4/dhcpv4_test.go @@ -342,24 +342,24 @@ func TestAddOption(t *testing.T) { require.Equal(t, options[3].Code(), OptionEnd) } -func TestDHCPv4RequestFromOffer(t *testing.T) { +func TestDHCPv4NewRequestFromOffer(t *testing.T) { offer, err := New() require.NoError(t, err) offer.AddOption(&OptMessageType{MessageType: MessageTypeOffer}) offer.AddOption(&OptServerIdentifier{ServerID: net.IPv4(192, 168, 0, 1)}) - req, err := RequestFromOffer(*offer) + req, err := NewRequestFromOffer(offer) require.NoError(t, err) require.NotEqual(t, (*MessageType)(nil), *req.MessageType()) require.Equal(t, MessageTypeRequest, *req.MessageType()) } -func TestDHCPv4RequestFromOfferWithModifier(t *testing.T) { +func TestDHCPv4NewRequestFromOfferWithModifier(t *testing.T) { offer, err := New() require.NoError(t, err) offer.AddOption(&OptMessageType{MessageType: MessageTypeOffer}) offer.AddOption(&OptServerIdentifier{ServerID: net.IPv4(192, 168, 0, 1)}) userClass := WithUserClass([]byte("linuxboot"), false) - req, err := RequestFromOffer(*offer, userClass) + req, err := NewRequestFromOffer(offer, userClass) require.NoError(t, err) require.NotEqual(t, (*MessageType)(nil), *req.MessageType()) require.Equal(t, MessageTypeRequest, *req.MessageType()) diff --git a/dhcpv4/option_bootfile_name.go b/dhcpv4/option_bootfile_name.go index 73ea625..5f1020a 100644 --- a/dhcpv4/option_bootfile_name.go +++ b/dhcpv4/option_bootfile_name.go @@ -28,7 +28,7 @@ func (op *OptBootfileName) Length() int { } func (op *OptBootfileName) String() string { - return fmt.Sprintf("OptBootfileName{BootfileName=%s}", op.BootfileName) + return fmt.Sprintf("Bootfile Name -> %v", op.BootfileName) } |