configuration protocol support draft

This commit is contained in:
Tnze
2023-11-19 02:10:15 +08:00
parent 61916db07a
commit 006f958f43
9 changed files with 184 additions and 106 deletions

View File

@ -79,7 +79,7 @@ func Encrypt(conn *net.Conn, name string, serverKey *rsa.PrivateKey) (*Resp, err
func encryptionRequest(conn *net.Conn, publicKey, verifyToken []byte) error {
return conn.WritePacket(pk.Marshal(
packetid.LoginEncryptionRequest,
packetid.ClientboundLoginEncryptionRequest,
pk.String(""),
pk.ByteArray(publicKey),
pk.ByteArray(verifyToken),
@ -92,7 +92,7 @@ func encryptionResponse(conn *net.Conn, serverKey *rsa.PrivateKey, verifyToken [
if err != nil {
return nil, err
}
if p.ID != packetid.LoginEncryptionResponse {
if packetid.ServerboundPacketID(p.ID) != packetid.ServerboundLoginEncryptionResponse {
return nil, fmt.Errorf("0x%02X is not Encryption Response", p.ID)
}