在「Arti 1.0.0 is released: Our Rust Tor implementation is ready for production use.」這邊看到 Tor 的 Rust 計畫進入了 1.0.0 版。
不過每次編 Rust 的東西都會發現 Rust 版本不夠新,這次也不例外,就不知道是 Rust community 的特性還是真的太少用 Rust...
Updating crates.io index
Downloaded arti v1.0.0
error: failed to parse manifest at `/home/gslin/.cargo/registry/src/github.com-1ecc6299db9ec823/arti-1.0.0/Cargo.toml`
Caused by:
feature `edition2021` is required
this Cargo does not support nightly features, but if you
switch to nightly channel you can add
`cargo-features = ["edition2021"]` to enable this feature
用 rustup update
更新後就能編了,然後跑起來看起來沒什麼問題:
$ arti proxy -p 9150
2022-09-03T17:13:30.234032Z INFO arti: Starting Arti 1.0.0 in SOCKS proxy mode on port 9150...
2022-09-03T17:13:30.238606Z INFO tor_circmgr: We now own the lock on our state files.
2022-09-03T17:13:30.238652Z INFO tor_dirmgr: Didn't get usable directory from cache.
2022-09-03T17:13:30.238674Z INFO arti::socks: Listening on 127.0.0.1:9150.
2022-09-03T17:13:30.238686Z INFO arti::socks: Listening on [::1]:9150.
2022-09-03T17:13:30.238713Z INFO tor_dirmgr::bootstrap: 1: Looking for a consensus.
2022-09-03T17:13:33.833304Z INFO tor_dirmgr::bootstrap: 1: Downloading certificates for consensus (we are missing 9/9).
2022-09-03T17:13:34.335754Z INFO tor_dirmgr::bootstrap: 1: Downloading microdescriptors (we are missing 6629).
2022-09-03T17:13:41.041683Z INFO tor_dirmgr::state: The current consensus is fresh until 2022-09-03 17:00:00.0 +00:00:00, and valid until 2022-09-03 19:00:00.0 +00:00:00. I've picked 2022-09-03 18:35:38.290798754 +00:00:00 as the earliest time to replace it.
2022-09-03T17:13:41.061978Z INFO tor_dirmgr: Marked consensus usable.
2022-09-03T17:13:41.065536Z INFO tor_dirmgr: Directory is complete.
2022-09-03T17:13:41.065557Z INFO tor_dirmgr: We have enough information to build circuits.
2022-09-03T17:13:41.065564Z INFO arti: Sufficiently bootstrapped; system SOCKS now functional.
用 curl 測試也的確是 Tor 的 exit node 了:
$ curl -i --socks5 127.0.0.1:9150 https://httpbin.org/ip
HTTP/2 200
date: Sat, 03 Sep 2022 17:21:20 GMT
content-type: application/json
content-length: 32
server: gunicorn/19.9.0
access-control-allow-origin: *
access-control-allow-credentials: true
{
"origin": "85.93.218.204"
}
$ host 85.93.218.204
204.218.93.85.in-addr.arpa domain name pointer tor.localhost.lu.
看起來 client 的功能能用了...