0
mirror of https://github.com/XTLS/Xray-core.git synced 2025-06-14 20:39:36 +03:00

Clean legacy vmess (#2199)

* Remove legacy Vmess

* validators

* protos
This commit is contained in:
yuhan6665
2023-06-12 10:32:25 -04:00
committed by GitHub
parent bf4b1fab3c
commit 9112cfd39c
25 changed files with 150 additions and 761 deletions

View File

@ -1,9 +1,7 @@
package protocol
import (
"crypto/hmac"
"crypto/md5"
"hash"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/uuid"
@ -13,12 +11,6 @@ const (
IDBytesLen = 16
)
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 a UUID.
type ID struct {
uuid uuid.UUID
@ -55,28 +47,3 @@ func NewID(uuid uuid.UUID) *ID {
md5hash.Sum(id.cmdKey[:0])
return id
}
func nextID(u *uuid.UUID) uuid.UUID {
md5hash := md5.New()
common.Must2(md5hash.Write(u.Bytes()))
common.Must2(md5hash.Write([]byte("16167dc8-16b6-4e6d-b8bb-65dd68113a81")))
var newid uuid.UUID
for {
md5hash.Sum(newid[:0])
if !newid.Equals(u) {
return newid
}
common.Must2(md5hash.Write([]byte("533eff8a-4113-4b10-b5ce-0f5d76b98cd2")))
}
}
func NewAlterIDs(primary *ID, alterIDCount uint16) []*ID {
alterIDs := make([]*ID, alterIDCount)
prevID := primary.UUID()
for idx := range alterIDs {
newid := nextID(&prevID)
alterIDs[idx] = NewID(newid)
prevID = newid
}
return alterIDs
}