1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-02 23:35:40 -05:00

refactor protocol

This commit is contained in:
v2ray
2016-02-25 21:50:10 +01:00
parent 59bc881d70
commit 76ca9de25f
10 changed files with 39 additions and 71 deletions

View File

@@ -1,8 +1,10 @@
package protocol
import (
"crypto/hmac"
"crypto/md5"
"errors"
"hash"
"github.com/v2ray/v2ray-core/common/uuid"
)
@@ -15,6 +17,12 @@ var (
InvalidID = errors.New("Invalid ID.")
)
type IDHash func(key []byte) hash.Hash
func DefaultIDHash(key []byte) hash.Hash {
return hmac.New(md5.New, key)
}
// The ID of en entity, in the form of an UUID.
type ID struct {
uuid *uuid.UUID