Skip to content

Cloudflare Worker to request and read Minecraft server list data

License

Notifications You must be signed in to change notification settings

OutdatedVersion/minecraft-server-list-ping-cloudflare-worker

Repository files navigation

Server list ping

Uses Cloudflare Worker's TCP API to get the server-list player count, message-of-the-day, and player sample. This is the same data you'd see on the multiplayer server list.

This light-weight approach parrots the same packets sent by the Notchian client:

  1. Server-bound handshake
  2. Server-bound status request
  3. Client-bound status response

Using what wiki.vg publishes we can use Buffer, from the standard library, and leb, a third-party package for working with base 128 little endian bytes.

Wireshark then let's us verify and debug our work:

Wireshark

notchian client  10 00 f9 05 09 6c 6f 63 61 6c 68 6f 73 74 63 dd 01
worker client    10 00 fa 05 09 6c 6f 63 61 6c 68 6f 73 74 63 dd 01

For example, this helped me realize a mismatch between using little and big endian byte order for the server port in the handshake packet!

About

Cloudflare Worker to request and read Minecraft server list data

Resources

License

Stars

Watchers

Forks