Update mcutil library
This commit is contained in:
parent
c7a9bc87e4
commit
eeffc54ca4
18
go.mod
18
go.mod
@ -6,10 +6,10 @@ toolchain go1.22.3
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-redsync/redsync/v4 v4.13.0
|
github.com/go-redsync/redsync/v4 v4.13.0
|
||||||
github.com/gofiber/fiber/v2 v2.52.4
|
github.com/gofiber/fiber/v2 v2.52.5
|
||||||
github.com/mcstatus-io/mcutil/v3 v3.6.0
|
github.com/mcstatus-io/mcutil/v4 v4.0.0-20240718180705-427b3bcbde17
|
||||||
github.com/redis/go-redis/v9 v9.5.1
|
github.com/redis/go-redis/v9 v9.5.4
|
||||||
go.mongodb.org/mongo-driver v1.15.0
|
go.mongodb.org/mongo-driver v1.16.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -21,21 +21,21 @@ require (
|
|||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||||
github.com/klauspost/compress v1.17.8 // indirect
|
github.com/klauspost/compress v1.17.9 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||||
github.com/montanaflynn/stats v0.7.1 // indirect
|
github.com/montanaflynn/stats v0.7.1 // indirect
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/valyala/fasthttp v1.53.0 // indirect
|
github.com/valyala/fasthttp v1.55.0 // indirect
|
||||||
github.com/valyala/tcplisten v1.0.0 // indirect
|
github.com/valyala/tcplisten v1.0.0 // indirect
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||||
github.com/xdg-go/scram v1.1.2 // indirect
|
github.com/xdg-go/scram v1.1.2 // indirect
|
||||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||||
github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76 // indirect
|
github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76 // indirect
|
||||||
golang.org/x/crypto v0.23.0 // indirect
|
golang.org/x/crypto v0.25.0 // indirect
|
||||||
golang.org/x/sync v0.7.0 // indirect
|
golang.org/x/sync v0.7.0 // indirect
|
||||||
golang.org/x/sys v0.20.0 // indirect
|
golang.org/x/sys v0.22.0 // indirect
|
||||||
golang.org/x/text v0.15.0 // indirect
|
golang.org/x/text v0.16.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
42
go.sum
42
go.sum
@ -18,14 +18,14 @@ github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC
|
|||||||
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||||
github.com/go-redsync/redsync/v4 v4.13.0 h1:49X6GJfnbLGaIpBBREM/zA4uIMDXKAh1NDkvQ1EkZKA=
|
github.com/go-redsync/redsync/v4 v4.13.0 h1:49X6GJfnbLGaIpBBREM/zA4uIMDXKAh1NDkvQ1EkZKA=
|
||||||
github.com/go-redsync/redsync/v4 v4.13.0/go.mod h1:HMW4Q224GZQz6x1Xc7040Yfgacukdzu7ifTDAKiyErQ=
|
github.com/go-redsync/redsync/v4 v4.13.0/go.mod h1:HMW4Q224GZQz6x1Xc7040Yfgacukdzu7ifTDAKiyErQ=
|
||||||
github.com/gofiber/fiber/v2 v2.52.4 h1:P+T+4iK7VaqUsq2PALYEfBBo6bJZ4q3FP8cZ84EggTM=
|
github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo=
|
||||||
github.com/gofiber/fiber/v2 v2.52.4/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
|
||||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||||
github.com/gomodule/redigo v1.8.9 h1:Sl3u+2BI/kk+VEatbj0scLdrFhjPmbxOc1myhDP41ws=
|
github.com/gomodule/redigo v1.8.9 h1:Sl3u+2BI/kk+VEatbj0scLdrFhjPmbxOc1myhDP41ws=
|
||||||
github.com/gomodule/redigo v1.8.9/go.mod h1:7ArFNvsTjH8GMMzB4uy1snslv2BwmginuMs06a1uzZE=
|
github.com/gomodule/redigo v1.8.9/go.mod h1:7ArFNvsTjH8GMMzB4uy1snslv2BwmginuMs06a1uzZE=
|
||||||
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
|
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
@ -33,8 +33,8 @@ github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY
|
|||||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||||
github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU=
|
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
||||||
github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
||||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
@ -42,12 +42,12 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
|
|||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
github.com/mcstatus-io/mcutil/v3 v3.6.0 h1:IJqIXMtVtz1yUcMKxnrUIcAlChm/OTNAPzyb16TTwLk=
|
github.com/mcstatus-io/mcutil/v4 v4.0.0-20240718180705-427b3bcbde17 h1:gdlFoHcepuGydv0yE29hrpdxIarTm0Z+8taA4QMndNw=
|
||||||
github.com/mcstatus-io/mcutil/v3 v3.6.0/go.mod h1:6Rv4qnejaTezu/feuQ2M4131phQxw0Q4C5h3An/iNxI=
|
github.com/mcstatus-io/mcutil/v4 v4.0.0-20240718180705-427b3bcbde17/go.mod h1:yC91WInI1U2GAMFWgpPgsAULPVS2o+4JCZbiiWhHwxM=
|
||||||
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE=
|
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE=
|
||||||
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
||||||
github.com/redis/go-redis/v9 v9.5.1 h1:H1X4D3yHPaYrkL5X06Wh6xNVM/pX0Ft4RV0vMGvLBh8=
|
github.com/redis/go-redis/v9 v9.5.4 h1:vOFYDKKVgrI5u++QvnMT7DksSMYg7Aw/Np4vLJLKLwY=
|
||||||
github.com/redis/go-redis/v9 v9.5.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
|
github.com/redis/go-redis/v9 v9.5.4/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
|
||||||
github.com/redis/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo=
|
github.com/redis/rueidis v1.0.19 h1:s65oWtotzlIFN8eMPhyYwxlwLR1lUdhza2KtWprKYSo=
|
||||||
github.com/redis/rueidis v1.0.19/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo=
|
github.com/redis/rueidis v1.0.19/go.mod h1:8B+r5wdnjwK3lTFml5VtxjzGOQAC+5UmujoD12pDrEo=
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
@ -57,8 +57,8 @@ github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08Yu
|
|||||||
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8=
|
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8=
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasthttp v1.53.0 h1:lW/+SUkOxCx2vlIu0iaImv4JLrVRnbbkpCoaawvA4zc=
|
github.com/valyala/fasthttp v1.55.0 h1:Zkefzgt6a7+bVKHnu/YaYSOPfNYNisSVBo/unVCf8k8=
|
||||||
github.com/valyala/fasthttp v1.53.0/go.mod h1:6dt4/8olwq9QARP/TDuPmWyWcl4byhpvTJ4AAtcz+QM=
|
github.com/valyala/fasthttp v1.55.0/go.mod h1:NkY9JtkrpPKmgwV3HTaS2HWaJss9RSIsRVfcxxoHiOM=
|
||||||
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
||||||
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||||
@ -70,12 +70,12 @@ github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gi
|
|||||||
github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76 h1:tBiBTKHnIjovYoLX/TPkcf+OjqqKGQrPtGT3Foz+Pgo=
|
github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76 h1:tBiBTKHnIjovYoLX/TPkcf+OjqqKGQrPtGT3Foz+Pgo=
|
||||||
github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76/go.mod h1:SQliXeA7Dhkt//vS29v3zpbEwoa+zb2Cn5xj5uO4K5U=
|
github.com/youmark/pkcs8 v0.0.0-20240424034433-3c2c7870ae76/go.mod h1:SQliXeA7Dhkt//vS29v3zpbEwoa+zb2Cn5xj5uO4K5U=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
go.mongodb.org/mongo-driver v1.15.0 h1:rJCKC8eEliewXjZGf0ddURtl7tTVy1TK3bfl0gkUSLc=
|
go.mongodb.org/mongo-driver v1.16.0 h1:tpRsfBJMROVHKpdGyc1BBEzzjDUWjItxbVSZ8Ls4BQ4=
|
||||||
go.mongodb.org/mongo-driver v1.15.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c=
|
go.mongodb.org/mongo-driver v1.16.0/go.mod h1:oB6AhJQvFQL4LEHyXi6aJzQJtBiTQHiAd83l0GdFaiw=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
|
||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
@ -91,22 +91,20 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
|||||||
@ -6,14 +6,16 @@ import (
|
|||||||
"main/src/assets"
|
"main/src/assets"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||||
"github.com/gofiber/fiber/v2/middleware/favicon"
|
"github.com/gofiber/fiber/v2/middleware/favicon"
|
||||||
"github.com/gofiber/fiber/v2/middleware/logger"
|
"github.com/gofiber/fiber/v2/middleware/logger"
|
||||||
"github.com/gofiber/fiber/v2/middleware/recover"
|
"github.com/gofiber/fiber/v2/middleware/recover"
|
||||||
"github.com/mcstatus-io/mcutil/v3"
|
"github.com/mcstatus-io/mcutil/v4/options"
|
||||||
"github.com/mcstatus-io/mcutil/v3/options"
|
"github.com/mcstatus-io/mcutil/v4/util"
|
||||||
|
"github.com/mcstatus-io/mcutil/v4/vote"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -53,15 +55,15 @@ func PingHandler(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
// JavaStatusHandler returns the status of the Java edition Minecraft server specified in the address parameter.
|
// JavaStatusHandler returns the status of the Java edition Minecraft server specified in the address parameter.
|
||||||
func JavaStatusHandler(ctx *fiber.Ctx) error {
|
func JavaStatusHandler(ctx *fiber.Ctx) error {
|
||||||
|
address := strings.ToLower(ctx.Params("address"))
|
||||||
|
|
||||||
opts, err := GetStatusOptions(ctx)
|
opts, err := GetStatusOptions(ctx)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
host, port, err := ParseAddress(ctx.Params("address"), 25565)
|
if _, _, err := util.ParseAddress(address); err != nil {
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return ctx.Status(http.StatusBadRequest).SendString("Invalid address value")
|
return ctx.Status(http.StatusBadRequest).SendString("Invalid address value")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,11 +75,11 @@ func JavaStatusHandler(ctx *fiber.Ctx) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = r.Increment(fmt.Sprintf("java-hits:%s-%d", host, port)); err != nil {
|
if err = r.Increment(fmt.Sprintf("java-hits:%s", address)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
response, expiresAt, err := GetJavaStatus(host, port, opts)
|
response, expiresAt, err := GetJavaStatus(address, opts)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -94,23 +96,23 @@ func JavaStatusHandler(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
// BedrockStatusHandler returns the status of the Bedrock edition Minecraft server specified in the address parameter.
|
// BedrockStatusHandler returns the status of the Bedrock edition Minecraft server specified in the address parameter.
|
||||||
func BedrockStatusHandler(ctx *fiber.Ctx) error {
|
func BedrockStatusHandler(ctx *fiber.Ctx) error {
|
||||||
|
address := strings.ToLower(ctx.Params("address"))
|
||||||
|
|
||||||
opts, err := GetStatusOptions(ctx)
|
opts, err := GetStatusOptions(ctx)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
host, port, err := ParseAddress(ctx.Params("address"), 19132)
|
if _, _, err := util.ParseAddress(address); err != nil {
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return ctx.Status(http.StatusBadRequest).SendString("Invalid address value")
|
return ctx.Status(http.StatusBadRequest).SendString("Invalid address value")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = r.Increment(fmt.Sprintf("bedrock-hits:%s-%d", host, port)); err != nil {
|
if err = r.Increment(fmt.Sprintf("bedrock-hits:%s", address)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
response, expiresAt, err := GetBedrockStatus(host, port, opts)
|
response, expiresAt, err := GetBedrockStatus(address, opts)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -127,19 +129,19 @@ func BedrockStatusHandler(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
// IconHandler returns the server icon for the specified Java edition Minecraft server.
|
// IconHandler returns the server icon for the specified Java edition Minecraft server.
|
||||||
func IconHandler(ctx *fiber.Ctx) error {
|
func IconHandler(ctx *fiber.Ctx) error {
|
||||||
|
address := strings.ToLower(ctx.Params("address"))
|
||||||
|
|
||||||
opts, err := GetStatusOptions(ctx)
|
opts, err := GetStatusOptions(ctx)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
host, port, err := ParseAddress(ctx.Params("address"), 25565)
|
if _, _, err := util.ParseAddress(address); err != nil {
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return ctx.Status(http.StatusBadRequest).SendString("Invalid address value")
|
return ctx.Status(http.StatusBadRequest).SendString("Invalid address value")
|
||||||
}
|
}
|
||||||
|
|
||||||
icon, expiresAt, err := GetServerIcon(host, port, opts)
|
icon, expiresAt, err := GetServerIcon(address, opts)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -171,7 +173,7 @@ func SendVoteHandler(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
if err = mcutil.SendVote(c, opts.Host, opts.Port, options.Vote{
|
if err = vote.SendVote(c, opts.Host, opts.Port, options.Vote{
|
||||||
PublicKey: opts.PublicKey,
|
PublicKey: opts.PublicKey,
|
||||||
Token: opts.Token,
|
Token: opts.Token,
|
||||||
ServiceName: opts.ServiceName,
|
ServiceName: opts.ServiceName,
|
||||||
|
|||||||
124
src/status.go
124
src/status.go
@ -12,10 +12,12 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mcstatus-io/mcutil/v3"
|
"github.com/mcstatus-io/mcutil/v4/formatting"
|
||||||
"github.com/mcstatus-io/mcutil/v3/formatting"
|
"github.com/mcstatus-io/mcutil/v4/options"
|
||||||
"github.com/mcstatus-io/mcutil/v3/options"
|
"github.com/mcstatus-io/mcutil/v4/query"
|
||||||
"github.com/mcstatus-io/mcutil/v3/response"
|
"github.com/mcstatus-io/mcutil/v4/response"
|
||||||
|
"github.com/mcstatus-io/mcutil/v4/status"
|
||||||
|
"github.com/mcstatus-io/mcutil/v4/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BaseStatus is the base response properties for returning any status response from the API.
|
// BaseStatus is the base response properties for returning any status response from the API.
|
||||||
@ -124,8 +126,8 @@ type SRVRecord struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetJavaStatus returns the status response of a Java Edition server, either using cache or fetching a fresh status.
|
// GetJavaStatus returns the status response of a Java Edition server, either using cache or fetching a fresh status.
|
||||||
func GetJavaStatus(host string, port uint16, opts *StatusOptions) (*JavaStatusResponse, time.Duration, error) {
|
func GetJavaStatus(host string, opts *StatusOptions) (*JavaStatusResponse, time.Duration, error) {
|
||||||
cacheKey := GetCacheKey(host, port, opts)
|
cacheKey := GetCacheKey(host, opts)
|
||||||
|
|
||||||
// Wait for any other processes to finish fetching the status of this server
|
// Wait for any other processes to finish fetching the status of this server
|
||||||
if config.Cache.EnableLocks {
|
if config.Cache.EnableLocks {
|
||||||
@ -154,7 +156,11 @@ func GetJavaStatus(host string, port uint16, opts *StatusOptions) (*JavaStatusRe
|
|||||||
|
|
||||||
// Fetch a fresh status from the server itself
|
// Fetch a fresh status from the server itself
|
||||||
{
|
{
|
||||||
response := FetchJavaStatus(host, port, opts)
|
response, err := FetchJavaStatus(host, opts)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(response)
|
data, err := json.Marshal(response)
|
||||||
|
|
||||||
@ -166,13 +172,13 @@ func GetJavaStatus(host string, port uint16, opts *StatusOptions) (*JavaStatusRe
|
|||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &response, 0, nil
|
return response, 0, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBedrockStatus returns the status response of a Bedrock Edition server, either using cache or fetching a fresh status.
|
// GetBedrockStatus returns the status response of a Bedrock Edition server, either using cache or fetching a fresh status.
|
||||||
func GetBedrockStatus(host string, port uint16, opts *StatusOptions) (*BedrockStatusResponse, time.Duration, error) {
|
func GetBedrockStatus(host string, opts *StatusOptions) (*BedrockStatusResponse, time.Duration, error) {
|
||||||
cacheKey := GetCacheKey(host, port, nil)
|
cacheKey := GetCacheKey(host, nil)
|
||||||
|
|
||||||
// Wait for any other processes to finish fetching the status of this server
|
// Wait for any other processes to finish fetching the status of this server
|
||||||
if config.Cache.EnableLocks {
|
if config.Cache.EnableLocks {
|
||||||
@ -201,7 +207,11 @@ func GetBedrockStatus(host string, port uint16, opts *StatusOptions) (*BedrockSt
|
|||||||
|
|
||||||
// Fetch a fresh status from the server itself
|
// Fetch a fresh status from the server itself
|
||||||
{
|
{
|
||||||
response := FetchBedrockStatus(host, port, opts)
|
response, err := FetchBedrockStatus(host, opts)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(response)
|
data, err := json.Marshal(response)
|
||||||
|
|
||||||
@ -213,13 +223,13 @@ func GetBedrockStatus(host string, port uint16, opts *StatusOptions) (*BedrockSt
|
|||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &response, 0, nil
|
return response, 0, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetServerIcon returns the icon image of a Java Edition server, either using cache or fetching a fresh image.
|
// GetServerIcon returns the icon image of a Java Edition server, either using cache or fetching a fresh image.
|
||||||
func GetServerIcon(host string, port uint16, opts *StatusOptions) ([]byte, time.Duration, error) {
|
func GetServerIcon(host string, opts *StatusOptions) ([]byte, time.Duration, error) {
|
||||||
cacheKey := GetCacheKey(host, port, nil)
|
cacheKey := GetCacheKey(host, nil)
|
||||||
|
|
||||||
// Fetch the cached icon if it exists
|
// Fetch the cached icon if it exists
|
||||||
{
|
{
|
||||||
@ -244,7 +254,7 @@ func GetServerIcon(host string, port uint16, opts *StatusOptions) ([]byte, time.
|
|||||||
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
status, err := mcutil.Status(ctx, host, port)
|
status, err := status.Modern(ctx, host)
|
||||||
|
|
||||||
if err == nil && status.Favicon != nil && strings.HasPrefix(*status.Favicon, "data:image/png;base64,") {
|
if err == nil && status.Favicon != nil && strings.HasPrefix(*status.Favicon, "data:image/png;base64,") {
|
||||||
data, err := base64.StdEncoding.DecodeString(strings.TrimPrefix(*status.Favicon, "data:image/png;base64,"))
|
data, err := base64.StdEncoding.DecodeString(strings.TrimPrefix(*status.Favicon, "data:image/png;base64,"))
|
||||||
@ -268,15 +278,15 @@ func GetServerIcon(host string, port uint16, opts *StatusOptions) ([]byte, time.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FetchJavaStatus fetches fresh information about a Java Edition Minecraft server.
|
// FetchJavaStatus fetches fresh information about a Java Edition Minecraft server.
|
||||||
func FetchJavaStatus(host string, port uint16, opts *StatusOptions) JavaStatusResponse {
|
func FetchJavaStatus(host string, opts *StatusOptions) (*JavaStatusResponse, error) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
srvRecord *net.SRV
|
srvRecord *net.SRV
|
||||||
resolvedHost string = host
|
resolvedHost string = host
|
||||||
ipAddress *string
|
ipAddress *string
|
||||||
statusResult *response.JavaStatus
|
statusResult *response.StatusModern
|
||||||
legacyStatusResult *response.JavaStatusLegacy
|
legacyStatusResult *response.StatusLegacy
|
||||||
queryResult *response.FullQuery
|
queryResult *response.QueryFull
|
||||||
wg sync.WaitGroup
|
wg sync.WaitGroup
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -291,7 +301,7 @@ func FetchJavaStatus(host string, port uint16, opts *StatusOptions) JavaStatusRe
|
|||||||
|
|
||||||
// Lookup the SRV record
|
// Lookup the SRV record
|
||||||
{
|
{
|
||||||
srvRecord, err = mcutil.LookupSRV("tcp", host)
|
srvRecord, err = util.LookupSRV(host)
|
||||||
|
|
||||||
if err == nil && srvRecord != nil {
|
if err == nil && srvRecord != nil {
|
||||||
resolvedHost = strings.Trim(srvRecord.Target, ".")
|
resolvedHost = strings.Trim(srvRecord.Target, ".")
|
||||||
@ -318,7 +328,7 @@ func FetchJavaStatus(host string, port uint16, opts *StatusOptions) JavaStatusRe
|
|||||||
// Retrieve the post-netty rewrite Java Edition status (Minecraft 1.8+)
|
// Retrieve the post-netty rewrite Java Edition status (Minecraft 1.8+)
|
||||||
{
|
{
|
||||||
go func() {
|
go func() {
|
||||||
statusResult, _ = mcutil.Status(statusContext, host, port, options.JavaStatus{
|
statusResult, _ = status.Modern(statusContext, host, options.StatusModern{
|
||||||
EnableSRV: true,
|
EnableSRV: true,
|
||||||
Timeout: opts.Timeout - time.Millisecond*100,
|
Timeout: opts.Timeout - time.Millisecond*100,
|
||||||
ProtocolVersion: 47,
|
ProtocolVersion: 47,
|
||||||
@ -342,7 +352,7 @@ func FetchJavaStatus(host string, port uint16, opts *StatusOptions) JavaStatusRe
|
|||||||
// Retrieve the pre-netty rewrite Java Edition status (Minecraft 1.7 and below)
|
// Retrieve the pre-netty rewrite Java Edition status (Minecraft 1.7 and below)
|
||||||
{
|
{
|
||||||
go func() {
|
go func() {
|
||||||
legacyStatusResult, _ = mcutil.StatusLegacy(legacyContext, host, port, options.JavaStatusLegacy{
|
legacyStatusResult, _ = status.Legacy(legacyContext, host, options.StatusLegacy{
|
||||||
EnableSRV: true,
|
EnableSRV: true,
|
||||||
Timeout: opts.Timeout - time.Millisecond*100,
|
Timeout: opts.Timeout - time.Millisecond*100,
|
||||||
ProtocolVersion: 47,
|
ProtocolVersion: 47,
|
||||||
@ -361,7 +371,7 @@ func FetchJavaStatus(host string, port uint16, opts *StatusOptions) JavaStatusRe
|
|||||||
// Retrieve the query information (if it is available)
|
// Retrieve the query information (if it is available)
|
||||||
if opts.Query {
|
if opts.Query {
|
||||||
go func() {
|
go func() {
|
||||||
queryResult, _ = mcutil.FullQuery(queryContext, host, port, options.Query{
|
queryResult, _ = query.Full(queryContext, host, options.Query{
|
||||||
Timeout: opts.Timeout - time.Millisecond*100,
|
Timeout: opts.Timeout - time.Millisecond*100,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -371,14 +381,14 @@ func FetchJavaStatus(host string, port uint16, opts *StatusOptions) JavaStatusRe
|
|||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
return BuildJavaResponse(host, port, statusResult, legacyStatusResult, queryResult, srvRecord, ipAddress)
|
return BuildJavaResponse(host, statusResult, legacyStatusResult, queryResult, srvRecord, ipAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FetchBedrockStatus fetches a fresh status of a Bedrock Edition server.
|
// FetchBedrockStatus fetches a fresh status of a Bedrock Edition server.
|
||||||
func FetchBedrockStatus(host string, port uint16, opts *StatusOptions) BedrockStatusResponse {
|
func FetchBedrockStatus(host string, opts *StatusOptions) (*BedrockStatusResponse, error) {
|
||||||
var (
|
var (
|
||||||
ipAddress *string
|
ipAddress *string
|
||||||
status *response.BedrockStatus
|
result *response.StatusBedrock
|
||||||
)
|
)
|
||||||
|
|
||||||
// Resolve the connection hostname to an IP address
|
// Resolve the connection hostname to an IP address
|
||||||
@ -396,19 +406,29 @@ func FetchBedrockStatus(host string, port uint16, opts *StatusOptions) BedrockSt
|
|||||||
|
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
status, _ = mcutil.StatusBedrock(ctx, host, port)
|
result, _ = status.Bedrock(ctx, host)
|
||||||
}
|
}
|
||||||
|
|
||||||
return BuildBedrockResponse(host, port, status, ipAddress)
|
return BuildBedrockResponse(host, result, ipAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BuildJavaResponse builds the response data from the status and query information.
|
// BuildJavaResponse builds the response data from the status and query information.
|
||||||
func BuildJavaResponse(host string, port uint16, status *response.JavaStatus, legacyStatus *response.JavaStatusLegacy, query *response.FullQuery, srvRecord *net.SRV, ipAddress *string) (result JavaStatusResponse) {
|
func BuildJavaResponse(host string, status *response.StatusModern, legacyStatus *response.StatusLegacy, query *response.QueryFull, srvRecord *net.SRV, ipAddress *string) (result *JavaStatusResponse, err error) {
|
||||||
result = JavaStatusResponse{
|
hostname, port, err := util.ParseAddress(host)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if port == nil {
|
||||||
|
port = PointerOf(uint16(util.DefaultJavaPort))
|
||||||
|
}
|
||||||
|
|
||||||
|
result = &JavaStatusResponse{
|
||||||
BaseStatus: BaseStatus{
|
BaseStatus: BaseStatus{
|
||||||
Online: false,
|
Online: false,
|
||||||
Host: host,
|
Host: hostname,
|
||||||
Port: port,
|
Port: *port,
|
||||||
IPAddress: ipAddress,
|
IPAddress: ipAddress,
|
||||||
EULABlocked: IsBlockedAddress(host),
|
EULABlocked: IsBlockedAddress(host),
|
||||||
RetrievedAt: time.Now().UnixMilli(),
|
RetrievedAt: time.Now().UnixMilli(),
|
||||||
@ -423,9 +443,9 @@ func BuildJavaResponse(host string, port uint16, status *response.JavaStatus, le
|
|||||||
|
|
||||||
result.JavaStatus = &JavaStatus{
|
result.JavaStatus = &JavaStatus{
|
||||||
Version: &JavaVersion{
|
Version: &JavaVersion{
|
||||||
NameRaw: status.Version.NameRaw,
|
NameRaw: status.Version.Name.Raw,
|
||||||
NameClean: status.Version.NameClean,
|
NameClean: status.Version.Name.Clean,
|
||||||
NameHTML: status.Version.NameHTML,
|
NameHTML: status.Version.Name.HTML,
|
||||||
Protocol: status.Version.Protocol,
|
Protocol: status.Version.Protocol,
|
||||||
},
|
},
|
||||||
Players: JavaPlayers{
|
Players: JavaPlayers{
|
||||||
@ -447,9 +467,9 @@ func BuildJavaResponse(host string, port uint16, status *response.JavaStatus, le
|
|||||||
for _, player := range status.Players.Sample {
|
for _, player := range status.Players.Sample {
|
||||||
result.Players.List = append(result.Players.List, Player{
|
result.Players.List = append(result.Players.List, Player{
|
||||||
UUID: player.ID,
|
UUID: player.ID,
|
||||||
NameRaw: player.NameRaw,
|
NameRaw: player.Name.Raw,
|
||||||
NameClean: player.NameClean,
|
NameClean: player.Name.Clean,
|
||||||
NameHTML: player.NameHTML,
|
NameHTML: player.Name.HTML,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -458,8 +478,8 @@ func BuildJavaResponse(host string, port uint16, status *response.JavaStatus, le
|
|||||||
result.Icon = status.Favicon
|
result.Icon = status.Favicon
|
||||||
}
|
}
|
||||||
|
|
||||||
if status.ModInfo != nil {
|
if status.Mods != nil {
|
||||||
for _, mod := range status.ModInfo.Mods {
|
for _, mod := range status.Mods.List {
|
||||||
result.Mods = append(result.Mods, Mod{
|
result.Mods = append(result.Mods, Mod{
|
||||||
Name: mod.ID,
|
Name: mod.ID,
|
||||||
Version: mod.Version,
|
Version: mod.Version,
|
||||||
@ -488,9 +508,9 @@ func BuildJavaResponse(host string, port uint16, status *response.JavaStatus, le
|
|||||||
|
|
||||||
if legacyStatus.Version != nil {
|
if legacyStatus.Version != nil {
|
||||||
result.Version = &JavaVersion{
|
result.Version = &JavaVersion{
|
||||||
NameRaw: legacyStatus.Version.NameRaw,
|
NameRaw: legacyStatus.Version.Name.Raw,
|
||||||
NameClean: legacyStatus.Version.NameClean,
|
NameClean: legacyStatus.Version.Name.Clean,
|
||||||
NameHTML: legacyStatus.Version.NameHTML,
|
NameHTML: legacyStatus.Version.Name.HTML,
|
||||||
Protocol: legacyStatus.Version.Protocol,
|
Protocol: legacyStatus.Version.Protocol,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -600,12 +620,22 @@ func BuildJavaResponse(host string, port uint16, status *response.JavaStatus, le
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BuildBedrockResponse builds the response data from the status information.
|
// BuildBedrockResponse builds the response data from the status information.
|
||||||
func BuildBedrockResponse(host string, port uint16, status *response.BedrockStatus, ipAddress *string) (result BedrockStatusResponse) {
|
func BuildBedrockResponse(host string, status *response.StatusBedrock, ipAddress *string) (result *BedrockStatusResponse, err error) {
|
||||||
result = BedrockStatusResponse{
|
hostname, port, err := util.ParseAddress(host)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if port == nil {
|
||||||
|
port = PointerOf(uint16(util.DefaultBedrockPort))
|
||||||
|
}
|
||||||
|
|
||||||
|
result = &BedrockStatusResponse{
|
||||||
BaseStatus: BaseStatus{
|
BaseStatus: BaseStatus{
|
||||||
Online: false,
|
Online: false,
|
||||||
Host: host,
|
Host: hostname,
|
||||||
Port: port,
|
Port: *port,
|
||||||
IPAddress: ipAddress,
|
IPAddress: ipAddress,
|
||||||
EULABlocked: IsBlockedAddress(host),
|
EULABlocked: IsBlockedAddress(host),
|
||||||
RetrievedAt: time.Now().UnixMilli(),
|
RetrievedAt: time.Now().UnixMilli(),
|
||||||
|
|||||||
@ -270,10 +270,9 @@ func GetInstanceID() (uint16, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetCacheKey generates a unique key used for caching status results in Redis.
|
// GetCacheKey generates a unique key used for caching status results in Redis.
|
||||||
func GetCacheKey(host string, port uint16, opts *StatusOptions) string {
|
func GetCacheKey(host string, opts *StatusOptions) string {
|
||||||
values := &url.Values{}
|
values := &url.Values{}
|
||||||
values.Set("host", host)
|
values.Set("host", host)
|
||||||
values.Set("port", strconv.FormatUint(uint64(port), 10))
|
|
||||||
|
|
||||||
if opts != nil {
|
if opts != nil {
|
||||||
values.Set("query", strconv.FormatBool(opts.Query))
|
values.Set("query", strconv.FormatBool(opts.Query))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user