mirror of
https://github.com/minescope/mineping.git
synced 2025-06-19 00:46:21 +03:00
The previous implementation of the RakNet ping was monolithic, mixing socket management, raw packet validation, and data transformation into a single, complex flow. This refactor introduces a clear, multi-stage processing pipeline that separates these concerns. The logic is now broken down into multi-stage pipeline: extracting the MOTD string from the raw pong packet -> parsing that string into a raw object -> transforming the raw data into a user-friendly response object. Additionally, the socket handling logic is improved with idempotent cleanup function to prevent resource leaks or race conditions. As part of this overhaul, external TypeScript definition (`.d.ts`) files have been removed in favor of rich JSDoc annotations. BREAKING CHANGE: The structure of the resolved `BedrockPingResponse` object has been significantly changed to improve clarity and consistency.
6 lines
125 B
JavaScript
6 lines
125 B
JavaScript
import { pingBedrock } from "../index.js";
|
|
|
|
const host = "0.0.0.0";
|
|
const motd = await pingBedrock(host);
|
|
console.log(motd);
|