Repository navigation
Expand file tree
/
Copy pathpackets.rs
More file actions
73 lines (64 loc) · 2.47 KB
/
Copy pathpackets.rs
File metadata and controls
73 lines (64 loc) · 2.47 KB
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
pub mod master {
#[repr(u8)]
pub enum FromUnknown {
/// Sends a list of names and IPs to whoever requested it.
RequestClusters,
/// Just a way to gracefully disconnect the client.
JoinCluster,
/// They send the name of the cluster's key to the Master Server.
/// If the key doesn't exist, the server will do nothing but
/// stay silent. If it does exist, it will send a generated
/// passphrase that's encrypted with AES.
BecomeCluster,
/// When they send the decrypted key back to the Master Server.
AnswerCluster,
}
#[repr(u8)]
pub enum ToUnknown {
/// Sends a list of cluster servers containing their name, ip, and port.
SendClusters,
/// Generates a passphrase that's encrypted with AES and sends
/// it waiting for it to be sent back. It's stored in their name.
VerifyCluster,
/// Once validated, the cluster is moved to the cluster list and
/// notifies them that they're now a cluster.
CreateCluster,
// Cluster things go here.
}
}
pub mod cluster {
pub enum FromClient {
/// Sends a list of names and IPs to whoever requested it.
RequestClusters,
/// Gracefully disconnect the client and connects to the new cluster.
JoinCluster,
/// Gracefully disconnect the client.
LeaveCluster,
/// Only works if the server doesn't have a domain config. Sends the pub key.
/// Ran if the cache key doesn't match.
RequestKey,
/// Encrypts the password and sends it.
SendPassword,
/// Moves the player's position.
Move
}
pub enum ToClient {
/// Sends a list of cluster servers containing their name, ip, and port.
SendClusters,
/// Disconnects the client from the cluster.
DisconnectCluster,
/// Disconnects the client from the cluster.
LeaveCluster,
// Sends the cached version of the key.
VersionOfKey,
/// Sends the public key to the client. This only works if "domain_pub_key"
/// is not set in the Config.
SendPubKey,
/// This sends back the status to the user. It'll have a status code.
/// 20 = 200, 44 = 404, 40 = 400, 50 = 500.
/// If 20, it will send the user their ID (this was assigned on initial connection).
Authenticate,
/// Sends the player's new position.
Move
}
}