mirror of
https://github.com/pion/stun.git
synced 2025-10-28 10:01:42 +08:00
attributes, message: adjust hex formatting
This commit is contained in:
@@ -3,7 +3,6 @@ package stun
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Attributes is list of message attributes.
|
// Attributes is list of message attributes.
|
||||||
@@ -107,7 +106,7 @@ func (t AttrType) String() string {
|
|||||||
s, ok := attrNames[t]
|
s, ok := attrNames[t]
|
||||||
if !ok {
|
if !ok {
|
||||||
// Just return hex representation of unknown attribute type.
|
// Just return hex representation of unknown attribute type.
|
||||||
return "0x" + strconv.FormatUint(uint64(t), 16)
|
return fmt.Sprintf("0x%x", uint16(t))
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
@@ -145,7 +144,7 @@ func (a RawAttribute) Equal(b RawAttribute) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a RawAttribute) String() string {
|
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
|
// ErrAttributeNotFound means that attribute with provided attribute
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -382,7 +381,7 @@ func (m Method) String() string {
|
|||||||
case MethodChannelBind:
|
case MethodChannelBind:
|
||||||
return "channel bind"
|
return "channel bind"
|
||||||
default:
|
default:
|
||||||
return fmt.Sprintf("0x%s", strconv.FormatUint(uint64(m), 16))
|
return fmt.Sprintf("0x%x", uint16(m))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user