all: more testing and attr refactor

This commit is contained in:
Aleksandr Razumov
2017-02-11 08:17:00 +03:00
parent 587a112e6b
commit 1d5427b2ea
12 changed files with 483 additions and 361 deletions

View File

@@ -1,6 +1,9 @@
package stun
import "errors"
import (
"errors"
"fmt"
)
// ErrorCodeAttribute represents ERROR-CODE attribute.
type ErrorCodeAttribute struct {
@@ -8,6 +11,10 @@ type ErrorCodeAttribute struct {
Reason []byte
}
func (c ErrorCodeAttribute) String() string {
return fmt.Sprintf("%d: %s", c.Code, c.Reason)
}
// constants for ERROR-CODE encoding.
const (
errorCodeReasonStart = 4