6 个版本
0.2.1 | 2024年2月19日 |
---|---|
0.2.0 | 2024年2月15日 |
0.1.3 | 2024年2月14日 |
0.1.1 | 2024年1月26日 |
#664 in 密码学
在 voynich 中使用
72KB
1.5K SLoC
Tor 客户端库
这是一个用于 Tor 的客户端库,它允许您通过其 API 以编程方式与 Tor 服务器交互。
安装
将其添加到现有项目中
cargo add tor_client_lib
支持的命令
该库目前支持完整的 API 的一小部分(但很有用),即
AUTHENTICATE
AUTHCHALLENGE
GETINFO
PROTOCOLINFO
ADD_ONION
DEL_ONION
如果您想看到更多支持的功能,请提交问题请求或 PR。
示例代码
use tor_client_lib::{
control_connection::TorControlConnection,
error::TorError,
auth::TorAuthentication
};
// Connect to the Tor service running locally
let mut control_connection = TorControlConnection::connect("127.0.0.1:9051").await?;
// Authenticate to the Tor server
control_connection.authenticate(TorAuthentication::SafeCookie(None)).await?;
// Call the "GETINFO" command to get the Tor version number
let tor_version = control_connection.get_info("version").await?;
CLI
仓库包含一个用于向 Tor 发送命令的简单 CLI。要使用它,请运行
cargo run
例如
% cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.07s
Running `target/debug/tor-cli`
Welcome to Tor CLI v0.1.0
Tor CLI> connect
Connected to localhost:9051
Tor CLI> authenticate cookie
Authenticated
Tor CLI> get_info version
["0.4.6.10"]
依赖项
~18–30MB
~435K SLoC