mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-07-26 11:44:22 -04:00
Remove magic number
This commit is contained in:
parent
13e595e4cb
commit
9c45cb031a
@ -14,8 +14,8 @@ const (
|
|||||||
// The ID of en entity, in the form of an UUID.
|
// The ID of en entity, in the form of an UUID.
|
||||||
type ID struct {
|
type ID struct {
|
||||||
String string
|
String string
|
||||||
Bytes [16]byte
|
Bytes [IDBytesLen]byte
|
||||||
cmdKey [16]byte
|
cmdKey [IDBytesLen]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewID(id string) (ID, error) {
|
func NewID(id string) (ID, error) {
|
||||||
@ -43,7 +43,7 @@ func (v ID) CmdKey() []byte {
|
|||||||
var byteGroups = []int{8, 4, 4, 4, 12}
|
var byteGroups = []int{8, 4, 4, 4, 12}
|
||||||
|
|
||||||
// TODO: leverage a full functional UUID library
|
// TODO: leverage a full functional UUID library
|
||||||
func UUIDToID(uuid string) (v [16]byte, err error) {
|
func UUIDToID(uuid string) (v [IDBytesLen]byte, err error) {
|
||||||
text := []byte(uuid)
|
text := []byte(uuid)
|
||||||
if len(text) < 32 {
|
if len(text) < 32 {
|
||||||
err = log.Error("uuid: invalid UUID string: %s", text)
|
err = log.Error("uuid: invalid UUID string: %s", text)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user