Skip to main content

rsiot/components/cmp_os_process/helpers/
ifconfig.rs

1/// Конфигурация сетевого интерфейса с помощью команды ifconfig
2pub fn ifconfig(
3    adapter: &str,
4    ip: impl AsRef<str>,
5    mask: impl AsRef<str>,
6    gw: impl AsRef<str>,
7) -> Vec<String> {
8    let cmd1 = format!(
9        "ifconfig {adapter} {} netmask {}",
10        ip.as_ref(),
11        mask.as_ref(),
12    );
13    let cmd2 = format!("route add default gw {}", gw.as_ref());
14    vec![cmd1, cmd2]
15}