Regenerate files, moves packet id from data package

This commit is contained in:
Tnze
2021-02-18 21:29:16 +08:00
parent b4fc573118
commit ea0e0d1cae
19 changed files with 181 additions and 1379 deletions

View File

@ -4,7 +4,6 @@ import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/md5"
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
@ -17,7 +16,6 @@ import (
"github.com/Tnze/go-mc/net/CFB8"
pk "github.com/Tnze/go-mc/net/packet"
"github.com/google/uuid"
)
// Auth includes a account
@ -27,20 +25,6 @@ type Auth struct {
AsTk string
}
// OfflineUUID return the UUID from player name in offline mode
func OfflineUUID(name string) uuid.UUID {
var version = 3
h := md5.New()
h.Reset()
h.Write([]byte("OfflinePlayer:" + name))
s := h.Sum(nil)
var id uuid.UUID
copy(id[:], s)
id[6] = (id[6] & 0x0f) | uint8((version&0xf)<<4)
id[8] = (id[8] & 0x3f) | 0x80 // RFC 4122 variant
return id
}
// 加密请求
func handleEncryptionRequest(c *Client, pack pk.Packet) error {
//创建AES对称加密密钥