From 12c9ba3dc3a50c85795304f2c36ed1c7fb42c6fb Mon Sep 17 00:00:00 2001 From: Shrecknt <58538423+Shrecknt@users.noreply.github.com> Date: Sat, 25 Nov 2023 15:24:00 -0800 Subject: [PATCH] yeet --- .gitignore | 6 + Cargo.lock | 1861 ++++++++++++++++++++++++++++++++++++ Cargo.toml | 20 + exclude.txt | 1507 +++++++++++++++++++++++++++++ postgres_setup.sql | 40 + src/addr_range.rs | 35 + src/database.rs | 34 + src/exclude.rs | 105 ++ src/io/database.rs | 61 ++ src/io/mod.rs | 55 ++ src/io/network.rs | 14 + src/lib.rs | 27 + src/main.rs | 90 ++ src/modes/all_ports.rs | 14 + src/modes/discovery.rs | 16 + src/modes/discovery_top.rs | 18 + src/modes/mod.rs | 63 ++ src/modes/range.rs | 10 + src/modes/range_top.rs | 10 + src/modes/rescan.rs | 22 + 20 files changed, 4008 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 exclude.txt create mode 100644 postgres_setup.sql create mode 100644 src/addr_range.rs create mode 100644 src/database.rs create mode 100644 src/exclude.rs create mode 100644 src/io/database.rs create mode 100644 src/io/mod.rs create mode 100644 src/io/network.rs create mode 100644 src/lib.rs create mode 100644 src/main.rs create mode 100644 src/modes/all_ports.rs create mode 100644 src/modes/discovery.rs create mode 100644 src/modes/discovery_top.rs create mode 100644 src/modes/mod.rs create mode 100644 src/modes/range.rs create mode 100644 src/modes/range_top.rs create mode 100644 src/modes/rescan.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1f1e1a8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/target +.env +/data +flamegraph.svg +perf.data +perf.data.old \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..e34e157 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1861 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + +[[package]] +name = "atomic-write-file" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c232177ba50b16fe7a4588495bd474a62a9e45a8e4ca6fd7d0b7ac29d164631e" +dependencies = [ + "nix", + "rand", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +dependencies = [ + "serde", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "const-oid" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" + +[[package]] +name = "cpufeatures" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "csv" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" +dependencies = [ + "csv-core", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "csv-core" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" +dependencies = [ + "memchr", +] + +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +dependencies = [ + "serde", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "eyre" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80f656be11ddf91bd709454d15d5bd896fbaf4cc3314e69349e4d1569f5b46cd" +dependencies = [ + "indenter", + "once_cell", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "finl_unicode" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" + +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +dependencies = [ + "num-traits", +] + +[[package]] +name = "flume" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +dependencies = [ + "futures-core", + "futures-sink", + "spin 0.9.8", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" + +[[package]] +name = "futures-executor" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot", +] + +[[package]] +name = "futures-io" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" + +[[package]] +name = "futures-sink" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + +[[package]] +name = "futures-task" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" + +[[package]] +name = "futures-util" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +dependencies = [ + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + +[[package]] +name = "halfbrown" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5681137554ddff44396e5f149892c769d45301dd9aa19c51602a89ee214cb0ec" +dependencies = [ + "hashbrown 0.13.2", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +dependencies = [ + "ahash", + "allocator-api2", +] + +[[package]] +name = "hashlink" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +dependencies = [ + "hashbrown 0.14.2", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.2", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "js-sys" +version = "0.3.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin 0.5.2", +] + +[[package]] +name = "lexical-core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cde5de06e8d4c2faabc400238f9ae1c74d5412d03a7bd067645ccbc47070e46" +dependencies = [ + "lexical-parse-float", + "lexical-parse-integer", + "lexical-util", + "lexical-write-float", + "lexical-write-integer", +] + +[[package]] +name = "lexical-parse-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" +dependencies = [ + "static_assertions", +] + +[[package]] +name = "lexical-write-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accabaa1c4581f05a3923d1b4cfd124c329352288b7b9da09e766b0668116862" +dependencies = [ + "lexical-util", + "lexical-write-integer", + "static_assertions", +] + +[[package]] +name = "lexical-write-integer" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1b6f3d1f4422866b68192d62f77bc5c700bee84f3069f2469d7bc8c77852446" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "libc" +version = "0.2.150" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libsqlite3-sys" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +dependencies = [ + "libc", + "wasi", + "windows-sys", +] + +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset", + "pin-utils", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "perfect_rand" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "104084d34bd145ce2c329373e6a7dd4467ea3e0b5dfc6c55f7da9b1c65b43986" +dependencies = [ + "rand", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "ref-cast" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "rsa" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a3211b01eea83d80687da9eef70e39d65144a3894866a5153a2723e425a157f" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustix" +version = "0.38.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "serde_json" +version = "1.0.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "simd-json" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a3720326b20bf5b95b72dbbd133caae7e0dcf71eae8f6e6656e71a7e5c9aaa" +dependencies = [ + "getrandom", + "halfbrown", + "lexical-core", + "ref-cast", + "serde", + "serde_json", + "simdutf8", + "value-trait", +] + +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" + +[[package]] +name = "snowstorm" +version = "0.1.0" +dependencies = [ + "csv", + "dotenv", + "eyre", + "lazy_static", + "parking_lot", + "perfect_rand", + "rand", + "simd-json", + "sqlx", + "tokio", + "uuid", +] + +[[package]] +name = "socket2" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sqlformat" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" +dependencies = [ + "itertools", + "nom", + "unicode_categories", +] + +[[package]] +name = "sqlx" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" +dependencies = [ + "ahash", + "atoi", + "byteorder", + "bytes", + "crc", + "crossbeam-queue", + "dotenvy", + "either", + "event-listener", + "futures-channel", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashlink", + "hex", + "indexmap", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlformat", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "url", +] + +[[package]] +name = "sqlx-macros" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841" +dependencies = [ + "atomic-write-file", + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn 1.0.109", + "tempfile", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" +dependencies = [ + "atoi", + "base64", + "bitflags 2.4.1", + "byteorder", + "bytes", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" +dependencies = [ + "atoi", + "base64", + "bitflags 2.4.1", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490" +dependencies = [ + "atoi", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "tracing", + "url", + "urlencoding", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stringprep" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +dependencies = [ + "finl_unicode", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys", +] + +[[package]] +name = "thiserror" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "tokio-stream" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "uuid" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" + +[[package]] +name = "value-trait" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea87257cfcbedcb9444eda79c59fdfea71217e6305afee8ee33f500375c2ac97" +dependencies = [ + "float-cmp", + "halfbrown", + "itoa", + "ryu", +] + +[[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" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[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.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.39", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" + +[[package]] +name = "whoami" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +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.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "zerocopy" +version = "0.7.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..c9071e0 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "snowstorm" +version = "0.1.0" +edition = "2021" + +[profile.release] +debug = true + +[dependencies] +csv = "1.3.0" +dotenv = "0.15.0" +eyre = "0.6.9" +lazy_static = "1.4.0" +parking_lot = "0.12.1" +perfect_rand = "0.1.5" +rand = "0.8.5" +simd-json = "0.13.4" +sqlx = { version = "0.7.3", features = ["postgres", "runtime-tokio"] } +tokio = { version = "1.34.0", features = ["full"] } +uuid = "1.6.1" diff --git a/exclude.txt b/exclude.txt new file mode 100644 index 0000000..2de5ce4 --- /dev/null +++ b/exclude.txt @@ -0,0 +1,1507 @@ + +0.0.0.0/8 +10.0.0.0/8 +100.64.0.0/10 +127.0.0.0/8 +169.254.0.0/16 +172.16.0.0/12 +192.0.0.0/24 +192.0.0.0/29 +192.0.0.170/32 +192.0.0.171/32 +192.0.2.0/24 +192.88.99.0/24 +192.168.0.0/16 +198.18.0.0/15 +198.51.100.0/24 +203.0.113.0/24 +240.0.0.0/4 +255.255.255.255/32 +153.11.0.0/16 +194.77.40.242 +194.77.40.246 +165.160.0.0/16 +129.123.0.0/16 +144.39.0.0/16 +204.113.91.0/24 +132.206.9.0/24 +132.206.123.0/24 +132.206.125.0/24 +6.0.0.0/8 +7.0.0.0/8 +11.0.0.0/8 +21.0.0.0/8 +22.0.0.0/8 +26.0.0.0/8 +28.0.0.0/8 +29.0.0.0/8 +30.0.0.0/8 +33.0.0.0/8 +55.0.0.0/8 +205.0.0.0/8 +214.0.0.0/8 +215.0.0.0/8 +31.25.0.0/23 +31.25.2.0/23 +31.25.4.0/22 +37.72.112.0/21 +46.254.200.0/21 +81.87.0.0/16 +85.12.64.0/18 +89.207.208.0/21 +92.245.224.0/19 +128.16.0.0/16 +128.40.0.0/16 +128.41.0.0/18 +128.86.0.0/16 +128.232.0.0/16 +128.240.0.0/16 +128.243.0.0/16 +129.11.0.0/16 +129.12.0.0/16 +129.31.0.0/16 +129.67.0.0/16 +129.169.0.0/16 +129.215.0.0/16 +129.234.0.0/16 +130.88.0.0/16 +130.159.0.0/16 +130.209.0.0/16 +130.246.0.0/16 +131.111.0.0/16 +131.227.0.0/16 +131.231.0.0/16 +131.251.0.0/16 +134.36.0.0/16 +134.83.0.0/16 +134.151.0.0/16 +134.219.0.0/16 +134.220.0.0/16 +134.225.0.0/16 +136.148.0.0/16 +136.156.0.0/16 +137.44.0.0/16 +137.50.0.0/16 +137.73.0.0/16 +137.108.0.0/16 +137.195.0.0/16 +137.222.0.0/16 +137.253.0.0/16 +138.38.0.0/16 +138.40.0.0/16 +138.250.0.0/15 +138.253.0.0/16 +139.133.0.0/16 +139.153.0.0/16 +139.166.0.0/16 +139.184.0.0/16 +139.222.0.0/16 +140.97.0.0/16 +141.163.0.0/16 +141.170.64.0/19 +141.170.96.0/22 +141.170.100.0/23 +141.241.0.0/16 +143.52.0.0/15 +143.117.0.0/16 +143.167.0.0/16 +143.210.0.0/16 +143.234.0.0/16 +144.32.0.0/16 +144.82.0.0/16 +144.124.0.0/16 +144.173.0.0/16 +146.87.0.0/16 +146.97.0.0/16 +146.169.0.0/16 +146.176.0.0/16 +146.179.0.0/16 +146.191.0.0/16 +146.227.0.0/16 +147.143.0.0/16 +147.188.0.0/16 +147.197.0.0/16 +148.79.0.0/16 +148.88.0.0/16 +148.197.0.0/16 +149.155.0.0/16 +149.170.0.0/16 +150.204.0.0/16 +152.71.0.0/16 +152.78.0.0/16 +152.105.0.0/16 +155.198.0.0/16 +155.245.0.0/16 +157.140.0.0/16 +157.228.0.0/16 +158.94.0.0/16 +158.125.0.0/16 +158.143.0.0/16 +158.223.0.0/16 +159.86.128.0/18 +159.92.0.0/16 +160.5.0.0/16 +160.9.0.0/16 +161.73.0.0/16 +161.74.0.0/16 +161.76.0.0/16 +161.112.0.0/16 +163.1.0.0/16 +163.119.0.0/16 +163.160.0.0/16 +163.167.0.0/16 +164.11.0.0/16 +185.83.168.0/22 +192.12.72.0/24 +192.18.195.0/24 +192.35.172.0/24 +192.41.104.0/21 +192.41.112.0/20 +192.41.128.0/22 +192.68.153.0/24 +192.76.6.0/23 +192.76.8.0/21 +192.76.16.0/20 +192.76.32.0/22 +192.82.153.0/24 +192.84.5.0/24 +192.84.75.0/24 +192.84.76.0/22 +192.84.80.0/22 +192.84.212.0/24 +192.88.9.0/24 +192.88.10.0/24 +192.94.235.0/24 +192.100.78.0/24 +192.100.154.0/24 +192.107.168.0/24 +192.108.120.0/24 +192.124.46.0/24 +192.133.244.0/24 +192.149.111.0/24 +192.150.180.0/22 +192.150.184.0/24 +192.153.213.0/24 +192.156.162.0/24 +192.160.194.0/24 +192.171.128.0/18 +192.171.192.0/21 +192.173.1.0/24 +192.173.2.0/23 +192.173.4.0/24 +192.173.128.0/21 +192.188.157.0/24 +192.188.158.0/24 +192.190.201.0/24 +192.190.202.0/24 +192.195.42.0/23 +192.195.105.0/24 +192.195.116.0/23 +192.195.118.0/24 +193.32.22.0/24 +193.37.225.0/24 +193.37.240.0/21 +193.38.143.0/24 +193.39.80.0/21 +193.39.172.0/22 +193.39.212.0/24 +193.60.0.0/14 +193.107.116.0/22 +193.130.15.0/24 +193.133.28.0/23 +193.138.86.0/24 +194.32.32.0/20 +194.35.93.0/24 +194.35.186.0/24 +194.35.192.0/19 +194.35.241.0/24 +194.36.1.0/24 +194.36.2.0/23 +194.36.121.0/24 +194.36.152.0/21 +194.60.218.0/24 +194.66.0.0/16 +194.80.0.0/14 +194.187.32.0/22 +195.194.0.0/15 +212.121.0.0/19 +212.121.192.0/19 +212.219.0.0/16 +208.77.218.112/29 +193.138.29.159/32 +217.23.49.178/32 +217.23.49.204/32 +217.23.49.208/32 +46.140.160.132/32 +77.235.182.103/32 +82.135.26.82/32 +193.138.29.10/32 +193.138.29.15/32 +193.138.29.185/32 +217.23.49.196/30 +217.23.49.200/29 +217.23.49.208/31 +217.23.49.210/32 +217.23.49.214/32 +217.23.49.222/32 +208.66.2.19/32 +77.37.17.36/32 +46.41.0.109/32 +217.23.48.81/32 +5.75.128.66 +5.75.128.77 +5.75.128.195 +5.75.129.86 +5.75.129.96 +5.75.129.235 +5.75.134.59 +5.75.135.197 +5.75.137.0 +5.75.140.41 +5.75.141.19 +5.75.141.22 +5.75.141.28 +5.75.141.63 +5.75.141.110 +5.75.142.149 +5.75.143.121 +5.75.146.7 +5.75.148.78 +5.75.149.100 +5.75.155.23 +5.75.155.28 +5.75.155.118 +5.75.157.114 +5.75.160.126 +5.75.161.43 +5.75.164.118 +5.75.166.86 +5.75.168.196 +5.75.168.231 +5.75.170.161 +5.75.172.201 +5.75.174.115 +5.75.175.104 +5.75.177.18 +5.75.178.74 +5.75.182.49 +5.75.182.178 +5.75.182.227 +5.75.185.3 +5.75.185.95 +5.75.185.234 +5.75.189.151 +5.75.192.125 +5.75.193.92 +5.75.194.25 +5.75.196.54 +5.75.199.220 +5.75.201.218 +5.75.202.28 +5.75.202.138 +5.75.203.151 +5.75.206.112 +5.75.206.206 +5.75.210.31 +5.75.210.52 +5.75.211.137 +5.75.213.143 +5.75.215.57 +5.75.216.235 +5.75.218.82 +5.75.221.83 +5.75.222.191 +5.75.222.219 +5.75.223.48 +5.75.227.165 +5.75.227.193 +5.75.229.90 +5.75.229.97 +5.75.230.221 +5.75.231.95 +5.75.233.90 +5.75.233.237 +5.75.235.91 +5.75.237.198 +5.75.239.198 +5.75.239.227 +5.75.242.17 +5.75.242.137 +5.75.242.145 +5.75.245.22 +5.75.250.157 +5.75.250.169 +5.75.251.68 +5.75.252.65 +5.75.253.29 +49.12.144.77 +49.12.145.111 +49.12.145.221 +49.12.146.82 +49.12.146.243 +49.12.147.23 +49.12.147.160 +49.12.149.125 +49.12.151.38 +49.12.151.117 +49.12.151.164 +49.12.170.240 +49.12.174.5 +49.13.1.15 +49.13.5.253 +49.13.6.148 +49.13.7.68 +49.13.8.237 +49.13.11.76 +49.13.17.95 +49.13.17.106 +49.13.18.145 +49.13.22.24 +49.13.23.18 +49.13.25.18 +49.13.25.103 +49.13.26.165 +49.13.28.181 +49.13.31.228 +49.13.32.205 +49.13.33.115 +49.13.35.130 +49.13.35.186 +49.13.38.85 +49.13.38.229 +49.13.41.33 +49.13.46.55 +49.13.47.147 +49.13.47.174 +49.13.49.174 +49.13.50.116 +49.13.51.121 +49.13.53.151 +49.13.57.102 +49.13.58.121 +49.13.58.176 +49.13.58.251 +49.13.59.151 +49.13.59.214 +49.13.61.12 +49.13.61.153 +49.13.61.162 +49.13.62.180 +49.13.62.220 +49.13.63.206 +49.13.66.55 +49.13.67.104 +49.13.67.243 +49.13.70.180 +49.13.71.18 +49.13.71.217 +49.13.71.241 +49.13.71.246 +49.13.74.49 +49.13.80.119 +49.13.82.71 +49.13.84.41 +49.13.85.32 +49.13.88.239 +49.13.89.187 +49.13.90.233 +49.13.91.64 +49.13.91.233 +49.13.94.90 +49.13.94.115 +49.13.97.88 +49.13.97.92 +49.13.97.158 +49.13.97.162 +49.13.97.176 +49.13.97.176 +49.13.100.108 +49.13.103.113 +49.13.103.152 +49.13.103.172 +49.13.106.106 +49.13.106.137 +49.13.106.236 +49.13.107.215 +49.13.108.155 +49.13.113.198 +49.13.116.112 +49.13.120.246 +49.13.122.34 +49.13.123.247 +49.13.124.58 +49.13.125.84 +49.13.126.124 +49.13.126.141 +49.13.126.198 +49.13.127.148 +49.13.128.119 +49.13.130.157 +49.13.130.254 +49.13.131.103 +49.13.132.197 +49.13.133.167 +49.13.133.188 +49.13.134.232 +49.13.135.185 +49.13.136.154 +49.13.137.35 +49.13.141.56 +49.13.141.248 +49.13.144.15 +49.13.144.166 +49.13.145.27 +49.13.148.102 +49.13.149.172 +49.13.152.195 +49.13.154.193 +49.13.156.237 +49.13.157.33 +49.13.157.212 +49.13.158.142 +49.13.159.95 +49.13.161.196 +49.13.163.202 +49.13.164.239 +49.13.165.73 +49.13.168.217 +49.13.169.103 +49.13.170.88 +49.13.171.77 +49.13.171.201 +49.13.173.244 +49.13.176.48 +49.13.177.126 +49.13.179.101 +49.13.181.12 +49.13.181.18 +49.13.181.38 +49.13.181.86 +49.13.182.162 +49.13.185.25 +49.13.187.73 +49.13.187.103 +49.13.190.115 +49.13.191.21 +49.13.191.124 +49.13.192.198 +49.13.193.21 +49.13.195.21 +49.13.196.115 +49.13.200.3 +49.13.203.40 +49.13.205.77 +49.13.206.227 +49.13.208.248 +49.13.211.23 +49.13.213.14 +49.13.215.124 +49.13.216.115 +49.13.219.26 +49.13.220.228 +49.13.220.254 +49.13.222.232 +49.13.223.242 +49.13.226.155 +49.13.226.182 +49.13.227.92 +49.13.227.251 +49.13.230.197 +49.13.230.242 +49.13.233.137 +49.13.233.165 +49.13.235.64 +49.13.237.21 +49.13.238.18 +49.13.239.162 +49.13.240.202 +49.13.243.84 +49.13.244.135 +49.13.245.212 +49.13.246.151 +49.13.246.241 +49.13.247.62 +49.13.248.12 +49.13.248.143 +49.13.248.255 +49.13.252.54 +49.13.252.145 +49.13.253.14 +49.13.254.1 +49.13.254.40 +49.13.254.133 +49.13.255.112 +49.13.255.155 +65.109.33.118 +65.109.33.232 +65.109.36.76 +65.109.37.185 +65.109.38.58 +65.109.38.78 +65.109.38.125 +65.109.41.72 +65.109.43.167 +65.109.43.200 +65.109.44.73 +65.109.46.17 +65.109.46.134 +65.109.47.199 +65.109.49.182 +65.109.50.72 +65.109.55.22 +65.109.55.112 +65.109.55.175 +65.109.57.199 +65.109.58.205 +65.109.59.6 +65.109.61.90 +65.109.61.105 +65.109.65.207 +65.109.66.139 +65.109.67.69 +65.109.67.223 +65.109.69.188 +65.109.70.112 +65.109.70.141 +65.109.74.56 +65.109.76.111 +65.109.77.120 +65.109.77.134 +65.109.80.134 +65.109.83.205 +65.109.85.107 +65.109.85.169 +65.109.87.207 +65.109.87.221 +65.109.88.94 +65.109.89.241 +65.109.91.155 +65.109.92.238 +65.109.92.238 +65.109.93.28 +65.109.94.119 +65.109.95.248 +65.109.98.13 +65.109.100.166 +65.109.102.34 +65.109.103.32 +65.109.103.105 +65.109.104.5 +65.109.106.147 +65.109.107.76 +65.109.110.152 +65.109.111.164 +65.109.113.166 +65.109.115.51 +65.109.115.195 +65.109.117.11 +65.109.119.10 +65.109.120.55 +65.109.120.239 +65.109.125.139 +65.109.127.48 +65.109.128.150 +65.109.132.125 +65.109.134.46 +65.109.135.31 +65.109.139.226 +65.109.140.45 +65.109.141.54 +65.109.142.128 +65.109.143.5 +65.109.143.5 +65.109.143.165 +65.109.144.93 +65.109.145.53 +65.109.145.64 +65.109.146.3 +65.109.146.3 +65.109.146.112 +65.109.146.147 +65.109.146.167 +65.109.149.13 +65.109.149.59 +65.109.149.156 +65.109.150.200 +65.109.151.160 +65.109.151.199 +65.109.153.9 +65.109.153.66 +65.109.157.87 +65.109.162.106 +65.109.162.161 +65.109.162.168 +65.109.162.225 +65.109.163.80 +65.109.167.60 +65.109.167.171 +65.109.168.159 +65.109.169.242 +65.109.170.114 +65.109.173.226 +65.109.174.23 +65.109.176.217 +65.109.176.234 +65.109.177.15 +65.109.181.246 +65.109.182.189 +65.109.184.162 +65.109.184.181 +65.109.184.233 +65.109.189.70 +65.109.190.44 +65.109.190.173 +65.109.191.219 +65.109.196.178 +65.109.198.137 +65.109.199.20 +65.109.199.20 +65.109.200.29 +65.109.200.122 +65.109.200.165 +65.109.201.224 +65.109.201.246 +65.109.202.199 +65.109.203.219 +65.109.204.90 +65.109.204.95 +65.109.206.44 +65.109.212.50 +65.109.212.109 +65.109.212.207 +65.109.212.211 +65.109.212.247 +65.109.213.161 +65.109.213.194 +65.109.213.218 +65.109.214.56 +65.109.215.119 +65.109.215.158 +65.109.217.251 +65.109.218.61 +65.109.220.217 +65.109.223.254 +65.109.224.181 +65.109.230.208 +65.109.234.110 +65.109.234.159 +65.109.234.244 +65.109.236.244 +65.109.243.126 +65.109.248.64 +65.109.248.77 +65.109.248.90 +65.109.248.159 +65.109.252.100 +65.109.253.144 +65.109.254.168 +65.109.255.117 +78.46.12.80 +78.46.31.211 +78.46.119.116 +78.46.127.151 +78.46.131.84 +78.46.136.39 +78.46.158.180 +78.46.159.118 +78.46.159.157 +78.46.165.214 +78.46.165.217 +78.46.172.94 +78.46.178.28 +78.46.178.116 +78.46.180.104 +78.46.186.127 +78.46.189.185 +78.46.190.4 +78.46.196.1 +78.46.196.21 +78.46.197.194 +78.46.231.185 +78.46.242.250 +78.46.245.146 +78.46.252.126 +78.46.255.146 +78.47.5.83 +78.47.11.162 +78.47.14.166 +78.47.23.218 +78.47.31.212 +78.47.45.13 +78.47.50.70 +78.47.66.82 +78.47.73.157 +78.47.73.189 +78.47.79.197 +78.47.95.182 +78.47.99.128 +78.47.125.79 +78.47.135.185 +78.47.148.233 +78.47.169.79 +78.47.173.106 +78.47.175.189 +78.47.176.251 +78.47.177.129 +78.47.186.126 +78.47.189.36 +78.47.192.10 +78.47.197.73 +78.47.202.180 +78.47.219.229 +78.47.220.77 +78.47.230.31 +78.47.246.209 +78.47.249.9 +88.198.28.67 +88.198.30.204 +88.198.31.89 +88.198.73.50 +88.198.77.64 +88.198.108.0 +88.198.154.175 +88.198.156.115 +88.198.162.143 +88.198.168.210 +88.198.168.212 +88.198.178.48 +88.198.179.199 +88.198.180.154 +88.198.192.194 +88.198.207.157 +88.198.212.194 +88.198.215.128 +88.198.225.231 +88.198.232.205 +88.198.233.190 +88.198.239.214 +88.198.240.164 +88.198.244.92 +88.198.250.183 +88.198.251.55 +88.198.251.119 +88.198.252.27 +91.107.128.180 +91.107.131.204 +91.107.132.129 +91.107.133.163 +91.107.133.228 +91.107.135.124 +91.107.136.35 +91.107.136.129 +91.107.137.204 +91.107.137.238 +91.107.138.83 +91.107.138.112 +91.107.139.72 +91.107.141.211 +91.107.142.90 +91.107.142.98 +91.107.142.116 +91.107.142.172 +91.107.143.27 +91.107.145.164 +91.107.145.247 +91.107.145.250 +91.107.147.153 +91.107.148.41 +91.107.151.9 +91.107.152.141 +91.107.154.62 +91.107.155.219 +91.107.157.21 +91.107.157.250 +91.107.158.3 +91.107.158.160 +91.107.159.125 +91.107.159.238 +91.107.160.56 +91.107.160.231 +91.107.161.93 +91.107.164.203 +91.107.165.98 +91.107.167.62 +91.107.167.169 +91.107.168.162 +91.107.172.97 +91.107.173.193 +91.107.177.37 +91.107.177.138 +91.107.179.83 +91.107.181.39 +91.107.181.48 +91.107.182.67 +91.107.182.210 +91.107.188.86 +91.107.188.176 +91.107.189.76 +91.107.189.231 +91.107.190.22 +91.107.192.35 +91.107.192.71 +91.107.192.112 +91.107.192.146 +91.107.195.47 +91.107.195.163 +91.107.197.133 +91.107.197.249 +91.107.201.173 +91.107.202.45 +91.107.202.63 +91.107.203.238 +91.107.204.98 +91.107.205.8 +91.107.209.173 +91.107.210.211 +91.107.211.86 +91.107.212.72 +91.107.212.159 +91.107.212.184 +91.107.213.54 +91.107.215.10 +91.107.215.19 +91.107.216.224 +91.107.218.87 +91.107.219.89 +91.107.220.38 +91.107.220.117 +91.107.223.33 +91.107.227.243 +91.107.228.73 +91.107.229.158 +91.107.229.249 +91.107.236.15 +91.107.236.165 +91.107.238.240 +91.107.244.74 +91.107.245.150 +91.107.245.193 +91.107.246.13 +91.107.247.78 +91.107.249.160 +91.107.250.126 +91.107.250.154 +91.107.250.210 +91.107.252.35 +91.107.252.149 +91.107.254.35 +94.130.60.225 +94.130.61.26 +94.130.63.96 +94.130.63.100 +95.217.253.241 +95.217.254.175 +128.140.3.84 +128.140.5.43 +128.140.5.81 +128.140.6.120 +128.140.7.44 +128.140.7.246 +128.140.10.114 +128.140.11.7 +128.140.11.236 +128.140.12.155 +128.140.12.184 +128.140.15.231 +128.140.18.14 +128.140.21.61 +128.140.22.144 +128.140.24.51 +128.140.24.242 +128.140.26.32 +128.140.26.49 +128.140.27.199 +128.140.28.111 +128.140.29.63 +128.140.29.114 +128.140.30.60 +128.140.30.232 +128.140.32.93 +128.140.32.177 +128.140.32.213 +128.140.35.254 +128.140.41.119 +128.140.43.120 +128.140.43.167 +128.140.45.76 +128.140.49.58 +128.140.54.162 +128.140.54.181 +128.140.54.224 +128.140.54.246 +128.140.57.247 +128.140.59.59 +128.140.59.176 +128.140.65.245 +128.140.66.17 +128.140.67.128 +128.140.68.136 +128.140.68.245 +128.140.71.214 +128.140.72.95 +128.140.73.148 +128.140.74.65 +128.140.77.244 +128.140.81.107 +128.140.82.133 +128.140.82.165 +128.140.84.56 +128.140.85.196 +128.140.86.52 +128.140.86.192 +128.140.89.45 +128.140.90.72 +128.140.94.139 +128.140.94.141 +128.140.96.210 +128.140.100.23 +128.140.100.161 +128.140.101.129 +128.140.101.227 +128.140.101.249 +128.140.103.49 +128.140.104.188 +128.140.106.126 +128.140.107.70 +128.140.108.93 +128.140.109.91 +128.140.110.57 +128.140.110.92 +128.140.112.54 +128.140.112.105 +128.140.119.145 +128.140.119.231 +128.140.120.11 +128.140.120.254 +128.140.121.219 +128.140.123.201 +128.140.123.239 +128.140.126.190 +128.140.127.156 +162.55.200.7 +162.55.201.202 +162.55.202.145 +162.55.202.147 +162.55.205.150 +162.55.206.0 +162.55.206.80 +162.55.207.175 +162.55.207.179 +167.233.16.117 +167.233.17.34 +167.233.17.237 +167.233.19.231 +167.233.22.171 +167.233.24.26 +167.233.28.107 +167.233.32.204 +167.233.35.38 +167.233.37.190 +167.233.41.75 +167.233.41.231 +167.233.42.56 +167.233.43.200 +167.233.44.61 +167.233.47.243 +167.233.51.186 +167.233.51.233 +167.233.53.162 +167.233.56.127 +167.233.57.97 +167.233.58.99 +167.233.58.126 +167.233.58.218 +167.233.58.244 +167.233.59.96 +167.233.59.219 +167.233.61.47 +167.233.63.161 +167.233.64.197 +167.233.65.191 +167.233.66.113 +167.233.69.169 +167.233.69.193 +167.233.70.44 +167.233.71.90 +167.233.72.66 +167.233.72.101 +167.233.75.77 +167.233.77.205 +167.233.81.213 +167.233.84.112 +167.233.86.40 +167.233.87.151 +167.233.87.229 +167.233.92.85 +167.233.93.252 +167.233.96.23 +167.233.96.177 +167.233.96.225 +167.233.96.252 +167.233.98.45 +167.233.99.147 +167.233.102.89 +167.233.105.28 +167.233.105.123 +167.233.106.32 +167.233.106.93 +167.233.106.113 +167.233.107.251 +167.233.108.125 +167.233.109.123 +167.233.111.164 +167.233.114.160 +167.233.115.13 +167.233.115.136 +167.233.116.89 +167.233.118.83 +167.233.119.105 +167.233.122.81 +167.233.123.230 +167.233.125.113 +167.233.130.192 +167.233.132.44 +167.233.133.17 +167.233.133.251 +167.233.134.84 +167.233.135.238 +167.233.137.19 +167.233.138.195 +167.233.140.185 +167.233.141.185 +167.233.145.28 +167.233.145.228 +167.233.146.93 +167.233.146.201 +167.233.147.134 +167.233.149.193 +167.233.152.200 +167.233.154.138 +167.233.155.208 +167.233.157.165 +167.233.159.161 +167.233.161.111 +167.233.161.212 +167.233.162.149 +167.233.162.181 +167.233.165.208 +167.233.167.210 +167.233.169.83 +167.233.171.35 +167.233.172.33 +167.233.172.160 +167.233.173.103 +167.233.175.171 +167.233.176.59 +167.233.176.207 +167.233.177.73 +167.233.180.187 +167.233.181.104 +167.233.183.6 +167.233.184.63 +167.233.184.188 +167.233.185.14 +167.233.185.187 +167.233.189.73 +167.233.189.239 +167.233.190.125 +167.233.191.60 +167.233.192.215 +167.233.193.208 +167.233.193.223 +167.233.193.246 +167.233.193.250 +167.233.195.164 +167.233.197.231 +167.233.198.196 +167.233.200.18 +167.233.201.45 +167.233.204.36 +167.233.208.197 +167.233.208.245 +167.233.211.155 +167.233.213.71 +167.233.220.43 +167.233.220.56 +167.233.220.135 +167.233.220.249 +167.233.221.67 +167.233.222.139 +167.233.222.150 +167.233.224.90 +167.233.224.100 +167.233.226.251 +167.233.227.51 +167.233.228.147 +167.233.230.36 +167.233.230.105 +167.233.235.103 +167.233.236.116 +167.233.237.104 +167.233.238.197 +167.233.239.13 +167.233.239.73 +167.233.239.179 +167.233.240.171 +167.233.243.144 +167.233.243.186 +167.233.244.172 +167.233.245.23 +167.233.246.24 +167.233.246.50 +167.233.248.82 +167.233.249.127 +167.233.250.20 +167.233.254.194 +167.233.255.198 +167.235.100.54 +167.235.100.137 +167.235.101.52 +167.235.101.233 +167.235.102.193 +167.235.112.213 +167.235.114.175 +167.235.122.52 +167.235.125.118 +167.235.128.138 +167.235.128.245 +167.235.129.67 +167.235.129.169 +167.235.131.143 +167.235.132.157 +167.235.133.192 +167.235.135.169 +167.235.136.30 +167.235.136.88 +167.235.136.251 +167.235.136.251 +167.235.137.117 +167.235.139.234 +167.235.141.247 +167.235.142.146 +167.235.144.134 +167.235.145.91 +167.235.146.81 +167.235.148.201 +167.235.148.213 +167.235.148.237 +167.235.150.166 +167.235.155.131 +167.235.155.218 +167.235.157.18 +167.235.157.110 +167.235.159.63 +167.235.160.208 +167.235.161.75 +167.235.164.25 +167.235.165.210 +167.235.165.221 +167.235.167.180 +167.235.167.203 +167.235.170.129 +167.235.170.132 +167.235.171.45 +167.235.172.28 +167.235.174.94 +167.235.175.104 +167.235.177.146 +167.235.177.155 +167.235.179.54 +167.235.180.16 +167.235.180.97 +167.235.182.0 +167.235.183.73 +167.235.184.91 +167.235.184.249 +167.235.185.237 +167.235.186.206 +167.235.187.154 +167.235.187.251 +167.235.189.187 +167.235.191.229 +167.235.194.132 +167.235.199.154 +167.235.200.7 +167.235.200.57 +167.235.200.186 +167.235.200.188 +167.235.202.26 +167.235.203.32 +167.235.204.239 +167.235.205.59 +167.235.205.194 +167.235.205.218 +167.235.208.6 +167.235.208.176 +167.235.211.115 +167.235.212.50 +167.235.212.123 +167.235.212.185 +167.235.214.188 +167.235.214.220 +167.235.215.2 +167.235.215.119 +167.235.222.80 +188.34.168.241 +188.34.170.107 +188.34.170.114 +188.34.171.166 +188.34.173.241 +188.34.175.240 +188.34.208.149 +188.34.209.73 +188.34.209.178 +188.34.210.246 +188.34.211.209 +188.34.217.133 +188.34.218.130 +188.34.218.162 +188.34.219.221 +188.34.221.220 +188.34.222.10 +188.34.222.47 +188.34.225.44 +188.34.226.33 +188.34.226.186 +188.34.229.51 +188.34.229.132 +188.34.232.106 +188.34.234.25 +188.34.234.54 +188.34.234.212 +188.34.235.252 +188.34.236.115 +188.34.237.4 +188.34.237.131 +188.34.239.27 +188.34.240.106 +188.34.240.199 +188.34.241.71 +188.34.241.225 +188.34.242.192 +188.34.243.120 +188.34.245.148 +188.34.247.96 +188.34.250.154 +188.34.251.123 +188.34.255.54 +188.34.255.234 +213.133.96.61 +213.133.96.204 +213.133.112.208 +213.133.118.118 +213.133.118.190 +213.133.119.226 +213.133.124.38 +213.133.124.82 +213.133.125.138 +213.133.125.236 +213.133.127.32 +213.239.224.78 +213.239.240.204 +213.239.242.170 +213.239.244.27 +213.239.251.121 +213.239.254.235 +204.109.59.195 +91.190.98.59 +91.190.98.28 +91.190.98.143 +86.107.32.35 +46.28.0.120 +93.95.216.85 +93.95.216.129 +46.254.38.79 +86.107.32.51 +86.107.36.17 +86.107.36.207 +46.28.0.111 +86.107.36.28 +86.107.36.21 +86.107.32.123 +86.107.32.57 +46.254.36.97 +86.107.32.15 +86.107.32.41 +46.28.0.23 +86.107.32.67 +93.95.216.160 +46.30.244.69 +46.28.0.114 +86.107.36.29 +46.16.91.115 +86.107.32.21 +86.107.32.81 +86.107.32.81 +93.95.216.171 +93.95.216.229 +86.107.32.85 +93.95.216.199 +86.107.32.53 +93.95.216.147 +93.95.216.217 +86.107.32.93 +46.254.38.246 +93.95.216.232 +86.107.32.59 +86.107.32.38 +46.28.2.45 +46.30.244.61 +86.107.32.40 +46.30.241.42 +86.107.32.72 +86.107.32.56 +86.107.32.50 +46.254.39.22 +46.28.0.96 +46.254.34.240 +86.107.36.26 +86.107.32.94 +86.107.36.19 +46.30.247.163 +86.107.32.71 +193.70.146.70 +93.95.216.114 +46.30.241.118 +86.107.32.55 +46.30.247.138 +93.95.216.48 +46.254.37.63 +93.95.216.222 +86.107.36.18 +86.107.32.95 +86.107.36.11 +93.95.216.17 +46.28.0.106 +193.70.146.49 +46.30.244.91 +93.95.216.159 +86.107.32.42 +93.95.216.143 +86.107.32.26 +86.107.32.12 +46.28.0.119 +46.30.241.109 +46.16.90.51 +46.16.95.102 +193.70.146.126 +46.30.241.114 +93.95.216.123 +46.28.0.121 +93.95.216.132 +93.95.216.71 +93.95.216.212 +93.95.216.226 +46.254.34.37 +46.28.0.116 +86.107.32.84 +93.95.216.187 +93.95.216.221 +93.95.216.178 +93.95.216.230 +46.28.2.163 +93.95.216.103 +93.95.216.184 +93.95.216.162 +93.95.216.182 +46.30.244.53 +46.30.247.142 +93.95.216.128 +193.70.146.128 +193.70.146.119 +86.107.32.220 +77.39.208.6 +86.107.36.220 +93.95.216.122 +93.95.216.59 +46.30.247.169 +86.107.32.11 +46.16.88.25 +93.95.216.161 +86.107.32.45 +86.107.32.27 +46.30.247.153 +86.107.32.18 +93.95.216.172 +46.30.244.44 +93.95.216.142 +193.70.146.54 +86.107.32.143 +46.30.241.120 +46.254.34.71 +86.107.32.25 +46.28.2.155 +46.30.241.95 +46.254.36.135 +86.107.36.15 +93.95.216.227 +193.70.146.130 +93.95.216.107 +86.107.36.14 +86.107.32.31 +86.107.32.83 +46.28.0.118 +46.28.0.109 +46.254.34.235 +86.107.32.14 +46.254.39.215 +46.254.34.161 +86.107.32.88 +93.95.216.220 +46.30.241.36 +46.30.247.10 +86.107.32.13 +46.28.5.18 +86.107.36.16 +86.107.32.54 +46.30.244.42 +46.254.39.23 +86.107.32.86 +86.107.32.60 +86.107.32.91 +86.107.32.76 +93.95.216.58 +86.107.32.58 +86.107.32.70 +93.95.216.213 +46.30.243.9 +46.30.241.121 +86.107.32.44 +46.254.33.241 +46.28.0.94 +46.30.243.196 +46.30.241.108 +86.107.32.68 +46.30.243.248 +46.30.244.93 +46.30.244.46 +86.107.36.20 +86.107.32.17 +46.30.241.122 +46.254.38.62 +46.30.247.140 +46.254.33.5 +46.30.247.14 +46.30.243.138 +46.254.33.172 +46.254.33.48 +46.30.243.116 +46.30.243.100 +46.28.0.127 +93.95.216.6 +93.95.216.65 +93.95.216.37 +86.107.32.28 +93.95.216.59 +93.95.216.18 +93.95.216.162 +103.17.20.160/29 +202.91.162.0-202.91.175.255 +167.114.174.127 +200.160.0.0/20 +188.192.251.198 +141.144.195.248 +31.164.226.61 +65.21.227.235 +65.21.227.248 +107.189.14.155 \ No newline at end of file diff --git a/postgres_setup.sql b/postgres_setup.sql new file mode 100644 index 0000000..bc6568a --- /dev/null +++ b/postgres_setup.sql @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS join_table; +DROP TABLE IF EXISTS servers; +DROP TABLE IF EXISTS players; + +CREATE TABLE servers ( + id BIGINT NOT NULL, + ip INT NOT NULL, + port SMALLINT NOT NULL, + version_name TEXT, + version_protocol INT, + max_players INT, + online_players INT, + description TEXT, + enforces_secure_chat BOOLEAN, + previews_chat BOOLEAN, + UNIQUE (id) +); + +CREATE TABLE players ( + id SERIAL, + uuid UUID NOT NULL, + username TEXT NOT NULL, + UNIQUE (uuid), + CONSTRAINT players_pkey PRIMARY KEY (id) +); + +CREATE TABLE join_table ( + server_id BIGINT NOT NULL, + player_id BIGINT NOT NULL, + discovered BIGINT NOT NULL DEFAULT EXTRACT(epoch from now()), + last_seen BIGINT NOT NULL DEFAULT EXTRACT(epoch from now()), + CONSTRAINT fk_player + FOREIGN KEY (player_id) + REFERENCES players(id), + CONSTRAINT fk_server + FOREIGN KEY (server_id) + REFERENCES servers(id), + CONSTRAINT join_pkey + PRIMARY KEY (server_id, player_id) +); diff --git a/src/addr_range.rs b/src/addr_range.rs new file mode 100644 index 0000000..5971d18 --- /dev/null +++ b/src/addr_range.rs @@ -0,0 +1,35 @@ +use std::{net::Ipv4Addr, str::FromStr}; + +#[derive(Debug, PartialEq, Clone)] +pub struct Ipv4AddrRange { + pub first: Ipv4Addr, + pub last: Ipv4Addr, +} + +impl Ipv4AddrRange { + pub fn new(first: Ipv4Addr, last: Ipv4Addr) -> Self { + Self { first, last } + } +} + +impl FromStr for Ipv4AddrRange { + type Err = eyre::Report; + + fn from_str(s: &str) -> Result { + let string = s.split('/').collect::>(); + if string.len() != 2 { + return Err(eyre::Report::msg("Range string must have 1 '/' character")); + } + let ip_u32 = u32::from(Ipv4Addr::from_str(string[0])?); + let mask = 32 - string[1].parse::()?; + let mask_bits = 2u32.pow(mask as u32) - 1; + + let range_start = Ipv4Addr::from(ip_u32 & !mask_bits); + let range_end = Ipv4Addr::from(ip_u32 | mask_bits); + + Ok(Self { + first: range_start, + last: range_end, + }) + } +} diff --git a/src/database.rs b/src/database.rs new file mode 100644 index 0000000..76420e4 --- /dev/null +++ b/src/database.rs @@ -0,0 +1,34 @@ +use sqlx::{postgres::PgPoolOptions, PgPool, Row}; +use std::net::Ipv4Addr; + +pub struct DatabaseConnection { + pub pool: PgPool, + pub cursor: Option<(Ipv4Addr, u16)>, +} + +impl DatabaseConnection { + pub async fn new() -> Result { + let pool = PgPoolOptions::new() + .max_connections(8) + .connect( + &std::env::var("POSTGRES_URL").expect("No `POSTGRES_URL` environment variable"), + ) + .await?; + Ok(Self { pool, cursor: None }) + } + + pub async fn get_rescan(&self) -> Result, eyre::Report> { + let res = sqlx::query("SELECT id FROM servers") + .fetch_all(&self.pool) + .await?; + Ok(res.iter().map(|id| from_id(id.get("id"))).collect()) + } +} + +pub fn to_id(ip: Ipv4Addr, port: u16) -> i64 { + (u32::from(ip) as i64) << 16 | (port as i64) +} + +pub fn from_id(id: i64) -> (Ipv4Addr, u16) { + (Ipv4Addr::from((id >> 16) as u32), (id & 0xFFFF) as u16) +} diff --git a/src/exclude.rs b/src/exclude.rs new file mode 100644 index 0000000..11b1f0e --- /dev/null +++ b/src/exclude.rs @@ -0,0 +1,105 @@ +use lazy_static::lazy_static; +use std::{cmp::Ordering, collections::BTreeSet, fs, net::Ipv4Addr}; + +use crate::addr_range::Ipv4AddrRange; + +lazy_static! { + static ref EXCLUDE_LIST: BTreeSet = { + let file = fs::read_to_string("exclude.txt").unwrap(); + let rows = file.split('\n').filter(|item| item != &""); + rows.map(|ip_string| { + let ip_string = ip_string.trim(); + if ip_string.contains('/') { + let range = ip_string.parse::().unwrap(); + ExcludeEntry::Range(range) + } else if ip_string.contains('-') { + let sections = ip_string.split('-').collect::>(); + let range_start = sections[0].parse().unwrap(); + let range_end = sections[1].parse().unwrap(); + ExcludeEntry::Range(Ipv4AddrRange::new(range_start, range_end)) + } else { + ExcludeEntry::Address( + ip_string + .parse() + .unwrap_or_else(|_| panic!("Invalid ip string '{}'", ip_string)), + ) + } + }) + .collect() + }; +} + +#[derive(Debug, Clone)] +pub enum ExcludeEntry { + Address(Ipv4Addr), + Range(Ipv4AddrRange), +} + +impl PartialEq for ExcludeEntry { + fn eq(&self, other: &Self) -> bool { + self.cmp(other) == Ordering::Equal + } +} + +impl Eq for ExcludeEntry {} + +impl PartialOrd for ExcludeEntry { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for ExcludeEntry { + fn cmp(&self, other: &Self) -> Ordering { + match self { + ExcludeEntry::Address(a) => match other { + ExcludeEntry::Address(b) => a.cmp(b), + ExcludeEntry::Range(b) => { + if a < &b.first { + Ordering::Less + } else if a > &b.last { + Ordering::Greater + } else { + Ordering::Equal + } + } + }, + ExcludeEntry::Range(a) => match other { + ExcludeEntry::Address(b) => { + if &a.last < b { + Ordering::Less + } else if &a.first > b { + Ordering::Greater + } else { + Ordering::Equal + } + } + ExcludeEntry::Range(b) => a.first.cmp(&b.first), + }, + } + } +} + +pub fn is_allowed(ip: Ipv4Addr) -> bool { + !EXCLUDE_LIST.contains(&ExcludeEntry::Address(ip)) +} + +pub fn blocked_range_for_ip(ip: Ipv4Addr) -> Option { + EXCLUDE_LIST.get(&ExcludeEntry::Address(ip)).cloned() +} + +pub fn next_allowed(ip: Ipv4Addr) -> Ipv4Addr { + let initial_ip = ip; + let mut ip = ip; + while !is_allowed(ip) { + let exclude_entry = blocked_range_for_ip(ip).unwrap(); + match exclude_entry { + ExcludeEntry::Address(_) => ip = Ipv4Addr::from(u32::from(ip) + 1), + ExcludeEntry::Range(range) => ip = Ipv4Addr::from(u32::from(range.last) + 1), + } + if initial_ip == ip { + panic!("someone excluded every fucking ip in existence"); + } + } + ip +} diff --git a/src/io/database.rs b/src/io/database.rs new file mode 100644 index 0000000..1f8572b --- /dev/null +++ b/src/io/database.rs @@ -0,0 +1,61 @@ +use super::{Io, PingResult, PlayerInfo}; +use crate::ScannerState; +use std::{ + collections::BTreeSet, + net::Ipv4Addr, + sync::{mpsc::Sender, Arc}, +}; +use tokio::sync::Mutex; + +pub struct DatabaseScanner { + pub state: Arc>, + pub sender: Sender<(PingResult, Vec)>, + pub data: BTreeSet<(Ipv4Addr, u16)>, +} + +impl DatabaseScanner { + pub fn new( + state: Arc>, + sender: Sender<(PingResult, Vec)>, + ) -> Self { + let data = csv::Reader::from_path("data/souper.csv") + .unwrap() + .records() + .map(|item| { + let item = item.unwrap(); + ( + Ipv4Addr::from(item[0].parse::().unwrap()), + item[1].parse::().unwrap(), + ) + }) + .collect(); + + Self { + state, + sender, + data, + } + } +} + +impl Io for DatabaseScanner { + async fn ping(&self, addr: Ipv4Addr, port: u16) -> Result<(), eyre::Report> { + if self.data.contains(&(addr, port)) { + self.state.lock().await.discovered += 1; + self.sender + .send((PingResult::none(addr, port), vec![])) + .expect("Unable to send ping result"); + } + Ok(()) + } + + async fn legacy_ping(&self, addr: Ipv4Addr, port: u16) -> Result<(), eyre::Report> { + if self.data.contains(&(addr, port)) { + self.state.lock().await.discovered += 1; + self.sender + .send((PingResult::none(addr, port), vec![])) + .expect("Unable to send ping result"); + } + Ok(()) + } +} diff --git a/src/io/mod.rs b/src/io/mod.rs new file mode 100644 index 0000000..0ae0170 --- /dev/null +++ b/src/io/mod.rs @@ -0,0 +1,55 @@ +use std::net::Ipv4Addr; +use uuid::Uuid; + +pub mod database; +pub mod network; + +pub trait Io { + fn ping( + &self, + addr: Ipv4Addr, + port: u16, + ) -> impl std::future::Future> + Send; + + fn legacy_ping( + &self, + addr: Ipv4Addr, + port: u16, + ) -> impl std::future::Future> + Send; +} + +#[derive(Debug)] +pub struct PingResult { + // host info + pub ip: Ipv4Addr, + pub port: u16, + // ping results + pub version_name: Option, + pub version_protocol: Option, + pub max_players: Option, + pub online_players: Option, + pub description: Option, + pub enforces_secure_chat: Option, + pub previews_chat: Option, +} + +impl PingResult { + pub fn none(ip: Ipv4Addr, port: u16) -> Self { + Self { + ip, + port, + version_name: None, + version_protocol: None, + max_players: None, + online_players: None, + description: None, + enforces_secure_chat: None, + previews_chat: None, + } + } +} + +pub struct PlayerInfo { + pub name: String, + pub uuid: Uuid, +} diff --git a/src/io/network.rs b/src/io/network.rs new file mode 100644 index 0000000..1bb259b --- /dev/null +++ b/src/io/network.rs @@ -0,0 +1,14 @@ +use super::Io; +use std::net::Ipv4Addr; + +pub struct NetworkScanner {} + +impl Io for NetworkScanner { + async fn ping(&self, _addr: Ipv4Addr, _port: u16) -> Result<(), eyre::Report> { + todo!() + } + + async fn legacy_ping(&self, _addr: Ipv4Addr, _port: u16) -> Result<(), eyre::Report> { + todo!() + } +} diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..d7701f1 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,27 @@ +use modes::ScanningMode; + +pub mod addr_range; +pub mod database; +pub mod exclude; +pub mod io; +pub mod modes; + +pub struct ScannerState { + pub mode: ScanningMode, + pub discovered: usize, +} + +impl ScannerState { + pub fn new() -> Self { + ScannerState { + mode: ScanningMode::Discovery, + discovered: 0, + } + } +} + +impl Default for ScannerState { + fn default() -> Self { + Self::new() + } +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..fc81d94 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,90 @@ +use snowstorm::{ + database::DatabaseConnection, + io::{database::DatabaseScanner, Io}, + modes::{self, ModeCursors, ScanningMode}, + ScannerState, +}; +use std::{ + sync::{mpsc::channel, Arc}, + time::{Duration, Instant}, +}; +use tokio::sync::Mutex; + +#[tokio::main] +async fn main() -> Result<(), eyre::Report> { + dotenv::dotenv()?; + + let db = DatabaseConnection::new().await?; + let state = Arc::new(Mutex::new(ScannerState::default())); + let (ping_results_sender, ping_results) = channel(); + let pinger = DatabaseScanner::new(state.clone(), ping_results_sender); + + // println!("data: {:?}", pinger.data); + + let rescan = db.get_rescan().await?; + println!("rows = {:?}", rescan); + + tokio::spawn(async move { + ping_loop(db, state.clone(), pinger).await.unwrap(); + }); + + for (result, _players) in ping_results { + println!("{}:{}", result.ip, result.port); + } + + Ok(()) +} + +async fn ping_loop( + db: DatabaseConnection, + state: Arc>, + pinger: T, +) -> Result<(), eyre::Report> { + let mut cursors = ModeCursors::new(); + + let mut time = Instant::now(); + loop { + let mut state = state.lock().await; + + let now = Instant::now(); + if now - time > Duration::from_millis(1000) { + time = now; + println!( + "Servers found for ScanningMode::{:?}: {}", + state.mode, state.discovered + ); + state.discovered = 0; + if let ScanningMode::Rescan(..) = state.mode { + // TODO decide on the best scanning mode to use + state.mode = ScanningMode::Discovery; + } else { + let rescan_data = db.get_rescan().await.unwrap(); + state.mode = ScanningMode::Rescan(rescan_data); + } + } + + let mode = state.mode.clone(); + drop(state); // prevent deadlock + + match mode { + ScanningMode::Discovery => { + modes::discovery(&pinger, &mut cursors.discovery).await?; + } + ScanningMode::DiscoveryTopPorts => { + modes::discovery_top(&pinger, &mut cursors.discovery_top_ports).await?; + } + ScanningMode::Range(range) => { + modes::range(&pinger, &mut cursors.range, range).await?; + } + ScanningMode::RangeTopPorts(range) => { + modes::range_top(&pinger, &mut cursors.range_top_ports, range).await?; + } + ScanningMode::AllPorts(ip) => { + modes::all_ports(&pinger, &mut cursors.all_ports, ip).await?; + } + ScanningMode::Rescan(ips) => { + modes::rescan(&pinger, &mut cursors.rescan, ips).await?; + } + } + } +} diff --git a/src/modes/all_ports.rs b/src/modes/all_ports.rs new file mode 100644 index 0000000..2833393 --- /dev/null +++ b/src/modes/all_ports.rs @@ -0,0 +1,14 @@ +use super::PORTS_RANGE; +use crate::io::Io; +use std::net::Ipv4Addr; + +pub async fn all_ports( + pinger: &T, + cursor: &mut u32, + ip: Ipv4Addr, +) -> Result<(), eyre::Report> { + for port in PORTS_RANGE { + pinger.ping(ip, port).await?; + } + Ok(()) +} diff --git a/src/modes/discovery.rs b/src/modes/discovery.rs new file mode 100644 index 0000000..1b8cdac --- /dev/null +++ b/src/modes/discovery.rs @@ -0,0 +1,16 @@ +use super::RANDOMIZER; +use crate::{exclude, io::Io}; +use std::net::Ipv4Addr; + +pub async fn discovery(pinger: &T, cursor: &mut u32) -> Result<(), eyre::Report> { + let mut ip: Ipv4Addr; + loop { + ip = Ipv4Addr::from(RANDOMIZER.shuffle(*cursor as u64) as u32); + *cursor += 1; + if exclude::is_allowed(ip) { + break; + } + } + pinger.ping(ip, 25565).await?; + Ok(()) +} diff --git a/src/modes/discovery_top.rs b/src/modes/discovery_top.rs new file mode 100644 index 0000000..09c1480 --- /dev/null +++ b/src/modes/discovery_top.rs @@ -0,0 +1,18 @@ +use super::{PORTS_RANGE, RANDOMIZER}; +use crate::{exclude, io::Io}; +use std::net::Ipv4Addr; + +pub async fn discovery_top(pinger: &T, cursor: &mut u32) -> Result<(), eyre::Report> { + let mut ip: Ipv4Addr; + loop { + ip = Ipv4Addr::from(RANDOMIZER.shuffle(*cursor as u64) as u32); + *cursor += 1; + if exclude::is_allowed(ip) { + break; + } + } + for port in PORTS_RANGE { + pinger.ping(ip, port).await?; + } + Ok(()) +} diff --git a/src/modes/mod.rs b/src/modes/mod.rs new file mode 100644 index 0000000..376c2a1 --- /dev/null +++ b/src/modes/mod.rs @@ -0,0 +1,63 @@ +use crate::addr_range::Ipv4AddrRange; +use lazy_static::lazy_static; +use perfect_rand::PerfectRng; +use std::{net::Ipv4Addr, ops::Range}; + +mod all_ports; +mod discovery; +mod discovery_top; +mod range; +mod range_top; +mod rescan; + +pub use all_ports::all_ports; +pub use discovery::discovery; +pub use discovery_top::discovery_top; +pub use range::range; +pub use range_top::range_top; +pub use rescan::rescan; + +pub const PORTS_RANGE: Range = 1000..65535; + +lazy_static! { + pub static ref RANDOMIZER: PerfectRng = PerfectRng::new(2u64.pow(32), 0xda0d71bc391d3c92, 3); +} + +#[derive(Debug, PartialEq, Clone)] +pub enum ScanningMode { + /// Ping port 25565 on all allowed IPs + Discovery, + /// Ping top 8 common ports on all allowed IPs + DiscoveryTopPorts, + /// Ping port 25565 on all IPs in a given range + Range(Ipv4AddrRange), + /// Ping top 8 common ports on all IPs in a given range + RangeTopPorts(Ipv4AddrRange), + /// Ping all allowed ports on a single IP + AllPorts(Ipv4Addr), + /// Ping all servers in the database + Rescan(Vec<(Ipv4Addr, u16)>), +} + +#[derive(Debug)] +pub struct ModeCursors { + pub discovery: u32, + pub discovery_top_ports: u32, + pub range: u32, + pub range_top_ports: u32, + pub all_ports: u32, + pub rescan: usize, +} + +impl ModeCursors { + pub fn new() -> Self { + Self { + discovery: 0, + discovery_top_ports: 0, + range: 0, + range_top_ports: 0, + all_ports: 0, + rescan: 0, + } + } +} diff --git a/src/modes/range.rs b/src/modes/range.rs new file mode 100644 index 0000000..9f0ec35 --- /dev/null +++ b/src/modes/range.rs @@ -0,0 +1,10 @@ +use crate::{addr_range::Ipv4AddrRange, io::Io}; + +#[allow(unused)] +pub async fn range( + pinger: &T, + cursor: &mut u32, + range: Ipv4AddrRange, +) -> Result<(), eyre::Report> { + todo!() +} diff --git a/src/modes/range_top.rs b/src/modes/range_top.rs new file mode 100644 index 0000000..c2814d7 --- /dev/null +++ b/src/modes/range_top.rs @@ -0,0 +1,10 @@ +use crate::{addr_range::Ipv4AddrRange, io::Io}; + +#[allow(unused)] +pub async fn range_top( + pinger: &T, + cursor: &mut u32, + range: Ipv4AddrRange, +) -> Result<(), eyre::Report> { + todo!() +} diff --git a/src/modes/rescan.rs b/src/modes/rescan.rs new file mode 100644 index 0000000..f54e7df --- /dev/null +++ b/src/modes/rescan.rs @@ -0,0 +1,22 @@ +use crate::{exclude, io::Io}; +use std::net::Ipv4Addr; + +pub async fn rescan( + pinger: &T, + cursor: &mut usize, + ips: Vec<(Ipv4Addr, u16)>, +) -> Result<(), eyre::Report> { + if *cursor >= ips.len() { + *cursor = 0; + // I know this looks dumb, but if + // there was no return, getting the + // addr from the cursor would panic + return Ok(()); + } + let addr = ips[*cursor]; + *cursor += 1; + if exclude::is_allowed(addr.0) { + pinger.ping(addr.0, addr.1).await?; + } + Ok(()) +}