get_local_info是一个获取linux本地信息的Rust三方库,其目标是降低获取本地linux系统信息的难度。支持银河麒麟10、UOS、鸿蒙等国产系统
项目维护:长期
当前版本0.1.4,已有功能:
1.获取活动网卡信息:网卡,IPv4,IPv6,mac
2.获取网络接口信息
3.获取系统版本
Kylin10支持2017及以上版本
Ubuntu支持22.04及以上版本
UOS20支持1020及以上版本
4.进程检测
怎么使用:
执行cargo add get_local_info,然后导入调用接口:
extern crate get_local_info;
fn main() {
println!("{}", get_local_info::get_pc_net_card_name());
println!("{}", get_local_info::get_pc_ipv4());
println!("{}", get_local_info::get_pc_ipv6());
println!("{}", get_local_info::get_pc_mac());
println!("{:?}", get_local_info::get_pc_net_card_info());
let osname = "uos";
println!("{}", get_local_info::get_pc_system_ver(osname));
let pname = "gnome";
println!("{}", get_local_info::get_pc_system_check_pname(pname));
}
# About the Author
* Liu Qiang in Wuhan, China
* crates: <https://crates.io/crates/get_local_info>
* github: <https://github.com/daijianshusheng/rs_libGetDeviceInfo>
* create time:2023.12.28