-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathThe Cyan Handshake Specification
212 lines (186 loc) · 5.28 KB
/
The Cyan Handshake Specification
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
Steps:
----------------------------------------------------------------
_
1|
S| Wait for the brand packet, if it is cyan-compatible, send the 'START' packet with no content to the client
|
_
2|
C| When the 'START' packet is received, send a 'PROTOCOL' packet to the server
|
_
3|
S| After receiving the 'PROTOCOL' packet, check compaptibility, disconnect if incompatible, send 'PROTOCOL' if compatible
|
_
4|
C| After receiving the server 'PROTOCOL' packet, save information in ServerSoftware and send 'LOADERLIST'
|
_
5|
S| After receiving the client 'LOADERLIST' packet, save information in ClientSoftware and send 'LOADERLIST'
|
_
6|
C| After receiving the server 'LOADERLIST' packet, save information in ServerSoftware and send 'HANDSHAKERULES' to the server
|
_
7|
S| After receiving the clinet 'HANDSHAKERULES' packet, validate the handskake rules
| Disconnect if incompatible, send 'FINISHED' if compatible
|
_
8|
C| After receiving 'FINISHED', dispatch connection events, lock handshake
|
_
9|
C| If 'RESET' is received, clear ServerSoftware and unlock the handshake.
| This packet can be send regardless of state, it will not crash the client or throw an error message.
|
|
| If you are building a proxy, you can send this packet for every server switch.
| You don't need to do much else, as long as your proxy re-sends the vanilla brand packet.
| If it does, and forwards plugin messages, the handshake will be run automatically.
|
| Also, Cyan clients will not disconnect on their own, the server handles most of the handshake.
| If the client is incompatible, the server uses vanilla disconnect packets to end the connection.
| You can use this to send the player back to a lobby.
|
| If you want to have a clean server-switch, you can send the 'LEVELSCREEN' packet after 'RESET' to re-open the 'receiving-level'
| screen until the client receives the 'FINISHED' packet. This packet is used by regular Cyan servers when the handshake fails.
|
----------------------------------------------------------------
Specification:
----------------------------------------------------------------
_____
START|
Format type: Empty packet
Channel: cyan:cyan.handshake.start
Content:_______________________________
[TYPE] [DESCRIPTION]
|
EMPTY | Empty packet
|
_______________________________________
________
PROTOCOL|
Format type: ByteBuffer
Channel: cyan.handshake:core
Content:_______________________________
[TYPE] [DESCRIPTION]
|
Double | The current protocol version
Double | Minimal protocol version
Double | Maximal protocol version
|
_______________________________________
__________
LOADERLIST|
Format type: Cyan Networking Specification
Channel: cyan.handshake:mods
Content:_______________________________
[TYPE] [DESCRIPTION]
|
DOUBLE | Cyan protocol version
DOUBLE | Max protocol version
DOUBLE | Min protocol version
|
INT | Amount of mod loaders
LOADER[]| Array of mod loaders
|
_______________________________________
'LOADER' type:_________________________
[TYPE] [DESCRIPTION]
|
BOOLEAN | Has protocol specifications?
BOOLEAN?| Is root modloader?
DOUBLE? | Current modkit version
DOUBLE? | Current protocol version
DOUBLE? | Minimal protocol version
DOUBLE? | Maximal protocol version
|
STRING | Modloader name
STRING | Modloader simple name
STRING | Modloader type name
STRING | Modloader version
|
BOOLEAN | Has game version?
STRING? | Modloader game version
|
INT | Count of regular mods
MOD[] | Array of regular mods
INT | Count of core mods
MOD[] | Array of core mods
|
INT | Rule entry count
ENTRY[] | Array of rule entries
|
_______________________________________
'MOD' type:____________________________
[TYPE] [DESCRIPTION]
|
STRING | Mod ID
STRING | Mod Display Name
STRING | Mod Version
|
_______________________________________
'ENTRY' type:__________________________
[TYPE] [DESCRIPTION]
|
STRING | Entry Key
STRING | Entry Version
|
_______________________________________
______________
HANDSHAKERULES|
Format type: Cyan Networking Specification
Channel: cyan.handshake:rules
Content:_______________________________
[TYPE] [DESCRIPTION]
|
INT | Amount of handshake rules
RULE[] | Array of handshake rules
|
_______________________________________
'RULE' type:____________________________
[TYPE] [DESCRIPTION]
|
BYTE | Side:
| 0 = CLIENT
| 1 = SERVER
STRING | Rule key
STRING | Rule check string
|
_______________________________________
________
FINISHED|
Format type: Empty packet
Channel: cyan.handshake:done
Content:_______________________________
[TYPE] [DESCRIPTION]
|
EMPTY | Empty packet
|
_______________________________________
___________
LEVELSCREEN|
Format type: Empty packet
Channel: cyan.handshake:ldscn
Content:_______________________________
[TYPE] [DESCRIPTION]
|
EMPTY | Empty packet
|
_______________________________________
_____
RESET|
Format type: Empty packet
Channel: cyan.handshake:reset
Content:_______________________________
[TYPE] [DESCRIPTION]
|
EMPTY | Empty packet
|
_______________________________________
----------------------------------------------------------------