diff options
author | metamuffin <metamuffin@disroot.org> | 2022-10-17 10:05:32 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-10-17 10:05:32 +0200 |
commit | fbc478222c29014c9eae6eb9f450e679e9798b3b (patch) | |
tree | 1ef8b55383bf18bef32e042af0f8df9e92adbd0d | |
parent | a86f7a6f6d69f1459750f8ae9aa388bfa9251076 (diff) | |
download | trash-proxy-fbc478222c29014c9eae6eb9f450e679e9798b3b.tar trash-proxy-fbc478222c29014c9eae6eb9f450e679e9798b3b.tar.bz2 trash-proxy-fbc478222c29014c9eae6eb9f450e679e9798b3b.tar.zst |
stuff
-rw-r--r-- | Cargo.lock | 499 | ||||
-rw-r--r-- | Cargo.toml | 11 | ||||
-rw-r--r-- | proxy.yaml | 1 | ||||
-rw-r--r-- | src/config.rs | 1 | ||||
-rw-r--r-- | src/main.rs | 182 |
5 files changed, 600 insertions, 94 deletions
@@ -101,6 +101,7 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "azalea" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "anyhow", "async-trait", @@ -114,14 +115,25 @@ dependencies = [ [[package]] name = "azalea-auth" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "azalea-buf", + "azalea-crypto", + "chrono", + "log 0.4.17", + "num-bigint", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio 1.21.2", "uuid", ] [[package]] name = "azalea-block" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "azalea-block-macros", "azalea-buf", @@ -130,6 +142,7 @@ dependencies = [ [[package]] name = "azalea-block-macros" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "proc-macro2", "quote", @@ -139,10 +152,12 @@ dependencies = [ [[package]] name = "azalea-brigadier" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" [[package]] name = "azalea-buf" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "azalea-buf-macros", "byteorder", @@ -155,6 +170,7 @@ dependencies = [ [[package]] name = "azalea-buf-macros" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "proc-macro2", "quote", @@ -164,6 +180,7 @@ dependencies = [ [[package]] name = "azalea-chat" version = "0.1.1" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "azalea-buf", "azalea-language", @@ -175,6 +192,7 @@ dependencies = [ [[package]] name = "azalea-client" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "anyhow", "azalea-auth", @@ -195,6 +213,7 @@ dependencies = [ [[package]] name = "azalea-core" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "azalea-buf", "azalea-chat", @@ -205,6 +224,7 @@ dependencies = [ [[package]] name = "azalea-crypto" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "aes", "azalea-buf", @@ -219,6 +239,7 @@ dependencies = [ [[package]] name = "azalea-language" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "lazy_static", "serde", @@ -228,6 +249,7 @@ dependencies = [ [[package]] name = "azalea-nbt" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "ahash", "azalea-buf", @@ -240,6 +262,7 @@ dependencies = [ [[package]] name = "azalea-physics" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "azalea-block", "azalea-core", @@ -250,6 +273,7 @@ dependencies = [ [[package]] name = "azalea-protocol" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "async-compression", "async-recursion", @@ -282,6 +306,7 @@ dependencies = [ [[package]] name = "azalea-protocol-macros" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "proc-macro2", "quote", @@ -291,6 +316,7 @@ dependencies = [ [[package]] name = "azalea-registry" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "azalea-buf", "azalea-registry-macros", @@ -299,6 +325,7 @@ dependencies = [ [[package]] name = "azalea-registry-macros" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "proc-macro2", "quote", @@ -308,6 +335,7 @@ dependencies = [ [[package]] name = "azalea-world" version = "0.1.0" +source = "git+https://github.com/mat-1/azalea/#0f88e05a0cfe43c910f130f8e70f51055d9f6fd2" dependencies = [ "azalea-block", "azalea-buf", @@ -322,6 +350,12 @@ dependencies = [ ] [[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -337,6 +371,12 @@ dependencies = [ ] [[package]] +name = "bumpalo" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" + +[[package]] name = "byteorder" version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -359,6 +399,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" [[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] name = "cfb8" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -409,6 +455,22 @@ dependencies = [ ] [[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] name = "cpufeatures" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -501,6 +563,15 @@ dependencies = [ ] [[package]] +name = "encoding_rs" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] name = "enum-as-inner" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -526,6 +597,15 @@ dependencies = [ ] [[package]] +name = "fastrand" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +dependencies = [ + "instant", +] + +[[package]] name = "flate2" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -542,6 +622,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] name = "form_urlencoded" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -697,6 +792,25 @@ dependencies = [ ] [[package]] +name = "h2" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +dependencies = [ + "bytes 1.2.1", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio 1.21.2", + "tokio-util", + "tracing", +] + +[[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -729,12 +843,83 @@ dependencies = [ ] [[package]] +name = "http" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +dependencies = [ + "bytes 1.2.1", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes 1.2.1", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] name = "humantime" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] +name = "hyper" +version = "0.14.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +dependencies = [ + "bytes 1.2.1", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.7", + "tokio 1.21.2", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes 1.2.1", + "hyper", + "native-tls", + "tokio 1.21.2", + "tokio-native-tls", +] + +[[package]] name = "idna" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -801,7 +986,7 @@ dependencies = [ "socket2 0.3.19", "widestring", "winapi 0.3.9", - "winreg", + "winreg 0.6.2", ] [[package]] @@ -817,6 +1002,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] +name = "js-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +dependencies = [ + "wasm-bindgen", +] + +[[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -924,6 +1118,12 @@ dependencies = [ ] [[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] name = "miniz_oxide" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -987,6 +1187,24 @@ dependencies = [ ] [[package]] +name = "native-tls" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" +dependencies = [ + "lazy_static", + "libc", + "log 0.4.17", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] name = "net2" version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1107,6 +1325,51 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1" [[package]] +name = "openssl" +version = "0.10.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5230151e44c0f05157effb743e8d517472843121cf9243e8b81393edb5acd9ce" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] name = "parking_lot" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1199,6 +1462,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] +name = "pkg-config" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" + +[[package]] name = "ppv-lite86" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1291,6 +1560,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "reqwest" +version = "0.11.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" +dependencies = [ + "base64", + "bytes 1.2.1", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "log 0.4.17", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio 1.21.2", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg 0.10.1", +] + +[[package]] name = "resolv-conf" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1346,12 +1661,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] +name = "schannel" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +dependencies = [ + "lazy_static", + "windows-sys", +] + +[[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] +name = "security-framework" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1398,6 +1746,18 @@ dependencies = [ ] [[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] name = "serde_yaml" version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1499,6 +1859,20 @@ dependencies = [ ] [[package]] +name = "tempfile" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +dependencies = [ + "cfg-if 1.0.0", + "fastrand", + "libc", + "redox_syscall 0.2.16", + "remove_dir_all", + "winapi 0.3.9", +] + +[[package]] name = "termcolor" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1651,6 +2025,16 @@ dependencies = [ ] [[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio 1.21.2", +] + +[[package]] name = "tokio-reactor" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1770,6 +2154,12 @@ dependencies = [ ] [[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] name = "tracing" version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1835,6 +2225,12 @@ dependencies = [ ] [[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] name = "typenum" version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1891,6 +2287,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "feb41e78f93363bb2df8b0e86a2ca30eed7806ea16ea0c790d757cf93f79be83" [[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1903,12 +2305,98 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log 0.4.17", + "try-lock", +] + +[[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] +name = "wasm-bindgen" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +dependencies = [ + "bumpalo", + "log 0.4.17", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" + +[[package]] +name = "web-sys" +version = "0.3.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] name = "widestring" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2010,6 +2498,15 @@ dependencies = [ ] [[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] name = "ws2_32-sys" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -5,10 +5,14 @@ edition = "2021" [dependencies] +azalea = { git = "https://github.com/mat-1/azalea/" } +azalea-protocol = { git = "https://github.com/mat-1/azalea/" } +azalea-chat = { git = "https://github.com/mat-1/azalea/" } +# azalea = { path = "../external/azalea/azalea" } +# azalea-protocol = { path = "../external/azalea/azalea-protocol" } +# azalea-chat = { path = "../external/azalea/azalea-chat" } + anyhow = "1.0.65" -azalea = { path = "../external/azalea/azalea" } -azalea-protocol = { path = "../external/azalea/azalea-protocol" } -azalea-chat = { path = "../external/azalea/azalea-chat" } env_logger = "0.9.1" uuid = "1.1.2" parking_lot = "^0.12.1" @@ -18,4 +22,3 @@ serde = { version = "1.0", features = ["derive"] } serde_yaml = "0.9.13" future-utils = "0.12.1" bytes = "1.2.1" - @@ -1,3 +1,4 @@ +protocol: 760 backend: 127.0.0.1:25567 bind: 0.0.0.0:25565 whitelist: diff --git a/src/config.rs b/src/config.rs index 45ed6f2..b3d4e31 100644 --- a/src/config.rs +++ b/src/config.rs @@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Config { + pub protocol: u32, pub backend: SocketAddr, pub bind: SocketAddr, pub whitelist: Vec<PlayerConfig>, diff --git a/src/main.rs b/src/main.rs index 8111ebd..d1459e1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -84,6 +84,9 @@ async fn handle_client(config: Arc<Config>, sock: TcpStream) -> Result<(), anyho "new client (version={}, intent={:?})", p.protocol_version, p.intention ); + if p.protocol_version == config.protocol { + bail!("protocol version unsupported") + } match p.intention { ConnectionProtocol::Status => { handle_status_intent(config, downstream_writer, downstream_reader).await?; @@ -147,47 +150,6 @@ async fn handle_client(config: Arc<Config>, sock: TcpStream) -> Result<(), anyho connect(upstream_writer, downstream_reader).await?; Ok(()) - // for _ in 0..3 { - // let a = read_packet::<ClientboundLoginPacket, _>( - // &mut upstream_reader, - // &mut buf, - // None, - // &mut None, - // ) - // .await?; - // debug!("login {a:?}"); - // write_packet(&a, &mut downstream_writer, None, &mut None).await?; - // } - - // tokio::spawn(async move { - // let mut buf = BytesMut::new(); - // loop { - // let a = read_packet::<ClientboundGamePacket, _>( - // &mut upstream_reader, - // &mut buf, - // None, - // &mut None, - // ) - // .await - // .unwrap(); - // debug!("downstream {a:?}"); - // write_packet(&a, &mut downstream_writer, None, &mut None) - // .await - // .unwrap(); - // } - // }); - - // loop { - // let a = read_packet::<ClientboundGamePacket, _>( - // &mut downstream_reader, - // &mut buf, - // None, - // &mut None, - // ) - // .await?; - // debug!("upstream {a:?}"); - // write_packet(&a, &mut upstream_writer, None, &mut None).await?; - // } } async fn connect(mut writer: OwnedWriteHalf, mut reader: OwnedReadHalf) -> anyhow::Result<()> { @@ -213,9 +175,9 @@ async fn handle_status_intent( write_packet( &ServerboundHandshakePacket::ClientIntention(ClientIntentionPacket { - protocol_version: 760, - hostname: "127.0.0.1".to_string(), - port: 25567, + protocol_version: config.protocol, + hostname: config.backend.ip().to_string(), + port: config.backend.port(), intention: ConnectionProtocol::Status, }), &mut upstream_writer, @@ -231,49 +193,91 @@ async fn handle_status_intent( connect(upstream_writer, reader).await?; return Ok(()); - - // loop { - // let req = read_packet::<ServerboundStatusPacket, _>(&mut reader, &mut buf, None, &mut None) - // .await?; - // info!("{req:?}"); - // match req { - // ServerboundStatusPacket::StatusRequest(..) => { - // write_packet( - // &ClientboundStatusPacket::StatusResponse(ClientboundStatusResponsePacket { - // description: azalea_chat::component::Component::Text( - // legacy_color_code_to_text_component("blub"), - // ), - // favicon: None, - // players: Players { - // max: 10, - // online: 0, - // sample: vec![], - // }, - // version: Version { - // name: azalea_chat::component::Component::Text( - // legacy_color_code_to_text_component("blub"), - // ), - // protocol: 760, - // }, - // }), - // &mut writer, - // None, - // &mut None, - // ) - // .await?; - // } - // ServerboundStatusPacket::PingRequest(p) => { - // write_packet( - // &ClientboundStatusPacket::PongResponse(ClientboundPongResponsePacket { - // time: p.time, - // }), - // &mut writer, - // None, - // &mut None, - // ) - // .await?; - // } - // } - // } - // Ok(()) } + +// loop { +// let req = read_packet::<ServerboundStatusPacket, _>(&mut reader, &mut buf, None, &mut None) +// .await?; +// info!("{req:?}"); +// match req { +// ServerboundStatusPacket::StatusRequest(..) => { +// write_packet( +// &ClientboundStatusPacket::StatusResponse(ClientboundStatusResponsePacket { +// description: azalea_chat::component::Component::Text( +// legacy_color_code_to_text_component("blub"), +// ), +// favicon: None, +// players: Players { +// max: 10, +// online: 0, +// sample: vec![], +// }, +// version: Version { +// name: azalea_chat::component::Component::Text( +// legacy_color_code_to_text_component("blub"), +// ), +// protocol: 760, +// }, +// }), +// &mut writer, +// None, +// &mut None, +// ) +// .await?; +// } +// ServerboundStatusPacket::PingRequest(p) => { +// write_packet( +// &ClientboundStatusPacket::PongResponse(ClientboundPongResponsePacket { +// time: p.time, +// }), +// &mut writer, +// None, +// &mut None, +// ) +// .await?; +// } +// } +// } +// Ok(()) + +// for _ in 0..3 { +// let a = read_packet::<ClientboundLoginPacket, _>( +// &mut upstream_reader, +// &mut buf, +// None, +// &mut None, +// ) +// .await?; +// debug!("login {a:?}"); +// write_packet(&a, &mut downstream_writer, None, &mut None).await?; +// } + +// tokio::spawn(async move { +// let mut buf = BytesMut::new(); +// loop { +// let a = read_packet::<ClientboundGamePacket, _>( +// &mut upstream_reader, +// &mut buf, +// None, +// &mut None, +// ) +// .await +// .unwrap(); +// debug!("downstream {a:?}"); +// write_packet(&a, &mut downstream_writer, None, &mut None) +// .await +// .unwrap(); +// } +// }); + +// loop { +// let a = read_packet::<ClientboundGamePacket, _>( +// &mut downstream_reader, +// &mut buf, +// None, +// &mut None, +// ) +// .await?; +// debug!("upstream {a:?}"); +// write_packet(&a, &mut upstream_writer, None, &mut None).await?; +// } |