awc - 一个基于 actix 生态构建的 HTTP 和 websocket 库
支持http 和 websocket
use actix_rt::System;
use awc::Client;
fn main() {
System::new().block_on(async {
let client = Client::default();
let res = client
.get("http://www.rust-lang.org") // <- Create request builder
.insert_header(("User-Agent", "Actix-web"))
.send() // <- Send http request
.await;
println!("Response: {:?}", res); // <- server http response
});
}
ReadMore:https://github.com/actix/actix-web/tree/master/awc
sysinfo - 一个用于获取系统信息的库
它目前支持以下操作系统:
- 安卓
- IOS
- Linux
- macos
- 树莓派
- windows
例子:
use sysinfo::{NetworkExt, NetworksExt, ProcessExt, System, SystemExt};
// Please note that we use "new_all" to ensure that all list of
// components, network interfaces, disks and users are already
// filled!
let mut sys = System::new_all();
// First we update all information of our `System` struct.
sys.refresh_all();
// We display all disks' information:
println!("=> disks:");
for disk in sys.disks() {
println!("{:?}", disk);
}
// Network interfaces name, data received and data transmitted:
println!("=> networks:");
for (interface_name, data) in sys.networks() {
println!("{}: {}/{} B", interface_name, data.received(), data.transmitted());
}
// Components temperature:
println!("=> components:");
for component in sys.components() {
println!("{:?}", component);
}
println!("=> system:");
// RAM and swap information:
println!("total memory: {} KB", sys.total_memory());
println!("used memory : {} KB", sys.used_memory());
println!("total swap : {} KB", sys.total_swap());
println!("used swap : {} KB", sys.used_swap());
// Display system information:
println!("System name: {:?}", sys.name());
println!("System kernel version: {:?}", sys.kernel_version());
println!("System OS version: {:?}", sys.os_version());
println!("System host name: {:?}", sys.host_name());
// Number of processors:
println!("NB processors: {}", sys.processors().len());
// Display processes ID, name na disk usage:
for (pid, process) in sys.processes() {
println!("[{}] {} {:?}", pid, process.name(), process.disk_usage());
}
ReadMore:https://github.com/GuillaumeGomez/sysinfo
geoping - shodan开发的多地ping工具
从世界各地的多个位置向指定地址发送 ping 请求。
ReadMore:https://gitlab.com/shodan-public/geonet-rs
社区学习交流平台订阅:
- Rustcc论坛: 支持rss
- 微信公众号:Rust语言中文社区