{"id":20888543,"url":"https://github.com/zrains/msp","last_synced_at":"2025-12-27T05:31:15.454Z","repository":{"id":166447229,"uuid":"641844222","full_name":"zRains/msp","owner":"zRains","description":"Fast and lightweight Minecraft Server protocol client implemented in Rust.","archived":false,"fork":false,"pushed_at":"2023-07-21T03:51:54.000Z","size":98,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T11:32:36.418Z","etag":null,"topics":["lightweight","minecraft","protocol"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/msp","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zRains.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-17T09:29:06.000Z","updated_at":"2023-06-01T17:59:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"5333e9b8-59fb-4912-8136-c6e1def38643","html_url":"https://github.com/zRains/msp","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zRains%2Fmsp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zRains%2Fmsp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zRains%2Fmsp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zRains%2Fmsp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zRains","download_url":"https://codeload.github.com/zRains/msp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243269725,"owners_count":20264125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lightweight","minecraft","protocol"],"created_at":"2024-11-18T08:27:43.328Z","updated_at":"2025-12-27T05:31:15.411Z","avatar_url":"https://github.com/zRains.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Msp (alpha)\n\n![license](https://flat.badgen.net/badge/license/MIT/blue) ![version](https://flat.badgen.net/crates/v/msp) ![download](https://flat.badgen.net/crates/d/msp)\n\n\u003cp\u003eEnglish | \u003ca href=\"README_ZH.md\"\u003e中文\u003c/a\u003e\u003c/p\u003e\n\n\u003e WIP: Currently, it is in the alpha stage. It is functional and can be used, but configuration and feature APIs may still undergo changes between minor version releases.\n\nA Minecraft Server Protocol client implemented in Rust that offers fast response, lightweightness, stability, comprehensive type exporting, and error feedback. It enables retrieval of server status through various protocols and returns strongly-typed JSON data.\n\n### Applicable version\n\nSupports Java Edition and Bedrock Edition servers. The applicable version range is as follows.\n\n- **Java Edition:** Suitable for server versions 1.4 and above ([Protocol version number](https://wiki.vg/Protocol_version_numbers) \u003e= 47).\n- **Bedrock Edition:** Suitable for modern Bedrock servers (1.16.220 and above).\n\n### Supported protocols\n\nServer Information Query Protocol covering most versions, with certain protocols requiring the server to enable corresponding features.\n\n- [Server List Ping](https://wiki.vg/Server_List_Ping) Suitable for most modern servers (1.7+).\n- [Netty Server Ping](https://wiki.vg/Server_List_Ping#1.6) Suitable for servers 1.6 and later.\n- [Legacy Server Ping](https://wiki.vg/Server_List_Ping#1.4_to_1.5) Suitable for older versions of servers (1.4 to 1.5).\n- [Beta Legacy Server Ping](https://wiki.vg/Server_List_Ping#Beta_1.8_to_1.3) Suitable for ancient versions of servers (Beta 1.8 to 1.3).\n- [Ping via LAN](https://wiki.vg/Server_List_Ping#Ping_via_LAN_.28Open_to_LAN_in_Singleplayer.29) LAN Server Discovery Protocol.\n- [Raknet Protocol](https://wiki.vg/Raknet_Protocol) Applicable to modern Bedrock servers.\n- [Query Protocol](https://wiki.vg/Query) Applicable to modern Java Edition servers (available from version 1.9pre4 onwards).\n\n### Usage\n\n1. To integrate it as a library into your own Rust project, run it in the root project directory.\n\n```bash\ncargo add msp\n```\n\nOr, add this dependency to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nmsp = \"0.1.2\"\n```\n\n### Examples\n\nHere are some basic examples showcased below.\n\n1. Use `Conf::get_server_status` to retrieve server information, return `Server`. Note that older versions are not supported:\n\n```rust\nuse msp::{Conf, MspErr, Server};\n\nfn main() -\u003e Result\u003c(), MspErr\u003e {\n    let server = Conf::create_with_port(\"www.example.com\", 25565);\n    let info: Server = server.get_server_status()?;\n\n    println!(\"{}\", info);\n\n    Ok(())\n}\n```\n\n2. Use `Conf::create_with_port` to create a connection configuration specifying the port:\n\n```rust\nuse msp::{Conf, MspErr, Server};\n\nfn main() -\u003e Result\u003c(), MspErr\u003e {\n    let server = Conf::create_with_port(\"www.example.com\", 25565);\n    let info: Server = server.get_server_status()?;\n\n    println!(\"{}\", info);\n\n    Ok(())\n}\n```\n\n3. Use `get_lan_server_status` to retrieve LAN online hosts:\n\n```rust\nuse msp::{get_lan_server_status, MspErr, SocketConf};\nuse std::time::Duration;\n\nconst SERVER_OFFLINE_TIMEOUT: u64 = 2000;\n\nfn main() -\u003e Result\u003c(), MspErr\u003e {\n    let (_ter, receiver) = get_lan_server_status(\u0026SocketConf {\n        read_time_out: Some(Duration::from_millis(SERVER_OFFLINE_TIMEOUT)),\n        ..Default::default()\n    })?;\n\n    loop {\n        match receiver.recv() {\n            Ok(result) =\u003e {\n                if let Ok(Some(server)) = result {\n                    // ...\n                }\n            }\n            Err(_) =\u003e {}\n        }\n    }\n\n    Ok(())\n}\n```\n\n4. Use `Conf::query_full` to retrieve server information using the Query protocol:\n\n```rust\nuse msp::{Conf, MspErr};\n\nfn main() -\u003e Result\u003c(), MspErr\u003e {\n    let server = Conf::create_with_port(\"www.example.com\", 25565);\n\n    println!(\"{}\", server.query_full()?);\n\n    Ok(())\n}\n```\n\n:warning:To use this protocol, you need to enable the `enable-query` option on the server side. This option can be found in the `server.properties` file located in the root directory. Set it as follows:\n\n```toml\nenable-query=true\nquery.port=25565 # Configure the port according to your specific situation\n```\n\nMake sure to save the changes and restart the server for the configuration to take effect.\n\n### License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzrains%2Fmsp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzrains%2Fmsp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzrains%2Fmsp/lists"}