attributes, message: adjust hex formatting

This commit is contained in:
Aleksandr Razumov
2017-02-12 22:36:33 +03:00
parent 3e59394bf8
commit f4af1f1a53
2 changed files with 3 additions and 5 deletions

View File

@@ -3,7 +3,6 @@ package stun
import (
"errors"
"fmt"
"strconv"
)
// Attributes is list of message attributes.
@@ -107,7 +106,7 @@ func (t AttrType) String() string {
s, ok := attrNames[t]
if !ok {
// Just return hex representation of unknown attribute type.
return "0x" + strconv.FormatUint(uint64(t), 16)
return fmt.Sprintf("0x%x", uint16(t))
}
return s
}
@@ -145,7 +144,7 @@ func (a RawAttribute) Equal(b RawAttribute) bool {
}
func (a RawAttribute) String() string {
return fmt.Sprintf("%s: %x", a.Type, a.Value)
return fmt.Sprintf("%s: 0x%x", a.Type, a.Value)
}
// ErrAttributeNotFound means that attribute with provided attribute