Commit Graph

63 Commits

Author SHA1 Message Date
2bd5d9c9bf chore: bump version to 1.7.0-beta.2 2025-06-22 01:50:58 +03:00
7248a0096c feat: add typescript declaration files
Types are automatically generated from the existsing
JSDoc comments in the js source code. Use `types:build`
script from `package.json` to produce d.ts files.
2025-06-22 01:50:29 +03:00
a1b999ca4e refactor: introduce typescript for static type checking
We use JSDoc for documentation, but these annotations
were not being validated. This meant that type information
could become outdated or incorrect without any warning.

This commit introduces the TypeScript compiler (`tsc`) as a static
analysis tool to leverage our existing JSDoc comments.

To support this, JSDoc annotations across the codebase have been
improved for accuracy. Additionally, the `varint` module now uses a
custom `VarIntError` class for better type inference and error handling.
A new `typecheck` script has been added to `package.json` to run this
validation.
2025-06-19 03:55:24 +03:00
7322034aba feat: add debug logging
Add debug logs using the `debug` library.

To use this new feature, set the `DEBUG` environment variable:
- `DEBUG=mineping:*` enables all logs from this library.
- `DEBUG=mineping:java` enables logs for the Java module only.
- `DEBUG=mineping:bedrock` enables logs for the Bedrock module only.
2025-06-19 02:14:04 +03:00
c7b99cb6db feat: implement SRV record lookup and improve ping logic
Add support for DNS SRV record lookups (`_minecraft._tcp`) to
automatically resolve the correct server host and port, falling back
to the provided address if no record is found. This makes server
discovery compliant with standard Minecraft client behavior.

The Java ping implementation has been refactored:
- The `varint` module is rewritten to throw specific error codes and
  its `decodeVarInt` function now returns bytes read, which simplifies
  parsing logic.
- The core ping logic is now promise-based and modular, breaking out
  packet creation and response processing into helper functions.
- The TCP stream handler now robustly processes chunked data by
  catching recoverable decoder errors and waiting for more data,
  preventing crashes on incomplete packets.
