Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
c3d1618ba8 | |||
|
37fdb9c12a | ||
|
e7a3db19aa | ||
|
ca4753673d | ||
|
0124aa723d | ||
|
afbc54758c | ||
|
e54025f02f | ||
|
023e46fe64 | ||
|
6622962d5d | ||
|
da60287e10 | ||
|
eb5ee7defd | ||
|
fdeb7594c2 | ||
|
5c7e17b0ae | ||
|
be74e053f4 | ||
|
eb2cf1219e |
@@ -7,11 +7,6 @@ stages:
|
||||
- pre-release
|
||||
- release
|
||||
|
||||
default:
|
||||
tags:
|
||||
- linux
|
||||
- timvisee-linux
|
||||
|
||||
# Variable defaults
|
||||
variables:
|
||||
RUST_VERSION: stable
|
||||
|
@@ -1,5 +1,14 @@
|
||||
# Changelog
|
||||
|
||||
## 0.2.10 (2023-02-20)
|
||||
|
||||
- Do not report an error when server exits with status code 143
|
||||
|
||||
## 0.2.9 (2023-02-14)
|
||||
|
||||
- Fix dropping all connections when `server.drop_banned_ips` was enabled
|
||||
- Update dependencies
|
||||
|
||||
## 0.2.8 (2023-01-30)
|
||||
|
||||
- Add `freeze_process` feature on Unix platforms to freeze a sleeping server
|
||||
|
156
Cargo.lock
generated
156
Cargo.lock
generated
@@ -28,9 +28,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.68"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
|
||||
checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
|
||||
|
||||
[[package]]
|
||||
name = "async-channel"
|
||||
@@ -89,7 +89,7 @@ dependencies = [
|
||||
"slab",
|
||||
"socket2",
|
||||
"waker-fn",
|
||||
"windows-sys",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -215,9 +215,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"
|
||||
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
@@ -368,9 +368,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cxx"
|
||||
version = "1.0.88"
|
||||
version = "1.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "322296e2f2e5af4270b54df9e85a02ff037e271af20ba3e7fe1575515dc840b8"
|
||||
checksum = "90d59d9acd2a682b4e40605a242f6670eaa58c5957471cbf85e8aa6a0b97a5e8"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cxxbridge-flags",
|
||||
@@ -380,9 +380,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cxx-build"
|
||||
version = "1.0.88"
|
||||
version = "1.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "017a1385b05d631e7875b1f151c9f012d37b53491e2a87f65bff5c262b2111d8"
|
||||
checksum = "ebfa40bda659dd5c864e65f4c9a2b0aff19bea56b017b9b77c73d3766a453a38"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"codespan-reporting",
|
||||
@@ -395,15 +395,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-flags"
|
||||
version = "1.0.88"
|
||||
version = "1.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c26bbb078acf09bc1ecda02d4223f03bdd28bd4874edcb0379138efc499ce971"
|
||||
checksum = "457ce6757c5c70dc6ecdbda6925b958aae7f959bda7d8fb9bde889e34a09dc03"
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-macro"
|
||||
version = "1.0.88"
|
||||
version = "1.0.90"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "357f40d1f06a24b60ae1fe122542c1fb05d28d32acb2aed064e84bc2ad1e252e"
|
||||
checksum = "ebf883b7aacd7b2aeb2a7b338648ee19f57c140d4ee8e52c68979c6b2f7f2263"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -412,9 +412,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.14.2"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa"
|
||||
checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
@@ -422,9 +422,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.14.2"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f"
|
||||
checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
@@ -436,9 +436,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.14.2"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e"
|
||||
checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
@@ -554,23 +554,23 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.8.0"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499"
|
||||
checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
|
||||
dependencies = [
|
||||
"instant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.19"
|
||||
version = "0.2.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9"
|
||||
checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"windows-sys",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -773,6 +773,12 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "1.3.0"
|
||||
@@ -843,12 +849,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "io-lifetimes"
|
||||
version = "1.0.4"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e"
|
||||
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -862,14 +868,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.2"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189"
|
||||
checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef"
|
||||
dependencies = [
|
||||
"hermit-abi 0.2.6",
|
||||
"hermit-abi 0.3.1",
|
||||
"io-lifetimes",
|
||||
"rustix",
|
||||
"windows-sys",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -880,9 +886,9 @@ checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.60"
|
||||
version = "0.3.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47"
|
||||
checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
@@ -920,7 +926,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "lazymc"
|
||||
version = "0.2.8"
|
||||
version = "0.2.10"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-std",
|
||||
@@ -1076,14 +1082,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de"
|
||||
checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"windows-sys",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1234,7 +1240,7 @@ dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"wepoll-ffi",
|
||||
"windows-sys",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1279,9 +1285,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.50"
|
||||
version = "1.0.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
|
||||
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
@@ -1519,16 +1525,16 @@ checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.36.7"
|
||||
version = "0.36.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03"
|
||||
checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"io-lifetimes",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1580,9 +1586,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.91"
|
||||
version = "1.0.93"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
|
||||
checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@@ -1597,9 +1603,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.0"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
|
||||
checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
@@ -1729,13 +1735,13 @@ dependencies = [
|
||||
"bytes",
|
||||
"libc",
|
||||
"memchr",
|
||||
"mio 0.8.5",
|
||||
"mio 0.8.6",
|
||||
"num_cpus",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys",
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1855,9 +1861,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.83"
|
||||
version = "0.2.84"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268"
|
||||
checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"wasm-bindgen-macro",
|
||||
@@ -1865,9 +1871,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.83"
|
||||
version = "0.2.84"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142"
|
||||
checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"log",
|
||||
@@ -1880,9 +1886,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-futures"
|
||||
version = "0.4.33"
|
||||
version = "0.4.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d"
|
||||
checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"js-sys",
|
||||
@@ -1892,9 +1898,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.83"
|
||||
version = "0.2.84"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810"
|
||||
checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
@@ -1902,9 +1908,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.83"
|
||||
version = "0.2.84"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c"
|
||||
checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1915,15 +1921,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.83"
|
||||
version = "0.2.84"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f"
|
||||
checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.60"
|
||||
version = "0.3.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f"
|
||||
checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
@@ -1996,6 +2002,30 @@ dependencies = [
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.1"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "lazymc"
|
||||
version = "0.2.8"
|
||||
version = "0.2.10"
|
||||
authors = ["Tim Visee <3a4fb3964f@sinenomine.email>"]
|
||||
license = "GPL-3.0"
|
||||
readme = "README.md"
|
||||
@@ -50,7 +50,7 @@ dotenv = "0.15"
|
||||
flate2 = { version = "1.0", default-features = false, features = ["default"] }
|
||||
futures = { version = "0.3", default-features = false, features = ["executor"] }
|
||||
log = "0.4"
|
||||
minecraft-protocol = { git = "https://github.com/timvisee/rust-minecraft-protocol", rev = "edfdf87" }
|
||||
minecraft-protocol = { git = "https://git.cozy.software/slime/rust-minecraft-protocol", rev = "4d9c0d4305" }
|
||||
named-binary-tag = "0.6"
|
||||
nix = "0.26"
|
||||
notify = "4.0"
|
||||
|
1
clippy.toml
Normal file
1
clippy.toml
Normal file
@@ -0,0 +1 @@
|
||||
msrv = "1.64.0"
|
@@ -187,4 +187,4 @@ command = "java -Xmx1G -Xms1G -jar server.jar --nogui"
|
||||
[config]
|
||||
# lazymc version this configuration is for.
|
||||
# Don't change unless you know what you're doing.
|
||||
version = "0.2.8"
|
||||
version = "0.2.10"
|
||||
|
@@ -122,7 +122,7 @@ fn rewrite_contents(contents: String, mut changes: HashMap<&str, String>) -> Opt
|
||||
// Take any new value, and update it
|
||||
if let Some((_, new)) = changes.remove_entry(key.trim().to_lowercase().as_str()) {
|
||||
if value != new {
|
||||
line = format!("{}={}", key, new);
|
||||
line = format!("{key}={new}");
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ fn rewrite_contents(contents: String, mut changes: HashMap<&str, String>) -> Opt
|
||||
|
||||
// Append any missed changes
|
||||
for (key, value) in changes {
|
||||
new_contents += &format!("{}{}={}", EOL, key, value);
|
||||
new_contents += &format!("{EOL}{key}={value}");
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,7 @@ fn player_uuid(username: &str) -> Uuid {
|
||||
|
||||
/// Get UUID for given offline player username.
|
||||
pub fn offline_player_uuid(username: &str) -> Uuid {
|
||||
player_uuid(&format!("{}{}", OFFLINE_PLAYER_NAMESPACE, username))
|
||||
player_uuid(&format!("{OFFLINE_PLAYER_NAMESPACE}{username}"))
|
||||
}
|
||||
|
||||
/// Java's `UUID.nameUUIDFromBytes`
|
||||
|
@@ -57,13 +57,13 @@ pub async fn monitor_server(config: Arc<Config>, server: Arc<Server>) {
|
||||
|
||||
// Sleep server when it's bedtime
|
||||
if server.should_sleep(&config).await {
|
||||
info!(target: "lazymc::montior", "Server has been idle, sleeping...");
|
||||
info!(target: "lazymc::monitor", "Server has been idle, sleeping...");
|
||||
server.stop(&config).await;
|
||||
}
|
||||
|
||||
// Check whether we should force kill server
|
||||
if server.should_kill().await {
|
||||
error!(target: "lazymc::montior", "Force killing server, took too long to start or stop");
|
||||
error!(target: "lazymc::monitor", "Force killing server, took too long to start or stop");
|
||||
if !server.force_kill().await {
|
||||
warn!(target: "lazymc", "Failed to force kill server");
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ async fn send_v1_16_3(
|
||||
packet::write_packet(
|
||||
Title {
|
||||
action: if title.is_empty() && subtitle.is_empty() {
|
||||
// Defaults: https://minecraft.fandom.com/wiki/Commands/title#Detail
|
||||
// Defaults: https://minecraft.wiki/w/Commands/title#Detail
|
||||
TitleAction::SetTimesAndDisplay {
|
||||
fade_in: 10,
|
||||
stay: 70,
|
||||
@@ -121,7 +121,7 @@ async fn send_v1_17(
|
||||
// Set title times
|
||||
packet::write_packet(
|
||||
if title.is_empty() && subtitle.is_empty() {
|
||||
// Defaults: https://minecraft.fandom.com/wiki/Commands/title#Detail
|
||||
// Defaults: https://minecraft.wiki/w/Commands/title#Detail
|
||||
SetTitleTimes {
|
||||
fade_in: 10,
|
||||
stay: 70,
|
||||
|
@@ -29,9 +29,11 @@ const SERVER_QUIT_COOLDOWN: Duration = Duration::from_millis(2500);
|
||||
#[cfg(feature = "rcon")]
|
||||
const RCON_COOLDOWN: Duration = Duration::from_secs(15);
|
||||
|
||||
/// Exit code when SIGTERM is received on Unix.
|
||||
#[cfg(unix)]
|
||||
const UNIX_EXIT_SIGTERM: i32 = 130;
|
||||
/// Exit codes that are allowed.
|
||||
///
|
||||
/// - 143: https://github.com/timvisee/lazymc/issues/26#issuecomment-1435670029
|
||||
/// - 130: https://unix.stackexchange.com/q/386836/61092
|
||||
const ALLOWED_EXIT_CODES: [i32; 2] = [130, 143];
|
||||
|
||||
/// Shared server state.
|
||||
#[derive(Debug)]
|
||||
@@ -496,8 +498,12 @@ pub async fn invoke_server_cmd(
|
||||
debug!(target: "lazymc", "Server process stopped successfully ({})", status);
|
||||
false
|
||||
}
|
||||
#[cfg(unix)]
|
||||
Ok(status) if status.code() == Some(UNIX_EXIT_SIGTERM) => {
|
||||
Ok(status)
|
||||
if status
|
||||
.code()
|
||||
.map(|ref code| ALLOWED_EXIT_CODES.contains(code))
|
||||
.unwrap_or(false) =>
|
||||
{
|
||||
debug!(target: "lazymc", "Server process stopped successfully by SIGTERM ({})", status);
|
||||
false
|
||||
}
|
||||
|
@@ -84,7 +84,7 @@ fn route(inbound: TcpStream, config: Arc<Config>, server: Arc<Server>) {
|
||||
|
||||
// Check ban state, just drop connection if enabled
|
||||
let banned = server.is_banned_ip_blocking(&peer.ip());
|
||||
if config.server.drop_banned_ips {
|
||||
if banned && config.server.drop_banned_ips {
|
||||
info!(target: "lazymc", "Connection from banned IP {}, dropping", peer.ip());
|
||||
return;
|
||||
}
|
||||
|
@@ -152,12 +152,8 @@ pub async fn serve(
|
||||
info!(target: "lazymc", "Login from banned IP {}, disconnecting", client.peer.ip());
|
||||
DEFAULT_BAN_REASON.to_string()
|
||||
};
|
||||
action::kick(
|
||||
&client,
|
||||
&format!("{}{}", BAN_MESSAGE_PREFIX, msg),
|
||||
&mut writer,
|
||||
)
|
||||
.await?;
|
||||
action::kick(&client, &format!("{BAN_MESSAGE_PREFIX}{msg}"), &mut writer)
|
||||
.await?;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -236,11 +232,11 @@ async fn server_status(client_info: &ClientInfo, config: &Config, server: &Serve
|
||||
if config.motd.from_server && status.is_some() {
|
||||
status.as_ref().unwrap().description.clone()
|
||||
} else {
|
||||
Message::new(Payload::text(match server_state {
|
||||
match server_state {
|
||||
server::State::Stopped | server::State::Started => &config.motd.sleeping,
|
||||
server::State::Starting => &config.motd.starting,
|
||||
server::State::Stopping => &config.motd.stopping,
|
||||
}))
|
||||
}.to_string()
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -10,7 +10,7 @@ use crate::util::error::{quit_error, ErrorHints};
|
||||
/// excluding the `:` suffix.
|
||||
pub fn prompt(msg: &str) -> String {
|
||||
// Show the prompt
|
||||
eprint!("{}: ", msg);
|
||||
eprint!("{msg}: ");
|
||||
let _ = stderr().flush();
|
||||
|
||||
// Get the input
|
||||
@@ -49,7 +49,7 @@ pub fn prompt_yes(msg: &str, def: Option<bool>) -> bool {
|
||||
);
|
||||
|
||||
// Get the user input
|
||||
let answer = prompt(&format!("{} {}", msg, options));
|
||||
let answer = prompt(&format!("{msg} {options}"));
|
||||
|
||||
// Assume the default if the answer is empty
|
||||
if answer.is_empty() {
|
||||
|
@@ -16,7 +16,7 @@ pub fn print_error(err: anyhow::Error) {
|
||||
// Report each printable error, count them
|
||||
let count = err
|
||||
.chain()
|
||||
.map(|err| format!("{}", err))
|
||||
.map(|err| err.to_string())
|
||||
.filter(|err| !err.is_empty())
|
||||
.enumerate()
|
||||
.map(|(i, err)| {
|
||||
@@ -126,7 +126,7 @@ impl ErrorHints {
|
||||
if self.config_generate {
|
||||
eprintln!(
|
||||
"Use '{}' to generate a new config file",
|
||||
highlight(&format!("{} config generate", bin))
|
||||
highlight(&format!("{bin} config generate"))
|
||||
);
|
||||
}
|
||||
if self.config {
|
||||
@@ -138,7 +138,7 @@ impl ErrorHints {
|
||||
if self.config_test {
|
||||
eprintln!(
|
||||
"Use '{}' to test a config file",
|
||||
highlight(&format!("{} config test -c FILE", bin))
|
||||
highlight(&format!("{bin} config test -c FILE"))
|
||||
);
|
||||
}
|
||||
if self.verbose {
|
||||
|
Reference in New Issue
Block a user