Expand description
GETINFO response parsing.
This module parses responses from the GETINFO command, which retrieves
runtime information from Tor. Unlike GETCONF (which gets configuration),
GETINFO retrieves dynamic state like version, address, and descriptors.
§Response Format
A successful GETINFO response contains key-value pairs:
250-version=0.4.7.1
250-address=192.0.2.1
250 OKMulti-line values use the + divider:
250+config-text=
ControlPort 9051
DataDirectory /home/user/.tor
.
250 OK§Example
use stem_rs::response::{ControlMessage, GetInfoResponse};
let response_text = "250-version=0.4.7.1\r\n\
250-address=192.0.2.1\r\n\
250 OK\r\n";
let msg = ControlMessage::from_str(response_text, None, false).unwrap();
let response = GetInfoResponse::from_message(&msg).unwrap();
assert_eq!(response.get_str("version"), Some("0.4.7.1".to_string()));
assert_eq!(response.get_str("address"), Some("192.0.2.1".to_string()));§Binary Data
Values are stored as raw bytes to support binary data (like descriptors).
Use get_str for string values or access
entries directly for binary data.
§See Also
crate::Controller::get_info: High-level API for getting informationGetConfResponse: For querying configuration- Tor Control Protocol: GETINFO
Structs§
- GetInfo
Response - Parsed response from the GETINFO command.