1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-12-30 22:15:27 -05:00

simplify testing

This commit is contained in:
v2ray
2016-05-24 21:55:46 +02:00
parent 3582b9d869
commit fc63f0432c
99 changed files with 726 additions and 817 deletions

View File

@@ -2,10 +2,24 @@ package serial
import (
"bytes"
"encoding/hex"
"strings"
)
type Bytes interface {
Bytes() []byte
func ByteToHexString(value byte) string {
return hex.EncodeToString([]byte{value})
}
func BytesToUint16(value []byte) uint16 {
return uint16(value[0])<<8 + uint16(value[1])
}
func BytesToHexString(value []byte) string {
strs := make([]string, len(value))
for i, b := range value {
strs[i] = hex.EncodeToString([]byte{b})
}
return "[" + strings.Join(strs, ",") + "]"
}
type BytesT []byte