summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2017-04-09 14:31:44 +0000
committerjsing <jsing@openbsd.org>2017-04-09 14:31:44 +0000
commit3c9e0b2e8daf8831358101d228fc71ca6ecb6cb8 (patch)
treec81fc4908eef779ea305f82e7f7047f6ec575f23
parentRemove unused #define's and struct. (diff)
downloadwireguard-openbsd-3c9e0b2e8daf8831358101d228fc71ca6ecb6cb8.tar.xz
wireguard-openbsd-3c9e0b2e8daf8831358101d228fc71ca6ecb6cb8.zip
Improve unknown protocol version handling.
-rw-r--r--regress/lib/libtls/gotls/tls.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/regress/lib/libtls/gotls/tls.go b/regress/lib/libtls/gotls/tls.go
index 9b42b0aafcc..961dde13081 100644
--- a/regress/lib/libtls/gotls/tls.go
+++ b/regress/lib/libtls/gotls/tls.go
@@ -14,6 +14,7 @@ import "C"
import (
"errors"
+ "fmt"
"time"
"unsafe"
)
@@ -30,7 +31,7 @@ type ProtocolVersion uint32
func (pv ProtocolVersion) String() string {
name, ok := protocolNames[pv]
if !ok {
- return "unknown protocol version"
+ return fmt.Sprintf("unknown protocol version %x", pv)
}
return name
}
@@ -56,7 +57,7 @@ func ProtocolVersionFromString(version string) (ProtocolVersion, error) {
return proto, nil
}
}
- return 0, errors.New("unknown protocol version")
+ return 0, fmt.Errorf("unknown protocol version %q", version)
}
// TLSConfig provides configuration options for a TLS context.