-
Notifications
You must be signed in to change notification settings - Fork 6
/
login.go
34 lines (29 loc) · 1006 Bytes
/
login.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package packet
import (
"dotcs/minecraft/protocol"
)
// Login is sent when the client initially tries to join the server. It is the first packet sent and contains
// information specific to the player.
type Login struct {
// ClientProtocol is the protocol version of the player. The player is disconnected if the protocol is
// incompatible with the protocol of the server.
ClientProtocol int32
// ConnectionRequest is a string containing information about the player and JWTs that may be used to
// verify if the player is connected to XBOX Live. The connection request also contains the necessary
// client public key to initiate encryption.
ConnectionRequest []byte
}
// ID ...
func (*Login) ID() uint32 {
return IDLogin
}
// Marshal ...
func (pk *Login) Marshal(w *protocol.Writer) {
w.BEInt32(&pk.ClientProtocol)
w.ByteSlice(&pk.ConnectionRequest)
}
// Unmarshal ...
func (pk *Login) Unmarshal(r *protocol.Reader) {
r.BEInt32(&pk.ClientProtocol)
r.ByteSlice(&pk.ConnectionRequest)
}