summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4
diff options
context:
space:
mode:
authorPablo Mazzini <pmazzini@gmail.com>2018-10-15 18:03:30 +0100
committerinsomniac <insomniacslk@users.noreply.github.com>2018-10-15 18:03:30 +0100
commitf1e31f7484231a7c51b57dba85abd174f043cc1e (patch)
tree16202b92256c50f9df255e9e76030dca674d089c /dhcpv4
parentd17d7ed73609154a9c72e1194a4ad4842447dde8 (diff)
Added String methods for types (#175)
Diffstat (limited to 'dhcpv4')
-rw-r--r--dhcpv4/dhcpv4.go6
-rw-r--r--dhcpv4/option_archtype.go3
2 files changed, 2 insertions, 7 deletions
diff --git a/dhcpv4/dhcpv4.go b/dhcpv4/dhcpv4.go
index eebc1b0..51621e9 100644
--- a/dhcpv4/dhcpv4.go
+++ b/dhcpv4/dhcpv4.go
@@ -327,11 +327,7 @@ func (d *DHCPv4) HwType() iana.HwTypeType {
// HwTypeToString returns the mnemonic name for the hardware type, e.g.
// "Ethernet". If the type is unknown, it returns "Unknown".
func (d *DHCPv4) HwTypeToString() string {
- hwtype, ok := iana.HwTypeToString[d.hwType]
- if !ok {
- hwtype = "Invalid"
- }
- return hwtype
+ return d.hwType.String()
}
// SetHwType returns the hardware type as defined by IANA.
diff --git a/dhcpv4/option_archtype.go b/dhcpv4/option_archtype.go
index 8eafc55..92a3769 100644
--- a/dhcpv4/option_archtype.go
+++ b/dhcpv4/option_archtype.go
@@ -42,8 +42,7 @@ func (o *OptClientArchType) Length() int {
func (o *OptClientArchType) String() string {
var archTypes string
for idx, at := range o.ArchTypes {
- name := iana.ArchTypeToString(at)
- archTypes += name
+ archTypes += at.String()
if idx < len(o.ArchTypes)-1 {
archTypes += ", "
}