Handshake, Status, and Login work now.

This commit is contained in:
ElementG9 2020-08-18 08:19:15 -06:00
parent 84641a5c9d
commit a142e73d67
16 changed files with 1566 additions and 1488 deletions

View File

@ -1,5 +1,4 @@
port = 25565
protocol_version = 578
max_players = 20
motd = "Composition MOTD"
favicon = "server-icon.png"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

418
log.txt
View File

@ -1,418 +0,0 @@
2020-07-06 10:40:25 [IMPORTANT] - Cleared log file log.txt
2020-07-06 10:40:25 [INFO] - gamer
2020-07-06 10:40:25 [INFO] - balls
2020-07-06 10:41:04 [INFO] - Network thread started
2020-07-06 10:41:04 [INFO] - balls
2020-07-06 10:42:10 [INFO] - Network thread started
2020-07-06 10:42:10 [INFO] - balls
2020-07-06 10:44:02 [INFO] - Network thread started
2020-07-06 10:44:02 [INFO] - balls
2020-07-06 10:44:15 [INFO] - Network thread started
2020-07-06 10:44:15 [INFO] - log from network thread
2020-07-06 10:49:45 [INFO] - Network thread started
2020-07-06 10:49:59 [INFO] - Got a client!
2020-07-06 11:00:42 [INFO] - Network thread started
2020-07-06 11:04:04 [INFO] - Network thread started
2020-07-06 11:04:04 [IMPORTANT] - Starting server on 127.0.0.1:25565
2020-07-06 11:04:24 [INFO] - Network thread started
2020-07-06 11:04:24 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-06 11:04:43 [INFO] - Got a client!
2020-07-06 11:22:16 [INFO] - Network thread started
2020-07-06 11:22:16 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-06 11:22:22 [INFO] - Got a client!
2020-07-06 11:25:16 [INFO] - Network thread started
2020-07-06 11:25:16 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-06 11:25:20 [INFO] - Got a client!
2020-07-06 11:26:01 [INFO] - Network thread started
2020-07-06 11:26:01 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-06 11:26:04 [INFO] - Got a client!
2020-07-06 11:27:38 [INFO] - Network thread started
2020-07-06 11:27:38 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-06 11:27:47 [INFO] - Got a client!
2020-07-06 11:29:02 [INFO] - Network thread started
2020-07-06 11:29:02 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-06 11:29:05 [INFO] - Got a client!
2020-07-06 13:06:10 [INFO] - Network thread started
2020-07-06 13:06:10 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-06 13:06:14 [INFO] - Got a client!
2020-07-07 12:51:20 [INFO] - Network thread started
2020-07-07 12:51:20 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-07 12:51:45 [INFO] - Network thread started
2020-07-07 12:51:45 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-07 12:57:26 [INFO] - Network thread started
2020-07-07 12:57:26 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 19:08:57 [INFO] - Got a client!
2020-07-08 19:08:57 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "localhost" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 19:17:12 [INFO] - Network thread started
2020-07-08 19:17:12 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 19:40:27 [INFO] - Network thread started
2020-07-08 19:40:27 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 19:40:38 [INFO] - Network thread started
2020-07-08 19:40:38 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 19:41:43 [INFO] - 12345
2020-07-08 19:41:43 [INFO] - Network thread started
2020-07-08 19:41:43 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 19:41:55 [INFO] - 25565
2020-07-08 19:41:55 [INFO] - Network thread started
2020-07-08 19:41:55 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 19:43:03 [INFO] - 12345
2020-07-08 19:43:03 [INFO] - Network thread started
2020-07-08 19:43:03 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 19:43:12 [WARN] - Could not load config from composition.toml, using default config.
2020-07-08 19:43:12 [INFO] - 25565
2020-07-08 19:43:12 [INFO] - Network thread started
2020-07-08 19:43:12 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 19:56:14 [INFO] - 25565
2020-07-08 19:56:14 [INFO] - Network thread started
2020-07-08 19:56:14 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 19:58:29 [INFO] - Network thread started
2020-07-08 19:58:29 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 19:58:43 [INFO] - Network thread started
2020-07-08 19:58:43 [IMPORTANT] - Started server on 127.0.0.1:12345
2020-07-08 19:58:52 [INFO] - Network thread started
2020-07-08 19:58:52 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 20:03:06 [INFO] - Network thread started
2020-07-08 20:03:06 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 20:03:12 [INFO] - Got a client!
2020-07-08 20:03:12 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "localhost" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 20:05:29 [INFO] - Network thread started
2020-07-08 20:05:29 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 20:08:08 [INFO] - Network thread started
2020-07-08 20:08:08 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 20:10:04 [INFO] - Network thread started
2020-07-08 20:10:04 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 20:10:08 [INFO] - Got a client!
2020-07-08 20:10:09 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "localhost" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 20:10:09 [INFO] - Client and server run same version of Minecraft.
2020-07-08 20:11:50 [INFO] - Got a client!
2020-07-08 20:11:50 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "localhost" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 20:11:50 [INFO] - Client and server don't run same version of Minecraft.
2020-07-08 20:38:15 [INFO] - Network thread started
2020-07-08 20:38:15 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 20:38:30 [INFO] - Got a client!
2020-07-08 20:38:30 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "localhost" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 20:38:32 [ERROR] - Error when handling client: failed to fill whole buffer
2020-07-08 20:40:27 [INFO] - Network thread started
2020-07-08 20:40:27 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 20:40:30 [INFO] - Got a client!
2020-07-08 20:40:30 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "localhost" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 20:40:30 [INFO] - Next state: Login
2020-07-08 20:40:33 [ERROR] - Error when handling client: failed to fill whole buffer
2020-07-08 20:48:19 [INFO] - Network thread started
2020-07-08 20:48:19 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 20:48:25 [INFO] - Got a client!
2020-07-08 20:48:25 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "localhost" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 20:48:25 [INFO] - Next state: Login
2020-07-08 20:48:25 [INFO] - LoginStart { username: MCString { value: "ElementG9" } }
2020-07-08 20:48:25 [ERROR] - Error when handling client: failed to fill whole buffer
2020-07-08 20:51:41 [INFO] - Network thread started
2020-07-08 20:51:41 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 20:52:00 [INFO] - Got a client!
2020-07-08 20:52:00 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 20:52:00 [INFO] - Next state: Status
2020-07-08 20:52:30 [ERROR] - Error when handling client: failed to fill whole buffer
2020-07-08 20:52:30 [INFO] - Got a client!
2020-07-08 20:52:30 [INFO] - Handshake { protocol_version: MCVarInt { value: 11 }, server_address: MCString { value: "" }, server_port: MCUnsignedShort { value: 19712 }, next_state: MCVarInt { value: 67 } }
2020-07-08 20:52:30 [INFO] - Next state: Closed
2020-07-08 20:52:30 [INFO] - Client at 127.0.0.1:52064 closed connection
2020-07-08 20:55:47 [INFO] - Network thread started
2020-07-08 20:55:47 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 20:55:53 [INFO] - Got a client!
2020-07-08 20:55:53 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "localhost" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 20:55:53 [INFO] - Next state: Login
2020-07-08 20:55:53 [INFO] - LoginStart { username: MCString { value: "ElementG9" } }
2020-07-08 20:55:54 [ERROR] - Error when handling client: failed to fill whole buffer
2020-07-08 20:56:00 [INFO] - Got a client!
2020-07-08 20:56:00 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 20:56:00 [INFO] - Next state: Status
2020-07-08 20:56:30 [ERROR] - Error when handling client: failed to fill whole buffer
2020-07-08 20:56:30 [INFO] - Got a client!
2020-07-08 20:56:30 [INFO] - Handshake { protocol_version: MCVarInt { value: 11 }, server_address: MCString { value: "" }, server_port: MCUnsignedShort { value: 19712 }, next_state: MCVarInt { value: 67 } }
2020-07-08 20:56:30 [INFO] - Next state: Closed
2020-07-08 20:56:30 [INFO] - Client at 127.0.0.1:52096 closed connection
2020-07-08 21:04:04 [INFO] - Network thread started
2020-07-08 21:04:04 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:04:17 [INFO] - Network thread started
2020-07-08 21:04:17 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:04:22 [INFO] - Got a client!
2020-07-08 21:04:22 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:04:22 [INFO] - Next state: Status
2020-07-08 21:04:52 [ERROR] - Error when handling client: failed to fill whole buffer
2020-07-08 21:04:52 [INFO] - Got a client!
2020-07-08 21:04:52 [INFO] - Handshake { protocol_version: MCVarInt { value: 11 }, server_address: MCString { value: "" }, server_port: MCUnsignedShort { value: 19712 }, next_state: MCVarInt { value: 67 } }
2020-07-08 21:04:52 [INFO] - Next state: Closed
2020-07-08 21:04:52 [INFO] - Client at 127.0.0.1:52301 closed connection
2020-07-08 21:09:13 [INFO] - Network thread started
2020-07-08 21:09:13 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:09:26 [INFO] - Got a client!
2020-07-08 21:09:26 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:09:26 [INFO] - Next state: Status
2020-07-08 21:09:56 [ERROR] - Error when handling client: Connection reset by peer (os error 54)
2020-07-08 21:09:56 [INFO] - Got a client!
2020-07-08 21:09:56 [INFO] - Handshake { protocol_version: MCVarInt { value: 11 }, server_address: MCString { value: "" }, server_port: MCUnsignedShort { value: 19712 }, next_state: MCVarInt { value: 67 } }
2020-07-08 21:09:56 [INFO] - Next state: Closed
2020-07-08 21:09:56 [INFO] - Client at 127.0.0.1:52998 closed connection
2020-07-08 21:10:42 [INFO] - Network thread started
2020-07-08 21:10:42 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:10:44 [INFO] - Got a client!
2020-07-08 21:10:44 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:10:44 [INFO] - Next state: Status
2020-07-08 21:10:44 [INFO] - Ping number: MCLong { value: 6738900 }
2020-07-08 21:10:44 [ERROR] - Error when handling client: failed to fill whole buffer
2020-07-08 21:11:20 [INFO] - Network thread started
2020-07-08 21:11:20 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:11:25 [INFO] - Got a client!
2020-07-08 21:11:25 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:11:25 [INFO] - Next state: Status
2020-07-08 21:11:25 [INFO] - Ping number: MCLong { value: 6779912 }
2020-07-08 21:11:25 [INFO] - Client at 127.0.0.1:53056 closed connection
2020-07-08 21:16:51 [INFO] - Network thread started
2020-07-08 21:16:51 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:16:58 [INFO] - Got a client!
2020-07-08 21:16:58 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:16:58 [INFO] - Next state: Status
2020-07-08 21:16:58 [ERROR] - Error when handling client: failed to fill whole buffer
2020-07-08 21:16:58 [INFO] - Got a client!
2020-07-08 21:16:58 [INFO] - Handshake { protocol_version: MCVarInt { value: 11 }, server_address: MCString { value: "" }, server_port: MCUnsignedShort { value: 19712 }, next_state: MCVarInt { value: 67 } }
2020-07-08 21:16:58 [INFO] - Next state: Closed
2020-07-08 21:16:58 [INFO] - Client at 127.0.0.1:53607 closed connection
2020-07-08 21:17:32 [INFO] - Network thread started
2020-07-08 21:17:32 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:17:36 [INFO] - Got a client!
2020-07-08 21:17:36 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:17:36 [INFO] - Next state: Status
2020-07-08 21:17:36 [INFO] - Ping number: MCLong { value: 7150256 }
2020-07-08 21:17:36 [INFO] - Client at 127.0.0.1:53687 closed connection
2020-07-08 21:18:54 [INFO] - Network thread started
2020-07-08 21:18:54 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:18:58 [INFO] - Got a client!
2020-07-08 21:18:58 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:18:58 [INFO] - Next state: Status
2020-07-08 21:18:58 [INFO] - Ping number: MCLong { value: 7232924 }
2020-07-08 21:18:58 [INFO] - Client at 127.0.0.1:53774 closed connection
2020-07-08 21:19:42 [INFO] - Network thread started
2020-07-08 21:19:42 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:19:45 [INFO] - Got a client!
2020-07-08 21:19:45 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:19:45 [INFO] - Next state: Status
2020-07-08 21:19:45 [INFO] - Ping number: MCLong { value: 7279794 }
2020-07-08 21:19:45 [INFO] - Client at 127.0.0.1:53784 closed connection
2020-07-08 21:20:07 [INFO] - Network thread started
2020-07-08 21:20:07 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:20:12 [INFO] - Got a client!
2020-07-08 21:20:12 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:20:12 [INFO] - Next state: Status
2020-07-08 21:20:12 [INFO] - Ping number: MCLong { value: 7306496 }
2020-07-08 21:20:12 [INFO] - Client at 127.0.0.1:54216 closed connection
2020-07-08 21:22:22 [INFO] - Network thread started
2020-07-08 21:22:22 [WARN] - Could not load config from composition.toml, using default config.
2020-07-08 21:22:22 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:22:26 [INFO] - Got a client!
2020-07-08 21:22:26 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:22:26 [INFO] - Next state: Status
2020-07-08 21:22:26 [INFO] - Ping number: MCLong { value: 7440272 }
2020-07-08 21:22:26 [INFO] - Client at 127.0.0.1:55792 closed connection
2020-07-08 21:23:10 [INFO] - Network thread started
2020-07-08 21:23:10 [WARN] - Could not load config from composition.toml, using default config.
2020-07-08 21:23:10 [IMPORTANT] - Started server on 127.0.0.1:25565
2020-07-08 21:23:13 [INFO] - Got a client!
2020-07-08 21:23:13 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "127.0.0.1" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:23:13 [INFO] - Next state: Status
2020-07-08 21:23:13 [INFO] - Ping number: MCLong { value: 7487517 }
2020-07-08 21:23:13 [INFO] - Client at 127.0.0.1:55872 closed connection
2020-07-08 21:08:05 [INFO] - Network thread started
2020-07-08 21:08:05 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:08:19 [INFO] - Got a client!
2020-07-08 21:08:19 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:08:19 [INFO] - Next state: Closed
2020-07-08 21:08:19 [INFO] - Client at 192.168.0.88:55408 closed connection
2020-07-08 21:08:19 [INFO] - Got a client!
2020-07-08 21:08:19 [INFO] - Handshake { protocol_version: MCVarInt { value: 11 }, server_address: MCString { value: "" }, server_port: MCUnsignedShort { value: 19712 }, next_state: MCVarInt { value: 67 } }
2020-07-08 21:08:19 [INFO] - Next state: Closed
2020-07-08 21:08:19 [INFO] - Client at 192.168.0.88:55409 closed connection
2020-07-08 21:08:59 [INFO] - Got a client!
2020-07-08 21:08:59 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:08:59 [INFO] - Next state: Closed
2020-07-08 21:08:59 [INFO] - Client at 192.168.0.88:55414 closed connection
2020-07-08 21:08:59 [INFO] - Got a client!
2020-07-08 21:08:59 [INFO] - Handshake { protocol_version: MCVarInt { value: 11 }, server_address: MCString { value: "" }, server_port: MCUnsignedShort { value: 19712 }, next_state: MCVarInt { value: 67 } }
2020-07-08 21:08:59 [INFO] - Next state: Closed
2020-07-08 21:08:59 [INFO] - Client at 192.168.0.88:55415 closed connection
2020-07-08 21:09:06 [INFO] - Got a client!
2020-07-08 21:09:06 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 21:09:06 [INFO] - Next state: Closed
2020-07-08 21:09:06 [INFO] - Client at 192.168.0.88:55416 closed connection
2020-07-08 21:10:30 [INFO] - Got a client!
2020-07-08 21:10:30 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:10:30 [INFO] - Next state: Status
2020-07-08 21:10:30 [INFO] - Ping number: MCLong { value: 28962 }
2020-07-08 21:10:30 [INFO] - Client at 192.168.0.88:55679 closed connection
2020-07-08 21:12:50 [INFO] - Network thread started
2020-07-08 21:12:50 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:12:58 [INFO] - Got a client!
2020-07-08 21:12:58 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:12:58 [INFO] - Next state: Status
2020-07-08 21:12:58 [INFO] - Ping number: MCLong { value: 177626 }
2020-07-08 21:12:58 [INFO] - Client at 192.168.0.88:55688 closed connection
2020-07-08 21:13:23 [INFO] - Got a client!
2020-07-08 21:13:23 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 21:13:23 [INFO] - Next state: Status
2020-07-08 21:13:23 [INFO] - Ping number: MCLong { value: 8029147796280267361 }
2020-07-08 21:13:23 [INFO] - Client at 192.168.0.88:55689 closed connection
2020-07-08 21:16:48 [INFO] - Network thread started
2020-07-08 21:16:48 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:17:03 [INFO] - Got a client!
2020-07-08 21:17:03 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:17:03 [INFO] - Next state: Status
2020-07-08 21:17:03 [INFO] - Ping number: MCLong { value: 422535 }
2020-07-08 21:17:03 [INFO] - Client at 192.168.0.88:55700 closed connection
2020-07-08 21:17:50 [INFO] - Got a client!
2020-07-08 21:17:50 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:17:50 [INFO] - Next state: Status
2020-07-08 21:17:50 [INFO] - Ping number: MCLong { value: 469501 }
2020-07-08 21:17:50 [INFO] - Client at 192.168.0.88:55706 closed connection
2020-07-08 21:18:17 [INFO] - Network thread started
2020-07-08 21:18:17 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:18:24 [INFO] - Got a client!
2020-07-08 21:18:24 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:18:24 [INFO] - Next state: Status
2020-07-08 21:18:24 [INFO] - Ping number: MCLong { value: 503077 }
2020-07-08 21:18:24 [INFO] - Client at 192.168.0.88:55712 closed connection
2020-07-08 21:18:31 [INFO] - Got a client!
2020-07-08 21:18:31 [INFO] - Handshake { protocol_version: MCVarInt { value: 47 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:18:31 [INFO] - Next state: Status
2020-07-08 21:18:32 [INFO] - Ping number: MCLong { value: 510863 }
2020-07-08 21:18:32 [INFO] - Client at 192.168.0.88:55718 closed connection
2020-07-08 21:18:40 [INFO] - Got a client!
2020-07-08 21:18:40 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:18:40 [INFO] - Next state: Status
2020-07-08 21:18:40 [INFO] - Ping number: MCLong { value: 519010 }
2020-07-08 21:18:40 [INFO] - Client at 192.168.0.88:55724 closed connection
2020-07-08 21:19:16 [INFO] - Got a client!
2020-07-08 21:19:16 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 21:19:16 [INFO] - Next state: Status
2020-07-08 21:19:16 [INFO] - Ping number: MCLong { value: 8029147796280267361 }
2020-07-08 21:19:16 [INFO] - Client at 192.168.0.88:55726 closed connection
2020-07-08 21:21:09 [INFO] - Got a client!
2020-07-08 21:21:09 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 21:21:09 [INFO] - Next state: Status
2020-07-08 21:21:09 [INFO] - Ping number: MCLong { value: 8029147796280267361 }
2020-07-08 21:21:09 [INFO] - Client at 192.168.0.88:55732 closed connection
2020-07-08 21:22:38 [INFO] - Network thread started
2020-07-08 21:22:38 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:22:48 [INFO] - Got a client!
2020-07-08 21:22:48 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:22:48 [INFO] - Next state: Status
2020-07-08 21:22:48 [INFO] - Ping number: MCLong { value: 767030 }
2020-07-08 21:22:48 [INFO] - Client at 192.168.0.88:55738 closed connection
2020-07-08 21:23:06 [INFO] - Got a client!
2020-07-08 21:23:06 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:23:06 [INFO] - Next state: Status
2020-07-08 21:23:06 [INFO] - Ping number: MCLong { value: 785172 }
2020-07-08 21:23:06 [INFO] - Client at 192.168.0.88:55744 closed connection
2020-07-08 21:23:12 [INFO] - Got a client!
2020-07-08 21:23:12 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 21:23:12 [INFO] - Next state: Closed
2020-07-08 21:23:12 [INFO] - Client at 192.168.0.88:55745 closed connection
2020-07-08 21:38:26 [INFO] - Network thread started
2020-07-08 21:38:26 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:38:38 [INFO] - Got a client!
2020-07-08 21:38:38 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:38:38 [INFO] - Next state: Status
2020-07-08 21:38:38 [ERROR] - Error when handling client: failed to fill whole buffer
2020-07-08 21:38:38 [INFO] - Got a client!
2020-07-08 21:38:38 [INFO] - Handshake { protocol_version: MCVarInt { value: 11 }, server_address: MCString { value: "" }, server_port: MCUnsignedShort { value: 19712 }, next_state: MCVarInt { value: 67 } }
2020-07-08 21:38:38 [INFO] - Next state: Closed
2020-07-08 21:38:38 [INFO] - Client at 192.168.0.88:55778 closed connection
2020-07-08 21:39:45 [INFO] - Network thread started
2020-07-08 21:39:45 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:39:52 [INFO] - Got a client!
2020-07-08 21:39:52 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:39:52 [INFO] - Next state: Status
2020-07-08 21:40:01 [ERROR] - Error when handling client: Connection reset by peer (os error 54)
2020-07-08 21:40:04 [INFO] - Got a client!
2020-07-08 21:40:04 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:40:04 [INFO] - Next state: Status
2020-07-08 21:40:04 [INFO] - Ping number: MCLong { value: 1803114 }
2020-07-08 21:40:04 [INFO] - Client at 192.168.0.88:55790 closed connection
2020-07-08 21:40:16 [INFO] - Got a client!
2020-07-08 21:40:16 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:40:16 [INFO] - Next state: Status
2020-07-08 21:40:16 [INFO] - Ping number: MCLong { value: 1815195 }
2020-07-08 21:40:16 [INFO] - Client at 192.168.0.88:55796 closed connection
2020-07-08 21:40:47 [INFO] - Network thread started
2020-07-08 21:40:47 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:40:59 [INFO] - Got a client!
2020-07-08 21:40:59 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:40:59 [INFO] - Next state: Status
2020-07-08 21:41:00 [INFO] - Ping number: MCLong { value: 1858861 }
2020-07-08 21:41:00 [INFO] - Client at 192.168.0.88:55802 closed connection
2020-07-08 21:54:37 [INFO] - Network thread started
2020-07-08 21:54:37 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:54:45 [INFO] - Got a client!
2020-07-08 21:54:45 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:54:45 [INFO] - Next state: Status
2020-07-08 21:54:45 [INFO] - Ping number: MCLong { value: 2684003 }
2020-07-08 21:54:45 [INFO] - Client at 192.168.0.88:55845 closed connection
2020-07-08 21:54:54 [INFO] - Got a client!
2020-07-08 21:54:54 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:54:54 [INFO] - Next state: Status
2020-07-08 21:54:54 [INFO] - Ping number: MCLong { value: 2693231 }
2020-07-08 21:54:54 [INFO] - Client at 192.168.0.88:55851 closed connection
2020-07-08 22:08:35 [INFO] - Network thread started
2020-07-08 22:08:35 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 22:08:42 [INFO] - Got a client!
2020-07-08 22:08:42 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:08:42 [INFO] - Next state: Status
2020-07-08 22:08:42 [INFO] - Ping number: MCLong { value: 3521389 }
2020-07-08 22:08:42 [INFO] - Client at 192.168.0.88:55885 closed connection
2020-07-08 22:08:49 [INFO] - Got a client!
2020-07-08 22:08:49 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:08:49 [INFO] - Next state: Status
2020-07-08 22:08:49 [INFO] - Ping number: MCLong { value: 3528562 }
2020-07-08 22:08:49 [INFO] - Client at 192.168.0.88:55891 closed connection
2020-07-08 22:15:19 [INFO] - Network thread started
2020-07-08 22:15:19 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 22:15:39 [INFO] - Got a client!
2020-07-08 22:15:39 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:15:39 [INFO] - Next state: Status
2020-07-08 22:15:39 [INFO] - Ping number: MCLong { value: 3938584 }
2020-07-08 22:15:39 [INFO] - Client at 192.168.0.88:55909 closed connection
2020-07-08 22:23:14 [INFO] - Network thread started
2020-07-08 22:23:14 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 22:23:20 [INFO] - Got a client!
2020-07-08 22:23:20 [INFO] - Handshake { protocol_version: MCVarInt { value: 498 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:23:20 [INFO] - Next state: Status
2020-07-08 22:23:20 [INFO] - Ping number: MCLong { value: 4398964 }
2020-07-08 22:23:20 [INFO] - Client at 192.168.0.88:55921 closed connection
2020-07-08 22:23:22 [INFO] - Got a client!
2020-07-08 22:23:22 [INFO] - Handshake { protocol_version: MCVarInt { value: 498 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:23:22 [INFO] - Next state: Status
2020-07-08 22:23:22 [INFO] - Ping number: MCLong { value: 4401109 }
2020-07-08 22:23:22 [INFO] - Client at 192.168.0.88:55927 closed connection
2020-07-08 22:23:41 [INFO] - Got a client!
2020-07-08 22:23:42 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:23:42 [INFO] - Next state: Status
2020-07-08 22:23:42 [INFO] - Ping number: MCLong { value: 4420928 }
2020-07-08 22:23:42 [INFO] - Client at 192.168.0.88:55934 closed connection
2020-07-08 22:25:40 [INFO] - Got a client!
2020-07-08 22:25:40 [INFO] - Handshake { protocol_version: MCVarInt { value: 316 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:25:40 [INFO] - Next state: Status
2020-07-08 22:25:40 [INFO] - Ping number: MCLong { value: 4539076 }
2020-07-08 22:25:40 [INFO] - Client at 192.168.0.88:55943 closed connection
2020-07-09 14:07:50 [INFO] - Network thread started
2020-07-09 14:07:50 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-09 14:07:59 [INFO] - Got a client!
2020-07-09 14:07:59 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-09 14:07:59 [INFO] - Next state: Login
2020-07-09 14:07:59 [INFO] - LoginStart { username: MCString { value: "NomCafeRage" } }
2020-07-09 14:08:02 [INFO] - NameUUID { id: "3dc562e61c9047e4b5b02cd10cd895f2", name: "NomCafeRage", legacy: false, demo: false }
2020-07-09 14:08:02 [INFO] - Long UUID: "3dc562e6-1c90-47e4-b5b0-2cd10cd895f2"
2020-07-09 14:14:11 [INFO] - Network thread started
2020-07-09 14:14:11 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-09 14:15:04 [INFO] - Got a client!
2020-07-09 14:15:04 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-09 14:15:04 [INFO] - Next state: Login
2020-07-09 14:15:04 [INFO] - LoginStart { username: MCString { value: "NomCafeRage" } }
2020-07-09 14:15:07 [INFO] - NameUUID { id: "3dc562e61c9047e4b5b02cd10cd895f2", name: "NomCafeRage", legacy: false, demo: false }
2020-07-09 14:15:07 [INFO] - Long UUID: "3dc562e6-1c90-47e4-b5b0-2cd10cd895f2"

View File

@ -1,175 +1,40 @@
2020-07-27 11:25:17 [ERROR] - panicked at 'Normal panic', src/main.rs:55:5
2020-07-27 11:25:18 [ERROR] - panicked at 'Normal panic', src/main.rs:55:5
0: backtrace::backtrace::libunwind::trace
at /Users/gt/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.50/src/backtrace/libunwind.rs:95
backtrace::backtrace::trace_unsynchronized
at /Users/gt/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.50/src/backtrace/mod.rs:66
1: backtrace::backtrace::trace
at /Users/gt/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.50/src/backtrace/mod.rs:53
2: backtrace::capture::Backtrace::create
at /Users/gt/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.50/src/capture.rs:164
3: backtrace::capture::Backtrace::new
at /Users/gt/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.50/src/capture.rs:128
4: Composition::main::{{closure}}
at src/main.rs:52
5: std::panicking::rust_panic_with_hook
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/panicking.rs:475
6: std::panicking::begin_panic
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/panicking.rs:404
7: Composition::main
at src/main.rs:55
8: std::rt::lang_start::{{closure}}
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:67
9: std::rt::lang_start_internal::{{closure}}
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:52
std::panicking::try::do_call
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/panicking.rs:292
10: __rust_maybe_catch_panic
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libpanic_unwind/lib.rs:78
11: std::panicking::try
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/panicking.rs:270
std::panic::catch_unwind
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/panic.rs:394
std::rt::lang_start_internal
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:51
12: std::rt::lang_start
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:67
13: _main
2020-07-27 11:26:38 [ERROR] - panicked at 'Normal panic', src/main.rs:54:5
0: backtrace::backtrace::libunwind::trace
at /Users/gt/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.50/src/backtrace/libunwind.rs:95
backtrace::backtrace::trace_unsynchronized
at /Users/gt/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.50/src/backtrace/mod.rs:66
1: backtrace::backtrace::trace
at /Users/gt/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.50/src/backtrace/mod.rs:53
2: backtrace::capture::Backtrace::create
at /Users/gt/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.50/src/capture.rs:164
3: backtrace::capture::Backtrace::new
at /Users/gt/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.50/src/capture.rs:128
4: Composition::main::{{closure}}
at src/main.rs:51
5: std::panicking::rust_panic_with_hook
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/panicking.rs:475
6: std::panicking::begin_panic
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/panicking.rs:404
7: Composition::main
at src/main.rs:54
8: std::rt::lang_start::{{closure}}
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:67
9: std::rt::lang_start_internal::{{closure}}
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:52
std::panicking::try::do_call
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/panicking.rs:292
10: __rust_maybe_catch_panic
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libpanic_unwind/lib.rs:78
11: std::panicking::try
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/panicking.rs:270
std::panic::catch_unwind
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/panic.rs:394
std::rt::lang_start_internal
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:51
12: std::rt::lang_start
at /rustc/5e1a799842ba6ed4a57e91f7ab9435947482f7d8/src/libstd/rt.rs:67
13: _main
2020-07-27 11:30:23 [INFO] - Starting server...
2020-07-27 11:30:46 [INFO] - Starting server...
2020-07-27 11:31:01 [INFO] - Starting server
2020-07-27 11:40:10 [INFO] - Starting server...
2020-07-27 11:40:10 [INFO] - Done! Start took 763.52µs
2020-07-27 11:40:51 [INFO] - Starting server...
2020-07-27 11:40:51 [INFO] - Done! Start took 820.196µs
2020-07-27 11:47:37 [INFO] - Starting server...
2020-07-27 11:47:37 [INFO] - Done! Start took 441.888µs
2020-07-27 12:51:18 [INFO] - Starting server...
2020-07-27 12:51:18 [INFO] - Done! Start took 929.466µs
2020-07-27 13:14:52 [INFO] - Starting server...
2020-07-27 13:14:52 [INFO] - Starting network server...
2020-07-27 13:14:52 [INFO] - Done! Start took 829.689µs
2020-07-27 17:14:52 [INFO] - Starting server...
2020-07-27 17:14:52 [INFO] - Done! Start took 920.073µs
2020-07-27 17:14:52 [INFO] - Starting network...
2020-07-27 17:14:52 [INFO] - []
2020-07-27 17:14:52 [INFO] - []
2020-07-27 17:14:52 [INFO] - []
2020-07-27 17:14:52 [INFO] - []
2020-07-27 17:14:52 [INFO] - []
2020-07-27 17:14:52 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:53 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:54 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:55 [INFO] - []
2020-07-27 17:14:56 [INFO] - []
2020-07-27 17:14:56 [INFO] - []
2020-07-27 17:14:56 [INFO] - []
2020-07-27 17:28:01 [INFO] - Starting server...
2020-07-27 17:28:01 [INFO] - Done! Start took 1.079011ms
2020-07-27 17:28:01 [INFO] - Starting network...
2020-07-27 17:28:32 [INFO] - Starting server...
2020-07-27 17:28:32 [INFO] - Done! Start took 891.237µs
2020-07-27 17:30:03 [INFO] - Starting server...
2020-07-27 17:30:03 [INFO] - Done! Start took 889.43µs
2020-07-27 17:30:39 [INFO] - Starting server...
2020-07-27 17:30:39 [INFO] - Done! Start took 668.524µs
2020-07-27 17:32:13 [DEBUG] - Network received client: NetworkClient { id: 0, state: Handshake, alive: true, stream: BufReader { reader: TcpStream { addr: V4(127.0.0.1:25565), peer: V4(127.0.0.1:58986), fd: 5 }, buffer: 0/8192 }, username: None, packets: [] }
2020-07-27 17:32:13 [DEBUG] - Network received client: NetworkClient { id: 1, state: Handshake, alive: true, stream: BufReader { reader: TcpStream { addr: V4(127.0.0.1:25565), peer: V4(127.0.0.1:58988), fd: 5 }, buffer: 0/8192 }, username: None, packets: [] }
2020-07-27 17:37:57 [INFO] - Starting server...
2020-07-27 17:37:57 [INFO] - Done! Start took 1.007552ms
2020-07-27 18:15:45 [INFO] - Starting server...
2020-07-27 18:15:45 [INFO] - Done! Start took 812.588µs
[2020-08-17 16:41:40][Composition][INFO] Starting server...
[2020-08-17 16:41:40][Composition::net][INFO] Network server started!
[2020-08-17 16:41:40][Composition][INFO] Done! Start took 1.023788ms
[2020-08-17 16:41:50][Composition][INFO] Starting server...
[2020-08-17 16:41:50][Composition::net][INFO] Network server started!
[2020-08-17 16:41:50][Composition][INFO] Done! Start took 1.005714ms
[2020-08-17 16:42:32][Composition::net][INFO] Got client at 127.0.0.1:51769
[2020-08-17 17:11:43][Composition][INFO] Starting server...
[2020-08-17 17:11:43][Composition::net][INFO] Network server started!
[2020-08-17 17:11:43][Composition][INFO] Done! Start took 1.245737ms
[2020-08-17 17:14:54][Composition][INFO] Starting server...
[2020-08-17 17:14:54][Composition::net][INFO] Network server started!
[2020-08-17 17:14:54][Composition][INFO] Done! Start took 1.252385ms
[2020-08-17 17:15:41][Composition::net][INFO] Got client at 127.0.0.1:56994
[2020-08-17 21:14:58][Composition][INFO] Starting server...
[2020-08-17 21:14:58][Composition::net][INFO] Network server started!
[2020-08-17 21:14:58][Composition][INFO] Done! Start took 1.787424ms
[2020-08-17 21:15:32][Composition::net][INFO] Got client at 127.0.0.1:52811
[2020-08-17 21:17:01][Composition][INFO] Starting server...
[2020-08-17 21:17:01][Composition::net][INFO] Network server started!
[2020-08-17 21:17:01][Composition][INFO] Done! Start took 1.242146ms
[2020-08-17 21:17:04][Composition::net][INFO] Got client at 127.0.0.1:52841
[2020-08-17 21:18:13][Composition][INFO] Starting server...
[2020-08-17 21:18:13][Composition::net][INFO] Network server started!
[2020-08-17 21:18:13][Composition][INFO] Done! Start took 1.033613ms
[2020-08-17 21:18:15][Composition::net][INFO] Got client at 127.0.0.1:52847
[2020-08-17 21:18:25][Composition::net][INFO] Got client at 127.0.0.1:52850
[2020-08-17 21:18:52][Composition::net][INFO] Got client at 127.0.0.1:52855
[2020-08-17 21:23:47][Composition][INFO] Starting server...
[2020-08-17 21:23:47][Composition::net][INFO] Network server started!
[2020-08-17 21:23:47][Composition][INFO] Done! Start took 966.985µs
[2020-08-17 21:23:49][Composition::net][INFO] Got client at 127.0.0.1:52879
[2020-08-17 21:37:35][Composition][INFO] Starting server...
[2020-08-17 21:37:35][Composition::net][INFO] Network server started!
[2020-08-17 21:37:35][Composition][INFO] Done! Start took 1.448375ms
[2020-08-17 21:37:44][Composition::net][INFO] Got client at 127.0.0.1:53276
[2020-08-18 08:15:48][Composition][INFO] Starting server...
[2020-08-18 08:15:48][Composition::net][INFO] Network server started!
[2020-08-18 08:15:48][Composition][INFO] Done! Start took 1.853066ms
[2020-08-18 08:15:55][Composition::net][INFO] Got client at 127.0.0.1:56532

View File

@ -1,37 +1,27 @@
// main.rs
// authors: Garen Tyler, Danton Hou
// description:
// Initializes the server, main server loop.
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(unused_imports)]
#![allow(non_snake_case)]
extern crate backtrace;
extern crate fern;
extern crate log;
extern crate serde;
pub mod network;
pub mod mctypes;
pub mod net;
pub mod server;
extern crate chrono;
extern crate fern;
use backtrace::Backtrace;
use fern::colors::{Color, ColoredLevelConfig};
use log::{debug, error, info, warn};
use network::NetworkServer;
use serde::{Deserialize, Serialize};
use server::{Server, ServerConfig};
use std::sync::mpsc::{self, Receiver, Sender};
use net::NetworkServer;
use server::GameServer;
use std::time::{Duration, Instant};
fn main() {
// Setup logging.
pub fn main() {
let start_time = Instant::now();
// Set up fern logging.
fern::Dispatch::new()
.format(move |out, message, record| {
out.finish(format_args!(
"{date} [{level}] - {message}",
"[{date}][{target}][{level}] {message}",
date = chrono::Local::now().format("%Y-%m-%d %H:%M:%S"),
// target = record.target(),
target = record.target(),
level = record.level(),
message = message,
))
@ -41,33 +31,16 @@ fn main() {
.chain(fern::log_file("output.log").unwrap())
.apply()
.unwrap();
std::panic::set_hook(Box::new(|panic_info| {
let backtrace = Backtrace::new();
error!("{}\n{:?}", panic_info.to_string(), backtrace);
}));
info!("Starting server...");
let start_time = Instant::now();
let config = ServerConfig::from_file("composition.toml");
let port = config.port;
// Create the message channels.
let (tx, rx) = mpsc::channel();
// Create the server.
let mut server = Server {
config,
receiver: rx,
network: NetworkServer::new(port),
};
// Start the network.
let network = NetworkServer::new("0.0.0.0:25565");
let mut server = GameServer { network: network };
info!("Done! Start took {:?}", start_time.elapsed());
// The main server loop.
loop {
server.update(); // Do the tick.
std::thread::sleep(Duration::from_millis(50));
server.update();
std::thread::sleep(Duration::from_millis(2));
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,188 +0,0 @@
// net.rs
// authors: Garen Tyler, Danton Hou
// description:
// The module with everything to do with networkng.
extern crate mojang_api;
extern crate ozelot;
extern crate radix64;
use crate::mctypes::*;
use crate::protocol::*;
use crate::{config, log};
use mojang_api::*;
use ozelot::mojang::*;
use std::net::{TcpListener, TcpStream};
use std::thread::sleep;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
pub fn start_listening() {
let server_address: &str = &format!("0.0.0.0:{}", config.port);
let listener = TcpListener::bind(server_address);
if listener.is_err() {
log.error("Could not start listener");
} else {
log.important(&format!("Started server on {}", server_address));
for stream in listener.unwrap().incoming() {
if stream.is_err() {
log.error("Could not connect to client");
} else {
std::thread::spawn(move || {
if let Err(e) = handle_client(stream.unwrap()) {
log.error(&format!("Error when handling client: {}", e));
}
});
}
}
}
}
fn handle_client(t: TcpStream) -> std::io::Result<()> {
log.info("Got a client!");
let mut gc = GameConnection {
stream: t,
state: GameState::Handshake,
protocol_version: 0,
};
'main: loop {
match gc.state {
GameState::Handshake => {
// Read the handshake packet.
let (_packet_len, _packet_id) = read_packet_header(&mut gc.stream)?;
let handshake = Handshake::read(&mut gc.stream)?;
log.info(&format!("{:?}", handshake));
gc.state = if handshake.protocol_version.value != config.protocol_version as i32
&& handshake.next_state.value == 2
{
GameState::Closed
} else {
match handshake.next_state.value {
1 => GameState::Status,
2 => GameState::Login,
_ => GameState::Closed,
}
};
log.info(&format!("Next state: {:?}", gc.state));
gc.protocol_version = handshake.protocol_version.value as u16;
}
GameState::Status => {
// Read the request packet.
let (_request_packet_len, _request_packet_id) = read_packet_header(&mut gc.stream)?;
// Send the response packet.
log.warn("Server favicon not working correctly. Fix this in issue #4");
let mut base64_encoded_favicon = "".to_owned();
let a = || -> std::io::Result<Vec<u8>> {
// Only call this if config.favicon is not None, or it'll panic.
use std::fs::File;
use std::io::prelude::*;
let mut file = File::open(config.favicon.as_ref().unwrap())?;
let mut buffer = Vec::new();
file.read_to_end(&mut buffer)?;
Ok(buffer)
};
if config.favicon.is_some() {
let temp = a();
if let Ok(s) = temp {
base64_encoded_favicon = radix64::STD.encode(&s);
} else {
println!("{:?}", temp);
}
}
let response = MCString::from(format!("{{\n\t\"version\": {{\n\t\t\"name\": \"Composition 1.15.2\",\n\t\t\"protocol\": {}\n\t}},\n\t\"players\": {{\n\t\t\"max\": {},\n\t\t\"online\": 2147483648,\n\t\t\"sample\": [\n\t\t\t{{\n\t\t\t\t\"name\": \"fumolover12\",\n\t\t\t\t\"id\": \"4566e69f-c907-48ee-8d71-d7ba5aa00d20\"\n\t\t\t}}\n\t\t]\n\t}},\n\t\"description\": {{\n\t\t\"text\": \"{}\"\n\t}},\n\t\"favicon\": \"data:image/png;base64,{}\"\n}}", config.protocol_version, config.max_players, config.motd, base64_encoded_favicon));
let packet_id = MCVarInt::from(0x00);
let packet_len = MCVarInt::from(
packet_id.to_bytes().len() as i32 + response.to_bytes().len() as i32,
);
for b in packet_len.to_bytes() {
write_byte(&mut gc.stream, b)?;
}
for b in packet_id.to_bytes() {
write_byte(&mut gc.stream, b)?;
}
for b in response.to_bytes() {
write_byte(&mut gc.stream, b)?;
}
// Read the ping packet.
let (_ping_packet_len, _ping_packet_id) = read_packet_header(&mut gc.stream)?;
let num = MCLong::from_stream(&mut gc.stream)?;
log.info(&format!("Ping number: {:?}", num));
// Send the pong packet.
let packet_id = MCVarInt::from(0x01);
let packet_len = MCVarInt::from(packet_id.to_bytes().len() as i32 + 8i32);
for b in packet_len.to_bytes() {
write_byte(&mut gc.stream, b)?;
}
for b in packet_id.to_bytes() {
write_byte(&mut gc.stream, b)?;
}
for b in num.to_bytes() {
write_byte(&mut gc.stream, b)?;
}
gc.state = GameState::Closed;
}
GameState::Login => {
// Read the login start packet.
let (_packet_len, _packet_id) = read_packet_header(&mut gc.stream)?;
let login = LoginStart::read(&mut gc.stream)?;
log.info(&format!("{:?}", login));
let packet_id = MCVarInt::from(0x02);
let packet_len = MCVarInt::from(packet_id.to_bytes().len() as i32 + 54i32);
let nameUUIDbundle =
ozelot::mojang::NameToUUID::new(login.clone().username.value, None)
.perform()
.unwrap();
let username = nameUUIDbundle.name;
let mut hyphenatedUUID = nameUUIDbundle.id;
hyphenatedUUID.insert(8, '-');
hyphenatedUUID.insert(13, '-');
hyphenatedUUID.insert(18, '-');
hyphenatedUUID.insert(23, '-');
let login_success_packet =
LoginSuccess::new(MCString::from(hyphenatedUUID), MCString::from(username));
let mut bytes = Vec::new();
for b in packet_id.to_bytes() {
bytes.push(b);
}
for b in login_success_packet.to_bytes() {
bytes.push(b);
}
for b in MCVarInt::from(bytes.len() as i32).to_bytes() {
write_byte(&mut gc.stream, b)?;
}
for b in bytes {
write_byte(&mut gc.stream, b)?;
}
log.info(&format!("{:?}", login_success_packet));
gc.state = GameState::Play;
}
GameState::Play => {}
GameState::Closed => {
log.info(&format!(
"Client at {} closed connection",
gc.stream.peer_addr().unwrap()
));
break 'main;
}
}
}
Ok(())
}
#[allow(dead_code)]
#[derive(PartialEq, Debug)]
pub enum GameState {
Handshake,
Status,
Login,
Play,
Closed,
}
#[allow(dead_code)]
pub struct GameConnection {
pub stream: TcpStream,
pub state: GameState,
pub protocol_version: u16,
}

148
src/net/mod.rs Normal file
View File

@ -0,0 +1,148 @@
pub mod packets;
use crate::mctypes::*;
use log::{debug, error, info, warn};
use packets::*;
use std::net::{TcpListener, TcpStream, ToSocketAddrs};
use std::sync::mpsc::{self, Receiver, Sender, TryRecvError};
pub struct NetworkServer {
pub clients: Vec<NetworkClient>,
receiver: Receiver<NetworkClient>,
}
impl NetworkServer {
pub fn new<A: 'static + ToSocketAddrs + Send>(addr: A) -> NetworkServer {
let (tx, rx) = mpsc::channel();
std::thread::spawn(move || {
let listener = TcpListener::bind(addr).expect("Could not bind to TCP socket");
for (id, stream) in listener.incoming().enumerate() {
if let Ok(s) = stream {
tx.send(NetworkClient {
id: id as u128,
connected: true,
stream: s,
state: NetworkClientState::Handshake,
})
.expect("Network receiver disconnected");
}
}
});
info!("Network server started!");
NetworkServer {
clients: vec![],
receiver: rx,
}
}
pub fn update(&mut self) {
loop {
match self.receiver.try_recv() {
Ok(client) => {
info!(
"Got client at {}",
client.stream.peer_addr().expect("Could not get peer addr")
);
self.clients.push(client)
}
Err(TryRecvError::Empty) => break,
Err(TryRecvError::Disconnected) => panic!("Network sender disconnected"),
}
}
for client in self.clients.iter_mut() {
client.update();
}
}
}
pub enum NetworkClientState {
Handshake,
Status,
Login,
Play,
Disconnected,
}
pub struct NetworkClient {
pub id: u128,
pub connected: bool,
pub stream: TcpStream,
pub state: NetworkClientState,
}
impl NetworkClient {
pub fn update(&mut self) {
match self.state {
NetworkClientState::Handshake => {
let (_packet_length, _packet_id) = read_packet_header(&mut self.stream).unwrap();
let handshake = Handshake::read(&mut self.stream).unwrap();
// Minecraft versions 1.8 - 1.8.9 use protocol version 47.
let compatible_versions = handshake.protocol_version == 47;
let next_state = match handshake.next_state.into() {
1 => NetworkClientState::Status,
2 => NetworkClientState::Login,
_ => NetworkClientState::Disconnected,
};
self.state = next_state;
// If incompatible versions or wrong next state
if !compatible_versions {
let mut logindisconnect = LoginDisconnect::new();
logindisconnect.reason = MCChat {
text: MCString::from("Incompatible client! Server is on 1.8.9"),
};
logindisconnect.write(&mut self.stream).unwrap();
self.state = NetworkClientState::Disconnected;
}
println!("{:?}", handshake);
}
NetworkClientState::Status => {
let (_packet_length, _packet_id) = read_packet_header(&mut self.stream).unwrap();
let statusrequest = StatusRequest::read(&mut self.stream).unwrap();
println!("{:?}", statusrequest);
let mut statusresponse = StatusResponse::new();
statusresponse.json_response = r#"{
"version": {
"name": "1.8.7",
"protocol": 47
},
"players": {
"max": 100,
"online": 5,
"sample": [
{
"name": "thinkofdeath",
"id": "4566e69f-c907-48ee-8d71-d7ba5aa00d20"
}
]
},
"description": {
"text": "Hello world"
},
"sample": ""
}"#
.into();
statusresponse.write(&mut self.stream).unwrap();
println!("{:?}", statusresponse);
let (_packet_length, _packet_id) = read_packet_header(&mut self.stream).unwrap();
let statusping = StatusPing::read(&mut self.stream).unwrap();
println!("{:?}", statusping);
let mut statuspong = StatusPong::new();
statuspong.payload = statusping.payload;
statuspong.write(&mut self.stream).unwrap();
self.state = NetworkClientState::Disconnected;
}
NetworkClientState::Login => {
let (_packet_length, _packet_id) = read_packet_header(&mut self.stream).unwrap();
let loginstart = LoginStart::read(&mut self.stream).unwrap();
println!("{:?}", loginstart);
// Offline mode skips encryption and compression.
let mut loginsuccess = LoginSuccess::new();
// We're in offline mode, so this is a temporary uuid.
loginsuccess.uuid = "00000000-0000-3000-0000-000000000000".into();
loginsuccess.username = loginstart.player_name;
loginsuccess.write(&mut self.stream).unwrap();
println!("{:?}", loginsuccess);
self.state = NetworkClientState::Play;
}
NetworkClientState::Play => {}
NetworkClientState::Disconnected => {
self.connected = false;
}
}
}
}

View File

@ -0,0 +1,166 @@
use super::Packet;
use crate::mctypes::*;
use std::convert::{Into, TryFrom};
use std::net::TcpStream;
#[derive(Debug, Clone)]
pub struct StatusResponse {
pub json_response: MCString,
}
impl Into<Vec<u8>> for StatusResponse {
fn into(self) -> Vec<u8> {
let mut out = vec![];
let mut temp: Vec<u8> = MCVarInt::from(0x00).into(); // 0x00 Status Response.
temp.extend_from_slice(&Into::<Vec<u8>>::into(self.json_response));
out.extend_from_slice(&Into::<Vec<u8>>::into(MCVarInt::from(temp.len() as i32)));
out.extend_from_slice(&temp);
out
}
}
impl TryFrom<Vec<u8>> for StatusResponse {
type Error = &'static str;
fn try_from(_bytes: Vec<u8>) -> Result<Self, Self::Error> {
Err("unimplemented")
}
}
impl Packet for StatusResponse {
fn new() -> Self {
StatusResponse {
json_response: MCString::from(""),
}
}
fn read(t: &mut TcpStream) -> std::io::Result<Self> {
let mut statusresponse = StatusResponse::new();
statusresponse.json_response = MCString::read(t)?;
Ok(statusresponse)
}
fn write(&self, t: &mut TcpStream) -> std::io::Result<()> {
for b in Into::<Vec<u8>>::into(self.clone()) {
write_byte(t, b)?;
}
Ok(())
}
}
#[derive(Debug, Clone)]
pub struct StatusPong {
pub payload: MCLong,
}
impl Into<Vec<u8>> for StatusPong {
fn into(self) -> Vec<u8> {
let mut out = vec![];
let mut temp: Vec<u8> = MCVarInt::from(0x01).into(); // 0x01 Status Pong.
temp.extend_from_slice(&Into::<Vec<u8>>::into(self.payload));
out.extend_from_slice(&Into::<Vec<u8>>::into(MCVarInt::from(temp.len() as i32)));
out.extend_from_slice(&temp);
out
}
}
impl TryFrom<Vec<u8>> for StatusPong {
type Error = &'static str;
fn try_from(_bytes: Vec<u8>) -> Result<Self, Self::Error> {
Err("unimplemented")
}
}
impl Packet for StatusPong {
fn new() -> Self {
StatusPong { payload: 0.into() }
}
fn read(t: &mut TcpStream) -> std::io::Result<Self> {
let mut statuspong = StatusPong::new();
statuspong.payload = MCLong::read(t)?;
Ok(statuspong)
}
fn write(&self, t: &mut TcpStream) -> std::io::Result<()> {
for b in Into::<Vec<u8>>::into(self.clone()) {
write_byte(t, b)?;
}
Ok(())
}
}
#[derive(Debug, Clone)]
pub struct LoginSuccess {
pub uuid: MCString,
pub username: MCString,
}
impl Into<Vec<u8>> for LoginSuccess {
fn into(self) -> Vec<u8> {
let mut out = vec![];
let mut temp: Vec<u8> = MCVarInt::from(0x02).into(); // 0x02 Login Success.
temp.extend_from_slice(&Into::<Vec<u8>>::into(self.uuid));
temp.extend_from_slice(&Into::<Vec<u8>>::into(self.username));
out.extend_from_slice(&Into::<Vec<u8>>::into(MCVarInt::from(temp.len() as i32)));
out.extend_from_slice(&temp);
out
}
}
impl TryFrom<Vec<u8>> for LoginSuccess {
type Error = &'static str;
fn try_from(_bytes: Vec<u8>) -> Result<Self, Self::Error> {
Err("unimplemented")
}
}
impl Packet for LoginSuccess {
fn new() -> Self {
LoginSuccess {
uuid: MCString::from(""),
username: MCString::from(""),
}
}
fn read(t: &mut TcpStream) -> std::io::Result<Self> {
let mut loginsuccess = LoginSuccess::new();
loginsuccess.uuid = MCString::read(t)?;
loginsuccess.username = MCString::read(t)?;
Ok(loginsuccess)
}
fn write(&self, t: &mut TcpStream) -> std::io::Result<()> {
for b in Into::<Vec<u8>>::into(self.clone()) {
write_byte(t, b)?;
}
Ok(())
}
}
#[derive(Debug, Clone)]
pub struct LoginDisconnect {
pub reason: MCChat,
}
impl Into<Vec<u8>> for LoginDisconnect {
fn into(self) -> Vec<u8> {
let mut out = vec![];
let mut temp: Vec<u8> = MCVarInt::from(0x00).into(); // 0x00 Login Disconnect.
temp.extend_from_slice(&Into::<Vec<u8>>::into(self.reason));
out.extend_from_slice(&Into::<Vec<u8>>::into(MCVarInt::from(temp.len() as i32)));
out.extend_from_slice(&temp);
out
}
}
impl TryFrom<Vec<u8>> for LoginDisconnect {
type Error = &'static str;
fn try_from(_bytes: Vec<u8>) -> Result<Self, Self::Error> {
Err("unimplemented")
}
}
impl Packet for LoginDisconnect {
fn new() -> Self {
LoginDisconnect {
reason: MCChat {
text: MCString::from(""),
},
}
}
fn read(t: &mut TcpStream) -> std::io::Result<Self> {
let mut logindisconnect = LoginDisconnect::new();
logindisconnect.reason = MCChat {
text: MCString::read(t)?,
};
Ok(logindisconnect)
}
fn write(&self, t: &mut TcpStream) -> std::io::Result<()> {
for b in Into::<Vec<u8>>::into(self.clone()) {
write_byte(t, b)?;
}
Ok(())
}
}

20
src/net/packets/mod.rs Normal file
View File

@ -0,0 +1,20 @@
pub mod clientbound;
pub mod serverbound;
use crate::mctypes::{MCType, MCVarInt};
pub use clientbound::*;
pub use serverbound::*;
use std::convert::{Into, TryFrom};
use std::net::TcpStream;
pub trait Packet: Into<Vec<u8>> + TryFrom<Vec<u8>> {
fn new() -> Self;
fn read(_stream: &mut TcpStream) -> std::io::Result<Self>;
fn write(&self, _stream: &mut TcpStream) -> std::io::Result<()>;
}
pub fn read_packet_header(t: &mut TcpStream) -> std::io::Result<(MCVarInt, MCVarInt)> {
let length = MCVarInt::read(t)?;
let id = MCVarInt::read(t)?;
Ok((length, id))
}

View File

@ -0,0 +1,164 @@
use super::Packet;
use crate::mctypes::*;
use std::convert::{Into, TryFrom};
use std::net::TcpStream;
#[derive(Debug, Clone)]
pub struct Handshake {
pub protocol_version: MCVarInt,
pub server_address: MCString,
pub server_port: MCUnsignedShort,
pub next_state: MCVarInt,
}
impl Into<Vec<u8>> for Handshake {
fn into(self) -> Vec<u8> {
let mut out = vec![];
let mut temp: Vec<u8> = MCVarInt::from(0x00).into(); // 0x00 Handshake.
temp.extend_from_slice(&Into::<Vec<u8>>::into(self.protocol_version));
temp.extend_from_slice(&Into::<Vec<u8>>::into(self.server_address));
temp.extend_from_slice(&Into::<Vec<u8>>::into(self.server_port));
temp.extend_from_slice(&Into::<Vec<u8>>::into(self.next_state));
out.extend_from_slice(&Into::<Vec<u8>>::into(MCVarInt::from(temp.len() as i32)));
out.extend_from_slice(&temp);
out
}
}
impl TryFrom<Vec<u8>> for Handshake {
type Error = &'static str;
fn try_from(_bytes: Vec<u8>) -> Result<Self, Self::Error> {
Err("unimplemented")
}
}
impl Packet for Handshake {
fn new() -> Self {
Handshake {
protocol_version: 0.into(),
server_address: "".into(),
server_port: 0.into(),
next_state: 0.into(),
}
}
fn read(t: &mut TcpStream) -> std::io::Result<Self> {
let mut handshake = Handshake::new();
handshake.protocol_version = MCVarInt::read(t)?;
handshake.server_address = MCString::read(t)?;
handshake.server_port = MCUnsignedShort::read(t)?;
handshake.next_state = MCVarInt::read(t)?;
Ok(handshake)
}
fn write(&self, t: &mut TcpStream) -> std::io::Result<()> {
for b in Into::<Vec<u8>>::into(self.clone()) {
write_byte(t, b)?;
}
Ok(())
}
}
#[derive(Debug, Clone)]
pub struct StatusRequest {}
impl Into<Vec<u8>> for StatusRequest {
fn into(self) -> Vec<u8> {
let mut out = vec![];
let mut temp: Vec<u8> = MCVarInt::from(0x00).into(); // 0x00 Status Request.
out.extend_from_slice(&Into::<Vec<u8>>::into(MCVarInt::from(temp.len() as i32)));
out.extend_from_slice(&temp);
out
}
}
impl TryFrom<Vec<u8>> for StatusRequest {
type Error = &'static str;
fn try_from(_bytes: Vec<u8>) -> Result<Self, Self::Error> {
Err("unimplemented")
}
}
impl Packet for StatusRequest {
fn new() -> Self {
StatusRequest {}
}
fn read(t: &mut TcpStream) -> std::io::Result<Self> {
let mut statusrequest = StatusRequest::new();
Ok(statusrequest)
}
fn write(&self, t: &mut TcpStream) -> std::io::Result<()> {
for b in Into::<Vec<u8>>::into(self.clone()) {
write_byte(t, b)?;
}
Ok(())
}
}
#[derive(Debug, Clone)]
pub struct StatusPing {
pub payload: MCLong,
}
impl Into<Vec<u8>> for StatusPing {
fn into(self) -> Vec<u8> {
let mut out = vec![];
let mut temp: Vec<u8> = MCVarInt::from(0x01).into(); // 0x01 Status Pong.
temp.extend_from_slice(&Into::<Vec<u8>>::into(self.payload));
out.extend_from_slice(&Into::<Vec<u8>>::into(MCVarInt::from(temp.len() as i32)));
out.extend_from_slice(&temp);
out
}
}
impl TryFrom<Vec<u8>> for StatusPing {
type Error = &'static str;
fn try_from(_bytes: Vec<u8>) -> Result<Self, Self::Error> {
Err("unimplemented")
}
}
impl Packet for StatusPing {
fn new() -> Self {
StatusPing { payload: 0.into() }
}
fn read(t: &mut TcpStream) -> std::io::Result<Self> {
let mut statusping = StatusPing::new();
statusping.payload = MCLong::read(t)?;
Ok(statusping)
}
fn write(&self, t: &mut TcpStream) -> std::io::Result<()> {
for b in Into::<Vec<u8>>::into(self.clone()) {
write_byte(t, b)?;
}
Ok(())
}
}
#[derive(Debug, Clone)]
pub struct LoginStart {
pub player_name: MCString,
}
impl Into<Vec<u8>> for LoginStart {
fn into(self) -> Vec<u8> {
let mut out = vec![];
let mut temp: Vec<u8> = MCVarInt::from(0x00).into(); // 0x00 Login Start.
temp.extend_from_slice(&Into::<Vec<u8>>::into(self.player_name));
out.extend_from_slice(&Into::<Vec<u8>>::into(MCVarInt::from(temp.len() as i32)));
out.extend_from_slice(&temp);
out
}
}
impl TryFrom<Vec<u8>> for LoginStart {
type Error = &'static str;
fn try_from(_bytes: Vec<u8>) -> Result<Self, Self::Error> {
Err("unimplemented")
}
}
impl Packet for LoginStart {
fn new() -> Self {
LoginStart {
player_name: "".into(),
}
}
fn read(t: &mut TcpStream) -> std::io::Result<Self> {
let mut loginstart = LoginStart::new();
loginstart.player_name = MCString::read(t)?;
Ok(loginstart)
}
fn write(&self, t: &mut TcpStream) -> std::io::Result<()> {
for b in Into::<Vec<u8>>::into(self.clone()) {
write_byte(t, b)?;
}
Ok(())
}
}

View File

@ -1,84 +0,0 @@
// network/mod.rs
// authors: Garen Tyler
// description:
// This module contains the network logic.
pub mod packet;
use crate::server::ServerMessage;
use log::{debug, error, info, warn};
use packet::Packet;
use std::io::BufReader;
use std::net::{TcpListener, TcpStream};
use std::sync::mpsc::{self, Receiver, Sender};
pub struct NetworkServer {
receiver: Receiver<NetworkClient>,
clients: Vec<NetworkClient>,
}
impl NetworkServer {
pub fn new(port: u16) -> NetworkServer {
let (tx, rx) = mpsc::channel();
std::thread::spawn(move || NetworkServer::listen(port, tx));
NetworkServer {
receiver: rx,
clients: Vec::new(),
}
}
fn listen(port: u16, sender: Sender<NetworkClient>) {
let listener = TcpListener::bind(&format!("0.0.0.0:{}", port)).unwrap();
for (index, stream) in listener.incoming().enumerate() {
let stream = stream.unwrap();
stream.set_nonblocking(true).unwrap();
sender
.send(NetworkClient {
// The index will increment after each client making it unique. We'll just use this as the id.
id: index as u32,
stream: BufReader::new(stream),
state: NetworkClientState::Handshake,
packets: Vec::new(),
username: None,
alive: true,
})
.unwrap();
}
}
pub fn update(&mut self) {
loop {
match self.receiver.try_recv() {
Ok(client) => self.clients.push(client),
Err(mpsc::TryRecvError::Empty) => break,
Err(mpsc::TryRecvError::Disconnected) => {
panic!("Client receiver channel disconnected!")
}
}
}
// Todo: Update each client
for client in self.clients.iter_mut() {
client.update();
}
}
}
#[derive(Debug)]
pub struct NetworkClient {
id: u32,
state: NetworkClientState,
alive: bool,
stream: BufReader<TcpStream>,
username: Option<String>,
packets: Vec<Packet>,
}
impl NetworkClient {
pub fn update(&mut self) {}
}
#[derive(PartialEq, Debug)]
pub enum NetworkClientState {
Handshake,
Status,
Login,
Play,
}

View File

@ -1,13 +0,0 @@
// network/packet/mod.rs
// authors: Garen Tyler
// description:
// This module contains the packet structs.
#[derive(Debug)]
pub struct Packet {
kind: PacketType,
}
#[derive(PartialEq, Debug)]
pub enum PacketType {
Handshake,
}

View File

@ -1,102 +0,0 @@
// protocol.rs
// author: Garen Tyler
// description:
// This module contains all the packet structs.
// Not all of them are implemented, and new ones will be added as necessary.
use crate::mctypes::*;
use std::net::TcpStream;
pub fn read_packet_header(t: &mut TcpStream) -> std::io::Result<(MCVarInt, MCVarInt)> {
let length = MCVarInt::from_stream(t)?;
let id = MCVarInt::from_stream(t)?;
Ok((length, id))
}
#[derive(Debug, Clone)]
pub struct Handshake {
pub protocol_version: MCVarInt,
pub server_address: MCString,
pub server_port: MCUnsignedShort,
pub next_state: MCVarInt,
}
impl Handshake {
pub fn new(
protocol_version: MCVarInt,
server_address: MCString,
server_port: MCUnsignedShort,
next_state: MCVarInt,
) -> Handshake {
Handshake {
protocol_version,
server_address,
server_port,
next_state,
}
}
pub fn read(t: &mut TcpStream) -> std::io::Result<Handshake> {
let protocol_version = MCVarInt::from_stream(t)?;
let server_address = MCString::from_stream(t)?;
let server_port = MCUnsignedShort::from_stream(t)?;
let next_state = MCVarInt::from_stream(t)?;
Ok(Handshake::new(
protocol_version,
server_address,
server_port,
next_state,
))
}
pub fn to_bytes(&self) -> Vec<u8> {
let mut bytes = Vec::new();
for b in self.protocol_version.to_bytes() {
bytes.push(b);
}
for b in self.server_address.to_bytes() {
bytes.push(b);
}
for b in self.server_port.to_bytes() {
bytes.push(b);
}
for b in self.next_state.to_bytes() {
bytes.push(b);
}
bytes
}
}
#[derive(Debug, Clone)]
pub struct LoginStart {
pub username: MCString,
}
impl LoginStart {
pub fn new(username: MCString) -> LoginStart {
LoginStart { username }
}
pub fn read(t: &mut TcpStream) -> std::io::Result<LoginStart> {
Ok(LoginStart::new(MCString::from_stream(t)?))
}
pub fn to_bytes(&self) -> Vec<u8> {
self.username.to_bytes()
}
}
#[derive(Debug, Clone)]
pub struct LoginSuccess {
pub uuid: MCString,
pub username: MCString,
}
impl LoginSuccess {
pub fn new(uuid: MCString, username: MCString) -> LoginSuccess {
LoginSuccess { uuid, username }
}
pub fn to_bytes(&self) -> Vec<u8> {
let mut bytes = Vec::new();
for b in self.uuid.to_bytes() {
bytes.push(b);
}
for b in self.username.to_bytes() {
bytes.push(b);
}
bytes
}
}

View File

@ -1,75 +0,0 @@
// server.rs
// author: Garen Tyler
// description:
// Contains the server logic.
use crate::network::NetworkServer;
use log::{debug, error, info, warn};
use serde::{Deserialize, Serialize};
use std::sync::mpsc::{self, Receiver, Sender, TryRecvError};
pub struct Server {
pub config: ServerConfig,
pub receiver: Receiver<ServerMessage>,
pub network: NetworkServer,
}
impl Server {
pub fn update(&mut self) {
// Do a tick.
while let Ok(message) = self.receiver.try_recv() {
debug!("Server received message: {:?}", message);
self.handle_message(message);
}
self.network.update();
}
fn handle_message(&self, message: ServerMessage) {}
pub fn shutdown(&self) {
unimplemented!();
}
}
#[derive(Serialize, Deserialize, Clone)]
pub struct ServerConfig {
pub port: u16,
pub protocol_version: u16,
pub max_players: u32,
pub motd: String,
pub favicon: Option<String>,
}
impl ServerConfig {
pub fn default() -> ServerConfig {
ServerConfig {
port: 25565,
protocol_version: 578,
max_players: 250,
motd: "Hello world!".to_owned(),
favicon: None,
}
}
pub fn from_file(filename: &str) -> ServerConfig {
use std::fs::File;
use std::io::prelude::*;
let a = || -> std::io::Result<ServerConfig> {
let mut file = File::open(filename)?;
let mut configStr = String::new();
file.read_to_string(&mut configStr)?;
Ok(toml::from_str(&configStr)?)
};
if let Ok(c) = a() {
c
} else {
warn!(
"Could not load config from {}, using default config.",
filename
);
ServerConfig::default()
}
}
}
#[derive(Debug)]
pub enum BroadcastMessage {
Shutdown,
}
#[derive(Debug)]
pub enum ServerMessage {}

11
src/server/mod.rs Normal file
View File

@ -0,0 +1,11 @@
use crate::net::{NetworkClient, NetworkClientState, NetworkServer};
use log::{debug, error, info, warn};
pub struct GameServer {
pub network: NetworkServer,
}
impl GameServer {
pub fn update(&mut self) {
self.network.update();
}
}