summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/option_parameter_request_list.go
diff options
context:
space:
mode:
authorinsomniac <insomniacslk@users.noreply.github.com>2018-08-19 19:58:01 +0100
committerGitHub <noreply@github.com>2018-08-19 19:58:01 +0100
commitc0dc38b656ec84a401a99f2f97f6af79c4e66398 (patch)
tree11892b32733d2cee916f8236c5afe10f40bcbab2 /dhcpv4/option_parameter_request_list.go
parentececa3f5129cbc0bca341ea87a14bfaa8576156d (diff)
Added String methods for types (#140)
* Added String methods for types * Reverted change on bsdp.OptionCode
Diffstat (limited to 'dhcpv4/option_parameter_request_list.go')
-rw-r--r--dhcpv4/option_parameter_request_list.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/dhcpv4/option_parameter_request_list.go b/dhcpv4/option_parameter_request_list.go
index 324832e..865b2d7 100644
--- a/dhcpv4/option_parameter_request_list.go
+++ b/dhcpv4/option_parameter_request_list.go
@@ -53,11 +53,11 @@ func (o *OptParameterRequestList) ToBytes() []byte {
func (o *OptParameterRequestList) String() string {
var optNames []string
for _, ro := range o.RequestedOpts {
- if name, ok := OptionCodeToString[ro]; ok {
- optNames = append(optNames, name)
- } else {
- optNames = append(optNames, fmt.Sprintf("Unknown (%v)", ro))
+ name := ro.String()
+ if name == "Unknown" {
+ name += fmt.Sprintf("%s (%v)", name, ro)
}
+ optNames = append(optNames, name)
}
return fmt.Sprintf("Parameter Request List -> [%v]", strings.Join(optNames, ", "))
}