- Error handling is improved.
2025-06-19 01:45:27 +03:00
51b4771305 docs: add guide how to install beta version 2025-06-16 03:39:21 +03:00
3c2c049c19 refactor!: decouple Raknet MOTD parsing and response shaping
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.
2025-06-16 03:36:26 +03:00
cbaa1a3e3e docs: update email in security policy 2025-06-15 03:00:19 +03:00
435e59739c test: implement tests using vitest framework 2025-06-15 02:56:07 +03:00
ef2bebe755 fix: only perform cleanup and fire the callback on the first error 2025-06-15 02:56:07 +03:00
27011d4091 fix: change minimum motd components to 5 and fix typos
A valid motd message has at least 5 components, not 9
2025-06-14 23:26:11 +03:00
d8d4a9a467 chore: bump version to 1.6.1 v1.6.1 2025-02-07 08:57:18 +03:00
d90a916fa5 docs: update cli app example 2025-02-07 08:56:39 +03:00
0959403b1b refactor: improve Bedrock error handling and validation 2025-02-07 08:48:04 +03:00
c71236f223 perf: optimize varint decoding
docs: update type definitions
2025-02-07 08:35:21 +03:00
0b5c5e2938 chore: bump version to 1.6.0 v1.6.0 2025-02-07 08:02:26 +03:00
73a2fffe8b feat: add virtualHost option (#6) 2025-02-07 08:01:12 +03:00
9469564736 docs: update references to wiki.vg
wiki.vg has been shut down and is in the process of being merged into minecraft.wiki
2024-12-28 22:47:11 +03:00
838ffc497a chore: bump version to 1.5.0 v1.5.0 2024-10-09 22:00:11 +03:00
502029869a style: use "node:" prefix for imports 2024-10-09 21:59:16 +03:00
e3e7e293ed fix: use vanilla ping format 2024-10-09 21:57:37 +03:00
88ad92e59d chore: add example for single server ping 2024-10-09 21:55:01 +03:00
009f542c55 chore: bump version to 1.4.1 2024-03-31 02:02:08 +03:00
0b0bed4e71 docs: some clarifications in createUnconnectedPingFrame 2024-03-31 02:01:46 +03:00
fa4c34d896 chore: bump version to 1.4.0 2024-03-31 01:56:43 +03:00
296294ca96 refactor!: changes in bedrock protocol code
BREAKING CHANGE: new bedrock ping response format
2024-03-31 01:56:03 +03:00
9d25aaf4ea chore: bump version to 1.3.0 2024-03-30 16:42:44 +03:00
c735604c38 fix: #5 add gameVersion field for Bedrock
Add gameVersion field in BedrockPingResponse

Closes: #5
2024-03-30 16:41:42 +03:00
afdaa9eb3e chore(package.json): bump version to 1.2.2 2023-12-12 00:44:41 +03:00
435899309f Merge pull request #4 from sya-ri/fix-types/optional
fix(types): Change options to optional
2023-12-12 00:44:20 +03:00
13e6b8c6ff fix(types): Change options to optional 2023-12-09 22:38:37 +09:00
d7256eabe7 chore(package.json): bump version to 1.2.1 2023-12-09 12:58:53 +03:00
afa2c3025f fix(bedrock.js): resolve UNCONNECTED_PING formation issue
- Simplify UNCONNECTED_PING function
- Address an issue where certain servers, particularly those based on Pocketmine, were unresponsive to Unconnected Ping requests
2023-12-09 12:57:43 +03:00
6c297d0b8c chore(package.json): bump version to 1.2.0 2023-12-08 15:22:53 +03:00
283e9b32c6 Merge pull request #3 from inotflying/patch-1
feat(pingJava): The ability to set a specific protocol version in the parameters. According to https://wiki.vg/Server_List_Ping#:~:text=0x00-,Protocol%20Version,-VarInt
2023-12-08 15:22:07 +03:00
354fa212a6 fix(javaPing): default protocolVersion value 2023-12-08 16:16:30 +04:00
d9bf4cfb3f feat(pingJava): add protocolVersion
feat(types): `PingOptions` for Java

fix(types): type names

fix(types): type names
2023-12-08 16:04:35 +04:00
9dace3748b docs(README.md): improve clarity and grammar in the project description 2023-10-22 22:49:53 +03:00
0aa73655b1 fix(parallel.js): add break statement to stop iterating over results if a promise is rejected 2023-10-22 21:38:34 +03:00
78ca03b004 chore(package.json): update version from 1.1.0 to 1.1.1 v1.1.1 2023-10-22 21:32:33 +03:00
910184bf5f refactoring and comments
fix(cli.js): refactor help and error handling logic for better readability and maintainability
feat(cli.js): add support for custom port and timeout options
fix(parallel.js): update list of hosts to ping
fix(bedrock.js): add comments and improve error handling in ping function
fix(java.js): add comments and improve error handling in ping function
fix(varint.js): add comments to functions and improve readability
fix(index.d.ts): export all functions from java.js and bedrock.js
fix(lib/bedrock.d.ts): update source link
fix(lib/java.d.ts): update source link
2023-10-22 21:32:00 +03:00
915edbec9c update version from 1.0.4 to 1.1.0 v1.1.0 2023-10-22 02:29:54 +03:00
0fe675385f bedrock.js refactoring, remove bytebuffer dependency
add parallel.js file to demonstrate parallel pinging of multiple Bedrock servers
2023-10-22 02:29:20 +03:00
c3158ac925 Merge pull request #2 from sya-ri/update-java-ping-response-type
Update outdated JavaPingResponse type
2023-10-22 00:39:14 +03:00
31c58ee637 Update outdated JavaPingResponse type 2023-10-22 06:04:58 +09:00
7cd3444a4f Merge pull request #1 from romanalexander/fixes/bedrock-ping
Fix ping never firing an error when timeout occurs.
2023-10-09 02:21:00 +03:00
af78a184db Fix ping never firing an error when timeout occurs. 2023-10-08 16:22:18 -04:00
72041aa3f9 update readme 2022-08-23 16:22:42 +03:00
e927748935 1.0.4 2022-01-11 02:47:40 +03:00
1249fa7632 docs(docs): сhanged the module name according to the scope, added links to src files 2022-01-11 02:47:14 +03:00