ITPub博客

首页 > 数据库 > 数据库开发技术 > 【Rust日报】2021-12-15 - geoping 由 shodan 开发的多地 ping 工具

【Rust日报】2021-12-15 - geoping 由 shodan 开发的多地 ping 工具

原创 数据库开发技术 作者:Rust语言中文社区 时间:2021-12-15 23:42:34 0 删除 编辑

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


From 日报小组 冰山上的 mook && Mike

社区学习交流平台订阅:
  • Rustcc论坛: 支持rss
  • 微信公众号:Rust语言中文社区

原文作者:Rust语言中文社区;如有侵权,请联系管理员删除。

请登录后发表评论 登录
全部评论

注册时间:2020-06-11

  • 博文量
    1769
  • 访问量
    718505