diff --git a/Cargo.lock b/Cargo.lock index 39fc028..3ab769a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,65 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + [[package]] name = "atomic-waker" version = "1.1.2" @@ -56,8 +115,10 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cloudcheck" -version = "8.4.2" +version = "8.4.3" dependencies = [ + "env_logger", + "log", "openssl", "pyo3", "pyo3-async-runtimes", @@ -68,6 +129,12 @@ dependencies = [ "tokio", ] +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + [[package]] name = "core-foundation" version = "0.9.4" @@ -104,6 +171,29 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "env_filter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + [[package]] name = "equivalent" version = "1.0.2" @@ -561,12 +651,42 @@ dependencies = [ "serde", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itoa" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49cce2b81f2098e7e3efc35bc2e0a6b7abec9d34128283d7a26fa8f32a6dbb35" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "980af8b43c3ad5d8d349ace167ec8170839f753a42d233ba19e08afe1850fa69" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "js-sys" version = "0.3.83" @@ -665,6 +785,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "openssl" version = "0.10.75" @@ -772,6 +898,15 @@ version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "potential_utf" version = "0.1.4" @@ -899,6 +1034,35 @@ dependencies = [ "bitflags", ] +[[package]] +name = "regex" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" + [[package]] name = "reqwest" version = "0.12.26" @@ -1348,9 +1512,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-core", @@ -1358,9 +1522,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.35" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", ] @@ -1407,6 +1571,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "vcpkg" version = "0.2.15" diff --git a/Cargo.toml b/Cargo.toml index 2ed3ff4..b93a535 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cloudcheck" -version = "8.4.2" +version = "8.4.3" edition = "2024" description = "CloudCheck is a simple Rust tool to check whether an IP address or hostname belongs to a cloud provider." license = "GPL-3.0" @@ -14,6 +14,8 @@ openssl = { version = "0.10", features = ["vendored"] } pyo3 = { version = "0.27", optional = true } pyo3-async-runtimes = { version = "0.27", features = ["tokio-runtime"], optional = true } radixtarget = "4.2" +log = "0.4" +env_logger = "0.11" [features] default = [] diff --git a/cloud_providers_v2.json b/cloud_providers_v2.json index 4256c87..2c6cc68 100644 --- a/cloud_providers_v2.json +++ b/cloud_providers_v2.json @@ -8,7 +8,7 @@ "ORG-OS3-RIPE" ], "v2fly_company": "", - "last_updated": 1766008490.7504184, + "last_updated": 1766077197.2494452, "asns": [ 16276, 35540 @@ -86,6 +86,7 @@ "143.14.59.0/24", "143.14.81.0/24", "143.20.195.0/24", + "143.20.223.0/24", "143.20.66.0/24", "144.172.73.0/24", "144.2.32.0/19", @@ -166,6 +167,7 @@ "172.83.201.0/24", "176.31.0.0/16", "178.32.0.0/15", + "178.93.124.0/24", "178.95.186.0/24", "180.131.145.0/24", "180.149.33.0/24", @@ -193,6 +195,7 @@ "185.226.181.0/24", "185.228.207.0/24", "185.241.50.0/23", + "185.251.234.0/24", "185.255.28.0/24", "185.30.212.0/22", "185.45.160.0/22", @@ -230,7 +233,7 @@ "193.43.104.0/24", "193.70.0.0/17", "194.147.159.0/24", - "194.15.33.0/24", + "194.150.165.0/24", "194.156.227.0/24", "194.164.230.0/24", "194.31.164.0/24", @@ -321,6 +324,7 @@ "2607:5300::/32", "31.24.81.0/24", "31.41.37.0/24", + "31.56.112.0/24", "31.56.219.0/24", "31.56.52.0/22", "31.57.161.0/24", @@ -357,7 +361,6 @@ "45.152.164.0/24", "45.154.157.0/24", "45.177.236.0/22", - "45.39.134.0/24", "45.39.79.0/24", "45.43.142.0/24", "45.62.167.0/24", @@ -476,6 +479,7 @@ "82.24.96.0/22", "82.25.146.0/23", "82.26.176.0/20", + "82.38.171.0/24", "82.38.28.0/24", "82.38.32.0/24", "82.38.60.0/24", @@ -525,7 +529,8 @@ "94.23.0.0/16", "95.169.162.0/24", "95.81.72.0/22", - "96.62.105.0/24" + "96.62.105.0/24", + "96.62.231.0/24" ], "domains": [ "ovh", @@ -543,7 +548,7 @@ "SKYCA-3-ARIN" ], "v2fly_company": "fastly", - "last_updated": 1766008492.4754348, + "last_updated": 1766077199.5374203, "asns": [ 895, 54113, @@ -726,6 +731,7 @@ "167.82.142.0/23", "167.82.160.0/20", "167.82.160.0/23", + "167.82.162.0/24", "167.82.167.0/24", "167.82.173.0/24", "167.82.224.0/20", @@ -761,7 +767,6 @@ "185.31.18.0/24", "198.54.216.0/24", "199.232.0.0/16", - "199.232.104.0/22", "199.232.112.0/22", "199.232.12.0/22", "199.232.136.0/22", @@ -783,7 +788,7 @@ "199.232.72.0/22", "199.232.80.0/22", "199.232.88.0/21", - "199.232.96.0/21", + "199.232.96.0/20", "199.27.72.0/21", "199.27.74.0/23", "199.27.76.0/23", @@ -1115,6 +1120,7 @@ "2a04:4e40:7030::/48", "2a04:4e40:7040::/48", "2a04:4e40:7200::/48", + "2a04:4e40:7300::/48", "2a04:4e40:7800::/48", "2a04:4e40:7830::/48", "2a04:4e40:7840::/48", @@ -1505,8 +1511,7 @@ "2a04:4e42:52::/48", "2a04:4e42:54::/48", "2a04:4e42:56::/47", - "2a04:4e42:58::/47", - "2a04:4e42:5a::/48", + "2a04:4e42:58::/46", "2a04:4e42:5c::/48", "2a04:4e42:6002::/48", "2a04:4e42:6009::/48", @@ -1596,7 +1601,7 @@ ], "org_ids": [], "v2fly_company": "heroku", - "last_updated": 1766008492.719316, + "last_updated": 1766077199.9399736, "asns": [], "cidrs": [], "domains": [ @@ -1638,7 +1643,7 @@ "WEX-ARIN" ], "v2fly_company": "cisco", - "last_updated": 1766008503.9588478, + "last_updated": 1766077216.3781786, "asns": [ 109, 1343, @@ -2443,7 +2448,7 @@ "GITHU-ARIN" ], "v2fly_company": "github", - "last_updated": 1766008505.3642943, + "last_updated": 1766077218.1992714, "asns": [ 36459 ], @@ -6795,7 +6800,7 @@ "ORG-SCG6-RIPE" ], "v2fly_company": "ibm", - "last_updated": 1766008523.2625492, + "last_updated": 1766077244.5068054, "asns": [ 163, 547, @@ -7290,7 +7295,7 @@ "IMPER-62-ARIN" ], "v2fly_company": "", - "last_updated": 1766008523.9751034, + "last_updated": 1766077245.6635113, "asns": [ 62571 ], @@ -7336,7 +7341,7 @@ "ORG-HTB10-RIPE" ], "v2fly_company": "huawei", - "last_updated": 1766008526.8373091, + "last_updated": 1766077249.7932262, "asns": [ 131444, 136907, @@ -7972,7 +7977,7 @@ "ORG-TCL14-AP-APNIC" ], "v2fly_company": "tencent", - "last_updated": 1766008528.6816173, + "last_updated": 1766077252.6289346, "asns": [ 132203, 132591, @@ -8944,7 +8949,7 @@ "SALESF-3-ARIN" ], "v2fly_company": "salesforce", - "last_updated": 1766008531.7230027, + "last_updated": 1766077256.95568, "asns": [ 14340, 22606, @@ -9066,7 +9071,7 @@ "ZOHOC-ARIN" ], "v2fly_company": "zoho", - "last_updated": 1766008535.7371716, + "last_updated": 1766077263.0154922, "asns": [ 2639, 56201, @@ -9196,7 +9201,7 @@ ], "org_ids": [], "v2fly_company": "", - "last_updated": 1766008537.5017958, + "last_updated": 1766077264.7558165, "asns": [], "cidrs": [ "108.138.0.0/15", @@ -9386,7 +9391,7 @@ "ORG-ATI1-AP-APNIC" ], "v2fly_company": "akamai", - "last_updated": 1766008549.089396, + "last_updated": 1766077283.4564834, "asns": [ 12222, 16625, @@ -10137,7 +10142,9 @@ "172.224.179.0/24", "172.224.18.0/23", "172.224.180.0/22", - "172.224.184.0/21", + "172.224.185.0/24", + "172.224.186.0/23", + "172.224.188.0/22", "172.224.192.0/20", "172.224.208.0/23", "172.224.210.0/24", @@ -10480,7 +10487,7 @@ "184.26.176.0/21", "184.26.192.0/18", "184.26.32.0/21", - "184.26.40.0/24", + "184.26.40.0/23", "184.26.43.0/24", "184.26.44.0/22", "184.26.48.0/22", @@ -10880,7 +10887,10 @@ "2.17.200.0/23", "2.17.203.0/24", "2.17.204.0/22", - "2.17.208.0/20", + "2.17.208.0/21", + "2.17.217.0/24", + "2.17.218.0/23", + "2.17.220.0/22", "2.17.240.0/20", "2.17.28.0/22", "2.17.32.0/21", @@ -10938,8 +10948,13 @@ "2.20.111.0/24", "2.20.116.0/22", "2.20.120.0/21", - "2.20.128.0/18", + "2.20.128.0/19", "2.20.16.0/21", + "2.20.160.0/20", + "2.20.176.0/23", + "2.20.179.0/24", + "2.20.180.0/22", + "2.20.184.0/21", "2.20.192.0/19", "2.20.224.0/20", "2.20.240.0/23", @@ -10956,8 +10971,12 @@ "2.20.44.0/23", "2.20.47.0/24", "2.20.48.0/20", - "2.20.64.0/19", + "2.20.64.0/22", + "2.20.69.0/24", + "2.20.70.0/23", + "2.20.72.0/21", "2.20.8.0/21", + "2.20.80.0/20", "2.20.96.0/21", "2.21.0.0/23", "2.21.112.0/21", @@ -12666,10 +12685,7 @@ "23.57.128.0/17", "23.57.16.0/20", "23.57.32.0/19", - "23.57.64.0/21", - "23.57.72.0/22", - "23.57.76.0/24", - "23.57.78.0/23", + "23.57.64.0/20", "23.57.8.0/22", "23.57.80.0/22", "23.57.88.0/21", @@ -12726,9 +12742,6 @@ "23.6.64.0/20", "23.6.96.0/20", "23.60.0.0/18", - "23.60.100.0/22", - "23.60.104.0/21", - "23.60.112.0/20", "23.60.128.0/19", "23.60.160.0/21", "23.60.168.0/24", @@ -12742,8 +12755,7 @@ "23.60.72.0/22", "23.60.78.0/23", "23.60.80.0/20", - "23.60.96.0/24", - "23.60.98.0/23", + "23.60.96.0/19", "23.61.0.0/22", "23.61.112.0/22", "23.61.118.0/23", @@ -15678,9 +15690,7 @@ "95.101.120.0/21", "95.101.132.0/24", "95.101.134.0/23", - "95.101.136.0/22", - "95.101.140.0/23", - "95.101.142.0/24", + "95.101.136.0/21", "95.101.144.0/21", "95.101.152.0/22", "95.101.160.0/21", @@ -15911,7 +15921,7 @@ "ORG-OSA29-RIPE" ], "v2fly_company": "oracle", - "last_updated": 1766008564.387157, + "last_updated": 1766077312.8253183, "asns": [ 90, 792, @@ -18365,7 +18375,7 @@ "ORG-AI2-AP-APNIC" ], "v2fly_company": "amazon", - "last_updated": 1766008575.5159352, + "last_updated": 1766077329.0833478, "asns": [ 699, 801, @@ -18912,6 +18922,11 @@ "108.157.27.0/24", "108.157.28.0/22", "108.157.32.0/21", + "108.157.42.0/23", + "108.157.44.0/22", + "108.157.48.0/22", + "108.157.52.0/23", + "108.157.54.0/24", "108.157.57.0/24", "108.157.58.0/23", "108.157.60.0/22", @@ -19388,15 +19403,14 @@ "13.225.120.0/23", "13.225.122.0/24", "13.225.124.0/22", - "13.225.128.0/19", + "13.225.128.0/21", + "13.225.136.0/24", + "13.225.139.0/24", + "13.225.140.0/24", + "13.225.152.0/21", "13.225.16.0/21", - "13.225.160.0/20", - "13.225.176.0/21", - "13.225.184.0/24", - "13.225.187.0/24", - "13.225.188.0/24", - "13.225.200.0/21", - "13.225.208.0/20", + "13.225.160.0/19", + "13.225.192.0/19", "13.225.224.0/20", "13.225.24.0/23", "13.225.249.0/24", @@ -19406,7 +19420,11 @@ "13.225.29.0/24", "13.225.30.0/23", "13.225.32.0/21", - "13.225.40.0/24", + "13.225.40.0/23", + "13.225.42.0/24", + "13.225.45.0/24", + "13.225.46.0/23", + "13.225.48.0/21", "13.225.56.0/24", "13.225.72.0/24", "13.225.8.0/24", @@ -19639,8 +19657,7 @@ "13.32.118.0/23", "13.32.120.0/23", "13.32.122.0/24", - "13.32.129.0/24", - "13.32.130.0/23", + "13.32.128.0/22", "13.32.132.0/23", "13.32.139.0/24", "13.32.140.0/24", @@ -19664,15 +19681,12 @@ "13.32.4.0/24", "13.32.40.0/22", "13.32.46.0/23", - "13.32.48.0/21", - "13.32.56.0/22", - "13.32.60.0/23", - "13.32.63.0/24", + "13.32.48.0/20", "13.32.64.0/21", "13.32.7.0/24", "13.32.8.0/23", "13.32.80.0/21", - "13.32.88.0/24", + "13.32.88.0/22", "13.32.92.0/23", "13.32.94.0/24", "13.32.98.0/23", @@ -19701,9 +19715,8 @@ "13.33.205.0/24", "13.33.206.0/23", "13.33.208.0/20", - "13.33.224.0/21", + "13.33.224.0/19", "13.33.24.0/22", - "13.33.240.0/20", "13.33.28.0/24", "13.33.30.0/24", "13.33.32.0/19", @@ -19718,48 +19731,45 @@ "13.33.96.0/21", "13.35.0.0/16", "13.35.104.0/24", + "13.35.107.0/24", + "13.35.108.0/24", "13.35.121.0/24", "13.35.122.0/23", "13.35.124.0/22", "13.35.128.0/21", "13.35.136.0/24", + "13.35.139.0/24", + "13.35.140.0/24", + "13.35.155.0/24", "13.35.156.0/24", "13.35.16.0/21", "13.35.169.0/24", "13.35.170.0/24", "13.35.173.0/24", "13.35.174.0/23", - "13.35.176.0/21", - "13.35.184.0/23", - "13.35.186.0/24", - "13.35.188.0/22", + "13.35.176.0/20", "13.35.192.0/19", "13.35.224.0/21", "13.35.232.0/23", "13.35.234.0/24", "13.35.237.0/24", "13.35.238.0/23", - "13.35.24.0/24", + "13.35.24.0/23", "13.35.240.0/21", "13.35.248.0/24", "13.35.26.0/24", - "13.35.29.0/24", - "13.35.30.0/23", + "13.35.28.0/22", "13.35.32.0/21", + "13.35.41.0/24", "13.35.43.0/24", - "13.35.56.0/22", - "13.35.60.0/23", - "13.35.62.0/24", + "13.35.44.0/24", + "13.35.56.0/21", "13.35.73.0/24", "13.35.74.0/24", "13.35.77.0/24", "13.35.78.0/23", "13.35.8.0/21", - "13.35.80.0/21", - "13.35.88.0/23", - "13.35.90.0/24", - "13.35.93.0/24", - "13.35.94.0/23", + "13.35.80.0/20", "13.35.96.0/21", "13.36.155.0/24", "13.36.18.0/28", @@ -19851,6 +19861,7 @@ "130.137.124.0/24", "130.137.14.0/24", "130.137.150.0/24", + "130.137.16.0/24", "130.137.166.0/23", "130.137.170.0/24", "130.137.172.0/23", @@ -19861,6 +19872,7 @@ "130.137.239.0/24", "130.137.253.0/24", "130.137.28.0/23", + "130.137.78.0/24", "130.137.82.0/24", "130.137.9.0/24", "130.150.200.0/21", @@ -19915,7 +19927,6 @@ "130.176.238.0/24", "130.176.254.0/23", "130.176.27.0/24", - "130.176.36.0/24", "130.176.45.0/24", "130.176.55.0/24", "130.176.56.0/24", @@ -20327,7 +20338,6 @@ "144.220.114.0/24", "144.220.122.0/24", "144.220.128.0/24", - "144.220.19.0/24", "144.220.28.0/24", "144.220.39.0/24", "144.220.40.0/24", @@ -20458,6 +20468,8 @@ "15.103.16.0/21", "15.128.0.0/13", "15.128.0.0/20", + "15.129.0.0/20", + "15.129.16.0/21", "15.134.66.0/23", "15.135.0.0/16", "15.136.0.0/15", @@ -21414,6 +21426,7 @@ "16.142.0.0/16", "16.144.0.0/12", "16.146.0.0/15", + "16.147.182.0/23", "16.148.0.0/16", "16.15.0.0/16", "16.15.0.0/20", @@ -22196,12 +22209,7 @@ "18.154.128.0/22", "18.154.132.0/23", "18.154.134.0/24", - "18.154.137.0/24", - "18.154.138.0/23", "18.154.14.0/24", - "18.154.140.0/22", - "18.154.144.0/22", - "18.154.148.0/23", "18.154.152.0/21", "18.154.160.0/22", "18.154.164.0/24", @@ -22223,9 +22231,6 @@ "18.154.212.0/22", "18.154.216.0/21", "18.154.224.0/24", - "18.154.227.0/24", - "18.154.228.0/22", - "18.154.232.0/21", "18.154.24.0/22", "18.154.242.0/23", "18.154.244.0/22", @@ -22563,10 +22568,7 @@ "18.165.244.0/22", "18.165.248.0/21", "18.165.28.0/24", - "18.165.31.0/24", - "18.165.32.0/21", "18.165.4.0/22", - "18.165.40.0/22", "18.165.46.0/23", "18.165.48.0/21", "18.165.56.0/23", @@ -22960,7 +22962,12 @@ "18.245.139.0/24", "18.245.140.0/22", "18.245.144.0/21", + "18.245.154.0/23", + "18.245.156.0/22", "18.245.16.0/21", + "18.245.160.0/22", + "18.245.164.0/23", + "18.245.166.0/24", "18.245.169.0/24", "18.245.172.0/22", "18.245.176.0/21", @@ -24691,6 +24698,7 @@ "213.139.66.0/24", "213.156.160.0/22", "213.156.164.0/23", + "213.156.245.0/24", "213.156.250.0/23", "213.156.252.0/22", "213.170.156.0/22", @@ -24728,7 +24736,7 @@ "216.137.34.0/24", "216.137.36.0/24", "216.137.39.0/24", - "216.137.40.0/24", + "216.137.40.0/23", "216.137.42.0/24", "216.137.44.0/24", "216.137.46.0/23", @@ -24787,8 +24795,7 @@ "216.198.200.0/21", "216.198.208.0/20", "216.198.22.0/24", - "216.198.224.0/20", - "216.198.240.0/21", + "216.198.224.0/19", "216.198.33.0/24", "216.198.34.0/23", "216.198.36.0/24", @@ -26064,6 +26071,7 @@ "2600:9000:203a::/47", "2600:9000:203d::/48", "2600:9000:2040::/48", + "2600:9000:2049::/48", "2600:9000:204a::/48", "2600:9000:204f::/48", "2600:9000:2051::/48", @@ -26095,6 +26103,7 @@ "2600:9000:20a0::/48", "2600:9000:20a4::/47", "2600:9000:20a6::/48", + "2600:9000:20a8::/48", "2600:9000:20aa::/47", "2600:9000:20ae::/48", "2600:9000:20b4::/48", @@ -26129,7 +26138,8 @@ "2600:9000:2140::/47", "2600:9000:2142::/48", "2600:9000:2146::/48", - "2600:9000:215b::/48", + "2600:9000:2157::/48", + "2600:9000:215a::/47", "2600:9000:215c::/48", "2600:9000:2162::/48", "2600:9000:2165::/48", @@ -26146,6 +26156,7 @@ "2600:9000:219a::/48", "2600:9000:219c::/48", "2600:9000:21a1::/48", + "2600:9000:21a2::/48", "2600:9000:21b4::/47", "2600:9000:21b7::/48", "2600:9000:21b8::/48", @@ -26155,7 +26166,7 @@ "2600:9000:21c8::/48", "2600:9000:21d1::/48", "2600:9000:21d2::/47", - "2600:9000:21d5::/48", + "2600:9000:21d4::/47", "2600:9000:21d7::/48", "2600:9000:21e0::/48", "2600:9000:21ea::/47", @@ -26306,6 +26317,7 @@ "2600:9000:25f0::/45", "2600:9000:25fa::/47", "2600:9000:2600::/48", + "2600:9000:260d::/48", "2600:9000:260e::/47", "2600:9000:2610::/47", "2600:9000:2614::/46", @@ -26364,6 +26376,7 @@ "2600:9000:26a8::/47", "2600:9000:26aa::/48", "2600:9000:26b8::/48", + "2600:9000:26ba::/48", "2600:9000:26bc::/47", "2600:9000:26bf::/48", "2600:9000:26c0::/45", @@ -27060,19 +27073,18 @@ "2605:9cc0:378::/48", "2605:9cc0:3a7::/48", "2605:9cc0:3b3::/48", + "2605:9cc0:3b4::/48", "2605:9cc0:3c2::/48", "2605:9cc0:3cc::/48", + "2605:9cc0:3d4::/48", "2605:9cc0:40c::/48", "2605:9cc0:492::/47", "2605:9cc0::/46", - "2605:9cc0:c02::/48", - "2605:9cc0:c06::/47", - "2605:9cc0:c08::/46", - "2605:9cc0:c0c::/48", - "2605:9cc0:c10::/48", - "2605:9cc0:c13::/48", - "2605:9cc0:c16::/47", - "2605:9cc0:c1d::/48", + "2605:9cc0:c00::/44", + "2605:9cc0:c10::/45", + "2605:9cc0:c18::/46", + "2605:9cc0:c1c::/47", + "2605:9cc0:c1e::/48", "2605:9cc0:dba::/47", "2605:9cc0:f03e::/48", "2605:a7c0:100::/45", @@ -28019,7 +28031,9 @@ "3.160.50.0/23", "3.160.52.0/22", "3.160.56.0/21", - "3.160.79.0/24", + "3.160.66.0/23", + "3.160.68.0/22", + "3.160.72.0/21", "3.160.8.0/21", "3.160.82.0/23", "3.160.84.0/22", @@ -28167,12 +28181,7 @@ "3.163.163.0/24", "3.163.164.0/22", "3.163.168.0/21", - "3.163.178.0/23", "3.163.18.0/23", - "3.163.180.0/22", - "3.163.184.0/22", - "3.163.188.0/23", - "3.163.190.0/24", "3.163.193.0/24", "3.163.194.0/23", "3.163.196.0/22", @@ -28479,11 +28488,8 @@ "3.167.62.0/24", "3.167.64.0/21", "3.167.72.0/22", - "3.167.77.0/24", - "3.167.78.0/24", "3.167.8.0/22", - "3.167.80.0/21", - "3.167.88.0/22", + "3.167.91.0/24", "3.167.93.0/24", "3.167.94.0/24", "3.167.96.0/21", @@ -28975,10 +28981,6 @@ "3.175.190.0/23", "3.175.192.0/21", "3.175.200.0/24", - "3.175.202.0/23", - "3.175.205.0/24", - "3.175.206.0/23", - "3.175.208.0/21", "3.175.216.0/24", "3.175.219.0/24", "3.175.220.0/24", @@ -30361,7 +30363,7 @@ "52.215.218.64/28", "52.216.0.0/15", "52.216.0.0/18", - "52.216.0.0/18", + "52.216.0.0/19", "52.216.0.0/22", "52.216.128.0/18", "52.216.128.0/18", @@ -30377,6 +30379,7 @@ "52.216.208.0/20", "52.216.224.0/19", "52.216.224.0/19", + "52.216.48.0/20", "52.216.64.0/22", "52.216.64.0/22", "52.216.76.0/22", @@ -30389,8 +30392,6 @@ "52.216.96.0/19", "52.217.0.0/16", "52.217.0.0/18", - "52.217.128.0/19", - "52.217.192.0/18", "52.217.36.0/22", "52.217.40.0/21", "52.217.48.0/22", @@ -30424,6 +30425,7 @@ "52.219.0.0/20", "52.219.0.0/20", "52.219.0.0/20", + "52.219.104.0/22", "52.219.112.0/21", "52.219.128.0/18", "52.219.128.0/21", @@ -30457,7 +30459,6 @@ "52.219.224.0/21", "52.219.23.0/24", "52.219.232.0/22", - "52.219.232.0/22", "52.219.24.0/21", "52.219.254.0/23", "52.219.32.0/20", @@ -30479,7 +30480,7 @@ "52.219.88.0/22", "52.219.96.0/19", "52.219.96.0/19", - "52.219.96.0/20", + "52.219.96.0/21", "52.220.191.0/26", "52.221.221.128/29", "52.222.0.0/16", @@ -30603,10 +30604,12 @@ "52.83.58.0/24", "52.84.0.0/14", "52.84.0.0/14", - "52.84.128.0/24", + "52.84.120.0/21", + "52.84.128.0/22", "52.84.134.0/23", "52.84.14.0/23", - "52.84.147.0/24", + "52.84.145.0/24", + "52.84.146.0/23", "52.84.148.0/22", "52.84.16.0/20", "52.84.164.0/22", @@ -30631,11 +30634,10 @@ "52.84.42.0/23", "52.84.44.0/22", "52.84.48.0/21", - "52.84.56.0/23", + "52.84.57.0/24", "52.84.71.0/24", "52.84.84.0/23", "52.84.86.0/24", - "52.84.96.0/21", "52.85.0.0/22", "52.85.103.0/24", "52.85.129.0/24", @@ -30650,8 +30652,9 @@ "52.85.180.0/23", "52.85.182.0/24", "52.85.191.0/24", - "52.85.197.0/24", - "52.85.198.0/23", + "52.85.192.0/22", + "52.85.202.0/23", + "52.85.204.0/23", "52.85.224.0/24", "52.85.226.0/24", "52.85.238.0/23", @@ -30685,7 +30688,6 @@ "52.92.136.0/21", "52.92.16.0/21", "52.92.176.0/21", - "52.92.192.0/20", "52.92.224.0/20", "52.92.248.0/21", "52.92.32.0/21", @@ -31007,8 +31009,8 @@ "54.190.198.32/28", "54.192.0.0/12", "54.192.0.0/12", - "54.192.10.0/23", "54.192.108.0/22", + "54.192.11.0/24", "54.192.116.0/22", "54.192.12.0/23", "54.192.120.0/21", @@ -31017,7 +31019,8 @@ "54.192.14.0/24", "54.192.140.0/22", "54.192.144.0/21", - "54.192.156.0/22", + "54.192.156.0/23", + "54.192.158.0/24", "54.192.160.0/23", "54.192.162.0/24", "54.192.180.0/24", @@ -31088,7 +31091,7 @@ "54.230.15.0/24", "54.230.152.0/23", "54.230.156.0/22", - "54.230.16.0/22", + "54.230.16.0/21", "54.230.160.0/22", "54.230.173.0/24", "54.230.174.0/23", @@ -31115,7 +31118,6 @@ "54.231.120.0/21", "54.231.120.0/21", "54.231.128.0/17", - "54.231.192.0/19", "54.231.34.0/23", "54.231.36.0/24", "54.231.40.0/21", @@ -32618,6 +32620,7 @@ "aws-icp-domain-manager.cn", "aws-iot-hackathon.com", "aws.com", + "aws.dev", "awsapprunner.com", "awsapps.cn", "awsapps.com", @@ -32737,13 +32740,13 @@ "ORG-ASEP1-AP-APNIC" ], "v2fly_company": "alibaba", - "last_updated": 1766008576.2053795, + "last_updated": 1766077330.1764228, "asns": [ 134963 ], "cidrs": [ - "103.173.12.0/24", "103.206.40.0/22", + "139.95.66.0/24", "14.1.112.0/22", "14.1.115.0/24", "147.139.252.0/22", @@ -32783,14 +32786,10 @@ "178.132.247.0/24", "198.11.144.0/24", "203.107.48.0/22", - "205.198.40.0/23", "205.198.43.0/24", - "209.146.118.0/24", "2401:8680:4004::/46", "2401:8680:4100::/48", "2401:8680:4102::/48", - "38.47.128.0/20", - "45.194.56.0/22", "47.236.216.0/22", "47.237.248.0/24", "47.238.24.0/22", @@ -33242,7 +33241,7 @@ "ORG-HOA1-RIPE" ], "v2fly_company": "hetzner", - "last_updated": 1766008577.527033, + "last_updated": 1766077332.0306065, "asns": [ 24940, 212317, @@ -33427,7 +33426,7 @@ "ORG-GSPL5-AP-APNIC" ], "v2fly_company": "google", - "last_updated": 1766008589.9344804, + "last_updated": 1766077351.3559945, "asns": [ 6432, 13949, @@ -33712,6 +33711,7 @@ "136.121.16.0/24", "136.121.24.0/21", "136.124.0.0/15", + "136.126.224.0/24", "136.146.76.0/24", "136.22.113.0/24", "136.22.114.0/23", @@ -34282,6 +34282,7 @@ "208.68.108.0/22", "208.76.215.0/24", "208.76.24.0/22", + "208.76.69.0/24", "208.76.70.0/24", "208.81.188.0/22", "208.86.170.0/23", @@ -35997,6 +35998,8 @@ "onefifteen.net", "onefifteen.org", "oneworldmanystories.com", + "opal.google", + "opal.google.com", "opensourceinsight.dev", "opensourceinsights.dev", "openthread.io", @@ -36441,7 +36444,7 @@ "BACKB-7-ARIN" ], "v2fly_company": "", - "last_updated": 1766008590.4959126, + "last_updated": 1766077352.2361722, "asns": [ 40401, 396865 @@ -36493,7 +36496,7 @@ "RACKS-8-ARIN" ], "v2fly_company": "", - "last_updated": 1766008595.1754928, + "last_updated": 1766077359.4811351, "asns": [ 10532, 12200, @@ -36736,7 +36739,7 @@ "DO-13-ARIN" ], "v2fly_company": "digitalocean", - "last_updated": 1766008597.0108418, + "last_updated": 1766077362.3129041, "asns": [ 14061, 46652, @@ -37041,7 +37044,7 @@ "ORG-CSL5-AP-APNIC" ], "v2fly_company": "cloudflare", - "last_updated": 1766008601.3846335, + "last_updated": 1766077369.874412, "asns": [ 13335, 14789, @@ -37248,6 +37251,7 @@ "143.14.229.0/24", "143.14.251.0/24", "143.20.247.0/24", + "144.124.211.0/24", "147.185.161.0/24", "147.78.140.0/24", "148.227.167.0/24", @@ -37309,14 +37313,8 @@ "162.120.94.0/24", "162.158.0.0/15", "162.158.0.0/20", - "162.158.128.0/22", - "162.158.132.0/23", - "162.158.134.0/24", - "162.158.136.0/21", - "162.158.144.0/20", + "162.158.128.0/17", "162.158.16.0/21", - "162.158.160.0/19", - "162.158.192.0/18", "162.158.20.0/22", "162.158.226.0/23", "162.158.24.0/23", @@ -37324,8 +37322,7 @@ "162.158.26.0/24", "162.158.28.0/22", "162.158.32.0/21", - "162.158.41.0/24", - "162.158.42.0/23", + "162.158.40.0/22", "162.158.44.0/23", "162.158.46.0/24", "162.158.48.0/20", @@ -37530,11 +37527,7 @@ "172.70.185.0/24", "172.70.186.0/23", "172.70.188.0/22", - "172.70.192.0/21", - "172.70.200.0/24", - "172.70.202.0/23", - "172.70.204.0/22", - "172.70.208.0/20", + "172.70.192.0/19", "172.70.224.0/21", "172.70.232.0/23", "172.70.234.0/24", @@ -37547,13 +37540,10 @@ "172.70.62.0/23", "172.70.64.0/21", "172.70.80.0/20", - "172.71.0.0/21", + "172.71.0.0/18", "172.71.108.0/22", "172.71.112.0/20", - "172.71.12.0/23", "172.71.128.0/18", - "172.71.15.0/24", - "172.71.16.0/20", "172.71.192.0/21", "172.71.200.0/24", "172.71.203.0/24", @@ -37566,9 +37556,7 @@ "172.71.248.0/24", "172.71.253.0/24", "172.71.254.0/23", - "172.71.32.0/19", "172.71.64.0/19", - "172.71.8.0/22", "172.71.96.0/21", "172.83.72.0/23", "172.83.76.0/24", @@ -37585,6 +37573,7 @@ "176.126.206.0/23", "178.211.142.0/24", "178.213.76.0/24", + "178.94.249.0/24", "181.214.1.0/24", "182.23.210.0/24", "184.174.80.0/24", @@ -38045,7 +38034,7 @@ "2400:cb00:600::/47", "2400:cb00:604::/46", "2400:cb00:608::/48", - "2400:cb00:60::/48", + "2400:cb00:60::/47", "2400:cb00:610::/45", "2400:cb00:618::/47", "2400:cb00:620::/47", @@ -38079,6 +38068,7 @@ "2400:cb00:693::/48", "2400:cb00:694::/47", "2400:cb00:696::/48", + "2400:cb00:700::/48", "2400:cb00:704::/47", "2400:cb00:707::/48", "2400:cb00:708::/48", @@ -39711,6 +39701,7 @@ "82.118.242.0/24", "82.139.216.0/23", "82.21.82.0/24", + "82.22.16.0/24", "82.26.156.0/24", "83.118.224.0/22", "86.38.214.0/24", @@ -39827,7 +39818,7 @@ "ORG-MSPL4-AP-APNIC" ], "v2fly_company": "azure", - "last_updated": 1766008616.7066576, + "last_updated": 1766077393.7941124, "asns": [ 3598, 5761, @@ -40551,6 +40542,7 @@ "185.34.250.0/24", "185.34.84.0/22", "185.42.70.0/24", + "185.45.122.0/24", "185.52.203.0/24", "185.76.182.0/23", "185.76.37.0/24", @@ -41183,7 +41175,7 @@ "208.83.106.0/24", "208.84.0.0/21", "208.90.118.0/24", - "208.90.236.0/24", + "208.90.236.0/23", "208.91.245.0/24", "208.92.176.0/22", "209.127.190.0/24", @@ -42508,7 +42500,7 @@ "ORG-AGTL2-RIPE" ], "v2fly_company": "", - "last_updated": 1766008617.9570665, + "last_updated": 1766077395.7827952, "asns": [ 57568, 208006, @@ -42550,7 +42542,7 @@ "DCC-25-ARIN" ], "v2fly_company": "dell", - "last_updated": 1766008621.6322978, + "last_updated": 1766077401.1571643, "asns": [ 3612, 3613, @@ -42924,7 +42916,7 @@ "ORG-WTI2-AP-APNIC" ], "v2fly_company": "", - "last_updated": 1766008622.4345474, + "last_updated": 1766077402.5905583, "asns": [ 140642, 395717 @@ -42967,7 +42959,7 @@ "ORG-KI4-AP-APNIC" ], "v2fly_company": "", - "last_updated": 1766008624.8682008, + "last_updated": 1766077406.213369, "asns": [ 36007, 41436, @@ -43158,7 +43150,7 @@ "HPE-15-ARIN" ], "v2fly_company": "hpe", - "last_updated": 1766008629.6196635, + "last_updated": 1766077413.4205842, "asns": [ 157, 1033, @@ -43252,7 +43244,7 @@ "SUC-48-ARIN" ], "v2fly_company": "", - "last_updated": 1766008630.8590822, + "last_updated": 1766077415.3931246, "asns": [ 12876, 29447, diff --git a/cloudcheck/providers/__init__.py b/cloudcheck/providers/__init__.py index b00693a..6d11076 100644 --- a/cloudcheck/providers/__init__.py +++ b/cloudcheck/providers/__init__.py @@ -6,6 +6,7 @@ # Dictionary to store loaded provider classes _provider_classes: Dict[str, Type[BaseProvider]] = {} +_provider_instances: Dict[str, BaseProvider] = {} def load_provider_classes() -> Dict[str, Type[BaseProvider]]: @@ -45,4 +46,6 @@ def load_provider_classes() -> Dict[str, Type[BaseProvider]]: for provider_name, provider_class in load_provider_classes().items(): - globals()[provider_name] = provider_class() + provider_instance = provider_class() + globals()[provider_name] = provider_instance + _provider_instances[provider_name] = provider_instance diff --git a/pyproject.toml b/pyproject.toml index 0cd6651..fe95968 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "cloudcheck" -version = "8.4.2" +version = "8.4.3" description = "Detailed database of cloud providers. Instantly look up a domain or IP address" readme = "README.md" requires-python = ">=3.9" diff --git a/src/lib.rs b/src/lib.rs index ebc83cf..948eaef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,4 @@ +use log::debug; use radixtarget::{RadixTarget, ScopeMode}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -66,13 +67,18 @@ impl CloudCheck { async fn fetch_and_cache(cache_path: &PathBuf) -> Result { let url = Self::get_signature_url(); + debug!("Fetching data from URL: {}", url); let response = reqwest::get(&url).await?; let json_data = response.text().await?; + debug!("Fetched {} bytes from network", json_data.len()); if let Some(parent) = cache_path.parent() { + debug!("Creating cache directory: {:?}", parent); tokio::fs::create_dir_all(parent).await?; } + debug!("Writing cache file: {:?}", cache_path); tokio::fs::write(cache_path, &json_data).await?; + debug!("Cache file written successfully"); Ok(json_data) } @@ -83,13 +89,31 @@ impl CloudCheck { async fn get_last_fetch_time(&self, cache_path: &PathBuf) -> Result, Error> { let last_fetch = self.last_fetch.lock().await; match *last_fetch { - Some(time) => Ok(Some(time)), + Some(time) => { + debug!("Using in-memory last_fetch timestamp: {:?}", time); + Ok(Some(time)) + } None => { // No in-memory timestamp - check file modification time drop(last_fetch); + debug!( + "No in-memory timestamp, checking cache file modification time: {:?}", + cache_path + ); match tokio::fs::metadata(cache_path).await { - Ok(metadata) => Ok(metadata.modified().ok()), - Err(_) => Ok(None), + Ok(metadata) => { + if let Ok(modified) = metadata.modified() { + debug!("Cache file modification time: {:?}", modified); + Ok(Some(modified)) + } else { + debug!("Cache file exists but modification time unavailable"); + Ok(None) + } + } + Err(_) => { + debug!("Cache file does not exist: {:?}", cache_path); + Ok(None) + } } } } @@ -105,20 +129,32 @@ impl CloudCheck { needs_refresh: bool, ) -> Result<(String, bool), Error> { if needs_refresh { + debug!("Refresh needed, fetching from network"); let data = Self::fetch_and_cache(cache_path).await?; Ok((data, true)) } else { + debug!("No refresh needed, loading from cache: {:?}", cache_path); match tokio::fs::read_to_string(cache_path).await { Ok(data) => { + debug!("Successfully loaded {} bytes from cache", data.len()); // First load from cache - set timestamp to track process runtime let now = SystemTime::now(); let mut last_fetch = self.last_fetch.lock().await; if last_fetch.is_none() { + debug!("Setting in-memory last_fetch timestamp to current time"); *last_fetch = Some(now); + } else { + debug!( + "In-memory last_fetch timestamp already set, keeping existing value" + ); } Ok((data, false)) } - Err(_) => { + Err(e) => { + debug!( + "Failed to read cache file ({}), falling back to network fetch", + e + ); // Cache file was deleted between stat and read, fetch fresh let data = Self::fetch_and_cache(cache_path).await?; Ok((data, true)) @@ -192,43 +228,66 @@ impl CloudCheck { let cache_valid_duration = Duration::from_secs(24 * 60 * 60); let now = SystemTime::now(); let cache_path = Self::get_cache_path()?; + debug!( + "ensure_loaded: cache_valid_duration={:?}, cache_path={:?}", + cache_valid_duration, cache_path + ); // Check if we need refresh (uses in-memory timestamp, falls back to file stat) let last_fetch_time = self.get_last_fetch_time(&cache_path).await?; let needs_refresh = match last_fetch_time { - Some(fetch_time) => now - .duration_since(fetch_time) - .map(|elapsed| elapsed >= cache_valid_duration) - .unwrap_or(true), - None => true, + Some(fetch_time) => { + let elapsed = now.duration_since(fetch_time).ok(); + let needs = elapsed.map(|e| e >= cache_valid_duration).unwrap_or(true); + if let Some(e) = elapsed { + debug!("Time since last fetch: {:?}, needs_refresh={}", e, needs); + } else { + debug!("Could not calculate duration since last fetch, needs_refresh=true"); + } + needs + } + None => { + debug!("No last_fetch_time available, needs_refresh=true"); + true + } }; // Early return if data is already loaded and fresh { let radix_guard = self.radix.read().await; if radix_guard.is_some() && !needs_refresh { + debug!("Data already loaded and fresh, returning early"); return Ok(()); } + debug!("Data not loaded or needs refresh, proceeding to load"); } // Load JSON data and build structures let (json_data, fetched_fresh) = self.load_json_data(&cache_path, needs_refresh).await?; + debug!( + "Loaded JSON data, fetched_fresh={}, building data structures", + fetched_fresh + ); let (radix, providers_map) = Self::build_data_structures(&json_data)?; + debug!("Built data structures: radix tree and providers map"); // Update in-memory data structures { let mut radix_guard = self.radix.write().await; *radix_guard = Some(radix); + debug!("Updated radix tree in memory"); } { let mut providers_guard = self.providers.write().await; *providers_guard = Some(providers_map); + debug!("Updated providers map in memory"); } // Update timestamp if we fetched fresh data if fetched_fresh { let mut last_fetch = self.last_fetch.lock().await; *last_fetch = Some(now); + debug!("Updated in-memory last_fetch timestamp to {:?}", now); } Ok(()) diff --git a/src/main.rs b/src/main.rs index aa8c33f..568d6af 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ use cloudcheck::CloudCheck; #[tokio::main] async fn main() { + env_logger::init(); let args: Vec = std::env::args().collect(); if args.len() != 2 { eprintln!("Usage: cloudcheck "); diff --git a/test_cloudcheck.py b/test_cloudcheck.py index 5f6054b..8d0e6d5 100644 --- a/test_cloudcheck.py +++ b/test_cloudcheck.py @@ -19,9 +19,6 @@ async def test_lookup_amazon_domain(): def test_import_provider(): - import cloudcheck.providers as providers - - print(dir(providers)) from cloudcheck.providers import Amazon assert Amazon.regexes diff --git a/uv.lock b/uv.lock index c1e087f..f3f8ae5 100644 --- a/uv.lock +++ b/uv.lock @@ -140,7 +140,7 @@ wheels = [ [[package]] name = "cloudcheck" -version = "8.4.2" +version = "8.4.3" source = { editable = "." } [package.dev-dependencies]